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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u486065927 | p02733 | python | s745840572 | s735289908 | 1,692 | 332 | 3,188 | 3,364 | Accepted | Accepted | 80.38 | #na-
import itertools
H, W, K = list(map(int,input().split()))
S = [list(map(int,list(eval(input())))) for _ in range(H)]
def check(k):
if k <= K:
return(True)
else:
return(False)
noans = 0
def make_lst(i):
global noans, lst, havelst
temp = S[0][i]
for h in ran... | def add(in1, in2):
return [a + b for a, b in zip(in1, in2)]
def split(ar, k, w):
a = 0
if max(max(ar)) > k:
return -1
tm = ar[0]
for i in range(1, w):
tm = add(tm, ar[i])
if max(tm) > k:
a += 1
tm = ar[i]
return a
h, w, k =... | 65 | 39 | 1,404 | 901 | # na-
import itertools
H, W, K = list(map(int, input().split()))
S = [list(map(int, list(eval(input())))) for _ in range(H)]
def check(k):
if k <= K:
return True
else:
return False
noans = 0
def make_lst(i):
global noans, lst, havelst
temp = S[0][i]
for h in range(H - 1):
... | def add(in1, in2):
return [a + b for a, b in zip(in1, in2)]
def split(ar, k, w):
a = 0
if max(max(ar)) > k:
return -1
tm = ar[0]
for i in range(1, w):
tm = add(tm, ar[i])
if max(tm) > k:
a += 1
tm = ar[i]
return a
h, w, k = list(map(int, input(... | false | 40 | [
"-# na-",
"-import itertools",
"-",
"-H, W, K = list(map(int, input().split()))",
"-S = [list(map(int, list(eval(input())))) for _ in range(H)]",
"+def add(in1, in2):",
"+ return [a + b for a, b in zip(in1, in2)]",
"-def check(k):",
"- if k <= K:",
"- return True",
"- else:",
"... | false | 0.177599 | 0.137445 | 1.292142 | [
"s745840572",
"s735289908"
] |
u697713131 | p03073 | python | s143290887 | s082983640 | 64 | 22 | 3,956 | 4,268 | Accepted | Accepted | 65.62 | t = list(eval(input()))
def count(t,start):
ans = 0
for i in range(len(t)):
if (i%2 == 0) and (t[i] != start):
ans += 1
if (i%2 == 1) and (t[i] == start):
ans += 1
return ans
ans = min(count(t,'0'), count(t,'1'))
print(ans) | t = list(eval(input()))
ans = min(t[::2].count('0') + t[1::2].count('1'),t[::2].count('1') + t[1::2].count('0'))
print(ans) | 13 | 5 | 301 | 129 | t = list(eval(input()))
def count(t, start):
ans = 0
for i in range(len(t)):
if (i % 2 == 0) and (t[i] != start):
ans += 1
if (i % 2 == 1) and (t[i] == start):
ans += 1
return ans
ans = min(count(t, "0"), count(t, "1"))
print(ans)
| t = list(eval(input()))
ans = min(
t[::2].count("0") + t[1::2].count("1"), t[::2].count("1") + t[1::2].count("0")
)
print(ans)
| false | 61.538462 | [
"-",
"-",
"-def count(t, start):",
"- ans = 0",
"- for i in range(len(t)):",
"- if (i % 2 == 0) and (t[i] != start):",
"- ans += 1",
"- if (i % 2 == 1) and (t[i] == start):",
"- ans += 1",
"- return ans",
"-",
"-",
"-ans = min(count(t, \"0\"), cou... | false | 0.034876 | 0.035956 | 0.969962 | [
"s143290887",
"s082983640"
] |
u657913472 | p03662 | python | s072994405 | s211847461 | 1,477 | 1,366 | 188,532 | 179,384 | Accepted | Accepted | 7.52 | from networkx import*
(N,),*t=[s.split()for s in open(0)]
G=Graph()
for a,b in t:G.add_edge(a,b)
s=shortest_path_length
x=s(G,'1')
y=s(G,N)
c=0
for k in y:c+=x[k]>y[k]
print(('FSennunkeec'[c*2>=int(N)::2])) | from networkx import*
N,*t=open(0)
G=Graph()
for s in t:a,b=s.split();G.add_edge(a,b)
s=shortest_path_length
x=s(G,'1')
y=s(G,N[:-1])
print(('FSennunkeec'[sum(x[k]>y[k]for k in x)*2>=int(N)::2])) | 10 | 8 | 213 | 200 | from networkx import *
(N,), *t = [s.split() for s in open(0)]
G = Graph()
for a, b in t:
G.add_edge(a, b)
s = shortest_path_length
x = s(G, "1")
y = s(G, N)
c = 0
for k in y:
c += x[k] > y[k]
print(("FSennunkeec"[c * 2 >= int(N) :: 2]))
| from networkx import *
N, *t = open(0)
G = Graph()
for s in t:
a, b = s.split()
G.add_edge(a, b)
s = shortest_path_length
x = s(G, "1")
y = s(G, N[:-1])
print(("FSennunkeec"[sum(x[k] > y[k] for k in x) * 2 >= int(N) :: 2]))
| false | 20 | [
"-(N,), *t = [s.split() for s in open(0)]",
"+N, *t = open(0)",
"-for a, b in t:",
"+for s in t:",
"+ a, b = s.split()",
"-y = s(G, N)",
"-c = 0",
"-for k in y:",
"- c += x[k] > y[k]",
"-print((\"FSennunkeec\"[c * 2 >= int(N) :: 2]))",
"+y = s(G, N[:-1])",
"+print((\"FSennunkeec\"[sum(x[... | false | 0.043524 | 0.043916 | 0.991074 | [
"s072994405",
"s211847461"
] |
u996665352 | p02690 | python | s899057729 | s345338353 | 30 | 24 | 9,152 | 9,100 | Accepted | Accepted | 20 | import sys
import itertools
X = int(eval(input()))
N = 300
ABs = []
for i in range(N):
ABs.append(i**5)
for i in range(N):
for j in range(N):
if ABs[i]-ABs[j] == X:
print((i,j))
sys.exit()
elif ABs[i]+ABs[j] == X:
print((i,-j))
... | import sys
import itertools
X = int(eval(input()))
N = 120
ABs = []
for i in range(N):
ABs.append(i**5)
for i in range(N):
for j in range(N):
if ABs[i]-ABs[j] == X:
print((i,j))
sys.exit()
elif ABs[i]+ABs[j] == X:
print((i,-j))
... | 16 | 16 | 320 | 320 | import sys
import itertools
X = int(eval(input()))
N = 300
ABs = []
for i in range(N):
ABs.append(i**5)
for i in range(N):
for j in range(N):
if ABs[i] - ABs[j] == X:
print((i, j))
sys.exit()
elif ABs[i] + ABs[j] == X:
print((i, -j))
sys.exit()
| import sys
import itertools
X = int(eval(input()))
N = 120
ABs = []
for i in range(N):
ABs.append(i**5)
for i in range(N):
for j in range(N):
if ABs[i] - ABs[j] == X:
print((i, j))
sys.exit()
elif ABs[i] + ABs[j] == X:
print((i, -j))
sys.exit()
| false | 0 | [
"-N = 300",
"+N = 120"
] | false | 0.042171 | 0.040021 | 1.05371 | [
"s899057729",
"s345338353"
] |
u316386814 | p04006 | python | s547873178 | s054847805 | 1,998 | 724 | 3,316 | 14,540 | Accepted | Accepted | 63.76 | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
A += A
INF = 10 ** 18
ans = INF
B = [INF] * N
for cnt in range(N):
for i in range(N):
B[i] = min(B[i], A[N + i - cnt])
ans = min(ans, cnt * x + sum(B))
print(ans) | import numpy as np
N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
A += A
A = np.array(A, int)
INF = 10 ** 18
ans = INF
B = np.ones(N, int) * INF
for cnt in range(N):
np.minimum(A[N-cnt:2*N-cnt], B, B)
ans = min(ans, cnt * x + np.sum(B))
print(ans) | 12 | 13 | 259 | 290 | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
A += A
INF = 10**18
ans = INF
B = [INF] * N
for cnt in range(N):
for i in range(N):
B[i] = min(B[i], A[N + i - cnt])
ans = min(ans, cnt * x + sum(B))
print(ans)
| import numpy as np
N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
A += A
A = np.array(A, int)
INF = 10**18
ans = INF
B = np.ones(N, int) * INF
for cnt in range(N):
np.minimum(A[N - cnt : 2 * N - cnt], B, B)
ans = min(ans, cnt * x + np.sum(B))
print(ans)
| false | 7.692308 | [
"+import numpy as np",
"+",
"+A = np.array(A, int)",
"-B = [INF] * N",
"+B = np.ones(N, int) * INF",
"- for i in range(N):",
"- B[i] = min(B[i], A[N + i - cnt])",
"- ans = min(ans, cnt * x + sum(B))",
"+ np.minimum(A[N - cnt : 2 * N - cnt], B, B)",
"+ ans = min(ans, cnt * x + np... | false | 0.071739 | 0.425068 | 0.16877 | [
"s547873178",
"s054847805"
] |
u214600613 | p01138 | python | s997286093 | s955808598 | 4,190 | 3,020 | 11,500 | 11,712 | Accepted | Accepted | 27.92 | m=24*60*60
while True:
n=int(eval(input()))
if n==0:break
dp=[0]*(m+1)
for _ in range(n):
a,d=input().split()
a,b,c=list(map(int,a.split(':')));
d,e,f=list(map(int,d.split(':')));
dp[a*3600+b*60+c]+=1
dp[d*3600+e*60+f]-=1
for i in range(m):
dp[i+1]+=dp[i]
print((max(dp))) | m=24*60*60
while True:
n=int(input())
if n==0:break
dp=[0]*(m+1)
for _ in range(n):
a,d=input().split()
a,b,c=list(map(int,a.split(':')));
d,e,f=list(map(int,d.split(':')));
dp[a*3600+b*60+c]+=1
dp[d*3600+e*60+f]-=1
for i in range(m):
dp[i+1]+=dp[i]
print((max(dp))) | 14 | 14 | 283 | 291 | m = 24 * 60 * 60
while True:
n = int(eval(input()))
if n == 0:
break
dp = [0] * (m + 1)
for _ in range(n):
a, d = input().split()
a, b, c = list(map(int, a.split(":")))
d, e, f = list(map(int, d.split(":")))
dp[a * 3600 + b * 60 + c] += 1
dp[d * 3600 + e *... | m = 24 * 60 * 60
while True:
n = int(input())
if n == 0:
break
dp = [0] * (m + 1)
for _ in range(n):
a, d = input().split()
a, b, c = list(map(int, a.split(":")))
d, e, f = list(map(int, d.split(":")))
dp[a * 3600 + b * 60 + c] += 1
dp[d * 3600 + e * 60 + ... | false | 0 | [
"- n = int(eval(input()))",
"+ n = int(input())"
] | false | 0.257326 | 0.241969 | 1.063465 | [
"s997286093",
"s955808598"
] |
u137962336 | p02681 | python | s219188621 | s170968314 | 24 | 21 | 8,812 | 8,808 | Accepted | Accepted | 12.5 | s = eval(input())
t = eval(input())
if t[:-1] == s:
print("Yes")
else:
print("No")
| s = eval(input())
t = eval(input())
if s == t[:-1]:
print("Yes")
else:
print("No")
| 6 | 6 | 84 | 85 | s = eval(input())
t = eval(input())
if t[:-1] == s:
print("Yes")
else:
print("No")
| s = eval(input())
t = eval(input())
if s == t[:-1]:
print("Yes")
else:
print("No")
| false | 0 | [
"-if t[:-1] == s:",
"+if s == t[:-1]:"
] | false | 0.042712 | 0.04685 | 0.911672 | [
"s219188621",
"s170968314"
] |
u277312083 | p03478 | python | s813412936 | s694177694 | 37 | 27 | 3,060 | 3,060 | Accepted | Accepted | 27.03 | n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
s = sum(list(map(int, list(str(i)))))
if a <= s and s <= b:
ans += i
print(ans)
| n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
j = i
d = 0
while j != 0:
d += j % 10
j //= 10
if a <= d and d <= b:
ans += i
print(ans) | 7 | 11 | 172 | 208 | n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
s = sum(list(map(int, list(str(i)))))
if a <= s and s <= b:
ans += i
print(ans)
| n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
j = i
d = 0
while j != 0:
d += j % 10
j //= 10
if a <= d and d <= b:
ans += i
print(ans)
| false | 36.363636 | [
"- s = sum(list(map(int, list(str(i)))))",
"- if a <= s and s <= b:",
"+ j = i",
"+ d = 0",
"+ while j != 0:",
"+ d += j % 10",
"+ j //= 10",
"+ if a <= d and d <= b:"
] | false | 0.035912 | 0.035841 | 1.001961 | [
"s813412936",
"s694177694"
] |
u857673087 | p03292 | python | s644412522 | s488431342 | 23 | 17 | 3,316 | 2,940 | Accepted | Accepted | 26.09 | a,b,c = sorted(map(int,input().split()))
print(( c - a)) | A = list(map(int, input().split()))
print((max(A)-min(A))) | 3 | 2 | 57 | 57 | a, b, c = sorted(map(int, input().split()))
print((c - a))
| A = list(map(int, input().split()))
print((max(A) - min(A)))
| false | 33.333333 | [
"-a, b, c = sorted(map(int, input().split()))",
"-print((c - a))",
"+A = list(map(int, input().split()))",
"+print((max(A) - min(A)))"
] | false | 0.075303 | 0.043901 | 1.715287 | [
"s644412522",
"s488431342"
] |
u994988729 | p03987 | python | s643561298 | s858153842 | 606 | 332 | 100,860 | 46,492 | Accepted | Accepted | 45.21 | class BinaryIndexTree: # 1-indexed
def __init__(self, N):
"""
INPUT
N [int] -> 全部0で初期化
N [list] -> そのまま初期化
"""
if isinstance(N, int):
self.N = N
self.depth = N.bit_length()
self.tree = [0] * (N + 1)
self.elem... | N = int(eval(input()))
A = list(map(int, input().split()))
a_to_i = {a: i for i, a in enumerate(A, start=1)}
L = [i - 1 for i in range(N + 2)]
R = [i + 1 for i in range(N + 2)]
ans = 0
for a in range(N, 0, -1):
i = a_to_i[a]
ans += a * (R[i] - i) * (i - L[i])
L[R[i]] = L[i]
R[L[i]] = R[i]
... | 68 | 15 | 1,822 | 327 | class BinaryIndexTree: # 1-indexed
def __init__(self, N):
"""
INPUT
N [int] -> 全部0で初期化
N [list] -> そのまま初期化
"""
if isinstance(N, int):
self.N = N
self.depth = N.bit_length()
self.tree = [0] * (N + 1)
self.elem = [0] * (N... | N = int(eval(input()))
A = list(map(int, input().split()))
a_to_i = {a: i for i, a in enumerate(A, start=1)}
L = [i - 1 for i in range(N + 2)]
R = [i + 1 for i in range(N + 2)]
ans = 0
for a in range(N, 0, -1):
i = a_to_i[a]
ans += a * (R[i] - i) * (i - L[i])
L[R[i]] = L[i]
R[L[i]] = R[i]
print(ans)
| false | 77.941176 | [
"-class BinaryIndexTree: # 1-indexed",
"- def __init__(self, N):",
"- \"\"\"",
"- INPUT",
"- N [int] -> 全部0で初期化",
"- N [list] -> そのまま初期化",
"- \"\"\"",
"- if isinstance(N, int):",
"- self.N = N",
"- self.depth = N.bit_length()",
... | false | 0.036763 | 0.035784 | 1.027361 | [
"s643561298",
"s858153842"
] |
u059727354 | p02669 | python | s553237051 | s666736043 | 1,478 | 476 | 145,716 | 90,240 | Accepted | Accepted | 67.79 | import sys
divs = [2, 3, 5]
t = int(eval(input()))
for _ in range(t):
n, a, b, c, d = list(map(int, input().split()))
costs = [a, b, c]
dp = {}
def dfs(x):
if x in dp:
return dp[x]
# print(x, file=sys.stderr)
if x == 0:
dp[x] = 0
... | divs = [2, 3, 5]
t = int(eval(input()))
for _ in range(t):
n, a, b, c, d = list(map(int, input().split()))
costs = [a, b, c]
dp = {0: 0}
def dfs(x):
if x in dp:
return dp[x]
ret = x * d
for cost, div in zip(costs, divs):
lx = x // di... | 38 | 31 | 739 | 652 | import sys
divs = [2, 3, 5]
t = int(eval(input()))
for _ in range(t):
n, a, b, c, d = list(map(int, input().split()))
costs = [a, b, c]
dp = {}
def dfs(x):
if x in dp:
return dp[x]
# print(x, file=sys.stderr)
if x == 0:
dp[x] = 0
return dp[x]... | divs = [2, 3, 5]
t = int(eval(input()))
for _ in range(t):
n, a, b, c, d = list(map(int, input().split()))
costs = [a, b, c]
dp = {0: 0}
def dfs(x):
if x in dp:
return dp[x]
ret = x * d
for cost, div in zip(costs, divs):
lx = x // div * div
re... | false | 18.421053 | [
"-import sys",
"-",
"- dp = {}",
"+ dp = {0: 0}",
"- # print(x, file=sys.stderr)",
"- if x == 0:",
"- dp[x] = 0",
"- return dp[x]",
"- for i in range(-4, 5):",
"- if x - i < 0:",
"+ for cost, div in zip(costs, divs):",
"+ ... | false | 2.339346 | 0.167254 | 13.986762 | [
"s553237051",
"s666736043"
] |
u514390882 | p02787 | python | s615178890 | s632855703 | 487 | 377 | 42,220 | 43,108 | Accepted | Accepted | 22.59 | h, n = list(map(int, input().split()))
ab = []
for i in range(n):
ab.append(list(map(int, input().split())))
###一次元DP
dp = [100000000] * (h+1)
dp[0] = 0
for i in range(1, h+1):
for j in range(n):
a = ab[j][0]
b = ab[j][1]
# print(i, j)
temp = i - a
if temp < ... | h, n = list(map(int, input().split()))
dp = [1000000000] * (h+1)
dp[0] = 0
for i in range(n):
a, b = list(map(int, input().split()))
for j in range(h):
# nj = min(j + a, h)
if j + a < h: nj = j + a
else: nj = h
# dp[nj] = min(dp[nj], dp[j] + b)
if dp[nj] > dp[j]... | 21 | 13 | 536 | 360 | h, n = list(map(int, input().split()))
ab = []
for i in range(n):
ab.append(list(map(int, input().split())))
###一次元DP
dp = [100000000] * (h + 1)
dp[0] = 0
for i in range(1, h + 1):
for j in range(n):
a = ab[j][0]
b = ab[j][1]
# print(i, j)
temp = i - a
if temp < 0:
... | h, n = list(map(int, input().split()))
dp = [1000000000] * (h + 1)
dp[0] = 0
for i in range(n):
a, b = list(map(int, input().split()))
for j in range(h):
# nj = min(j + a, h)
if j + a < h:
nj = j + a
else:
nj = h
# dp[nj] = min(dp[nj], dp[j] + b)
i... | false | 38.095238 | [
"-ab = []",
"+dp = [1000000000] * (h + 1)",
"+dp[0] = 0",
"- ab.append(list(map(int, input().split())))",
"-###一次元DP",
"-dp = [100000000] * (h + 1)",
"-dp[0] = 0",
"-for i in range(1, h + 1):",
"- for j in range(n):",
"- a = ab[j][0]",
"- b = ab[j][1]",
"- # print(i,... | false | 0.127063 | 0.095201 | 1.334685 | [
"s615178890",
"s632855703"
] |
u370331385 | p02842 | python | s535746489 | s221750366 | 45 | 32 | 3,060 | 2,940 | Accepted | Accepted | 28.89 | N=int(eval(input()))
ans = -1
for i in range(50000+10):
x1 = int(i*1.08)
x2 = i*1.08
#print(i,x1,x2)
if(x1 == N): ans = i
elif(x2 == N): ans = i
if(ans == -1):
print(':(')
else:
print(ans) | N = int(eval(input()))
ans = -1
for x in range(N+1):
if(int(x*1.08) == N):
ans = x
break
if(ans == -1): print(':(')
else: print(ans)
| 15 | 10 | 210 | 152 | N = int(eval(input()))
ans = -1
for i in range(50000 + 10):
x1 = int(i * 1.08)
x2 = i * 1.08
# print(i,x1,x2)
if x1 == N:
ans = i
elif x2 == N:
ans = i
if ans == -1:
print(":(")
else:
print(ans)
| N = int(eval(input()))
ans = -1
for x in range(N + 1):
if int(x * 1.08) == N:
ans = x
break
if ans == -1:
print(":(")
else:
print(ans)
| false | 33.333333 | [
"-for i in range(50000 + 10):",
"- x1 = int(i * 1.08)",
"- x2 = i * 1.08",
"- # print(i,x1,x2)",
"- if x1 == N:",
"- ans = i",
"- elif x2 == N:",
"- ans = i",
"+for x in range(N + 1):",
"+ if int(x * 1.08) == N:",
"+ ans = x",
"+ break"
] | false | 0.109843 | 0.039221 | 2.800584 | [
"s535746489",
"s221750366"
] |
u644907318 | p03347 | python | s893540939 | s096466336 | 796 | 262 | 57,304 | 87,680 | Accepted | Accepted | 67.09 | N = int(eval(input()))
cnt = 0
A = [int(eval(input())) for _ in range(N)]
if A[0]!=0:
cnt = -1
else:
for i in range(1,N):
if A[i]==A[i-1]+1:
continue
elif A[i]<=A[i-1]:
cnt += A[i-1]
else:
cnt = -1
break
if cnt>=0:
... | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
cnt = A[-1]
flag = 0
for i in range(N-2,-1,-1):
if A[i]==A[i+1] or A[i]>A[i+1]:
cnt += A[i]
elif A[i] == A[i+1]-1:
continue
else:
flag = 1
break
if A[0]!=0:
flag = 1
if flag==0:
print(cnt... | 17 | 18 | 337 | 331 | N = int(eval(input()))
cnt = 0
A = [int(eval(input())) for _ in range(N)]
if A[0] != 0:
cnt = -1
else:
for i in range(1, N):
if A[i] == A[i - 1] + 1:
continue
elif A[i] <= A[i - 1]:
cnt += A[i - 1]
else:
cnt = -1
break
if cnt >= 0:
... | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
cnt = A[-1]
flag = 0
for i in range(N - 2, -1, -1):
if A[i] == A[i + 1] or A[i] > A[i + 1]:
cnt += A[i]
elif A[i] == A[i + 1] - 1:
continue
else:
flag = 1
break
if A[0] != 0:
flag = 1
if flag == 0:
prin... | false | 5.555556 | [
"-cnt = 0",
"+cnt = A[-1]",
"+flag = 0",
"+for i in range(N - 2, -1, -1):",
"+ if A[i] == A[i + 1] or A[i] > A[i + 1]:",
"+ cnt += A[i]",
"+ elif A[i] == A[i + 1] - 1:",
"+ continue",
"+ else:",
"+ flag = 1",
"+ break",
"- cnt = -1",
"+ flag = 1",
... | false | 0.037017 | 0.036872 | 1.003935 | [
"s893540939",
"s096466336"
] |
u156815136 | p03599 | python | s117586436 | s359014542 | 332 | 203 | 39,652 | 40,176 | Accepted | Accepted | 38.86 | #
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
r_ = n / m
if (r_ - (n // m)) > 0:
return (n//m) + 1
else:
return (n//m)"""
""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from itertools import combinations # (string,3) 3回
#from collections import deque
#import collections.defaultdict(list)
#import bisect
#
#
# pythonで無理なときは、pypyでやると正解するかも!!
#
... | 95 | 57 | 1,880 | 1,622 | #
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
# import math
# mod = 10**9+7
# import itertools
# import fractions
# import numpy as np
# mod = 10**4 + 7
"""def kiri(n,m):
r_ = n / m
if (r_ - (n // m)) > 0:
return (n//m) + 1
else:
return (n//m)"""
""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
# from itertools import combinations # (string,3) 3回
# from collections import deque
# import collections.defaultdict(list)
# import bisect
#
#
# pythonで無理なときは、pypyでやると正解するかも!!
#
#
mo... | false | 40 | [
"+# from statistics import median",
"+# import collections",
"+# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]",
"+# from itertools import combinations # (string,3) 3回",
"+# from collections import deque",
"+# import collections.defaultdict(list)",
"+# import bisect",... | false | 0.127315 | 2.287112 | 0.055666 | [
"s117586436",
"s359014542"
] |
u440180827 | p02409 | python | s199600179 | s453619629 | 30 | 20 | 7,720 | 7,636 | Accepted | Accepted | 33.33 | rooms = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for i in range(n):
b, f, r, v= map(int, input().split())
rooms[b-1][f-1][r-1] += v
for i in range(4):
for j in range(3):
for k in range(10):
print('', rooms[i][j][k], end='')
print()
... | rooms = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for i in range(n):
b, f, r, v= map(int, input().split())
rooms[b-1][f-1][r-1] += v
for i in range(4):
for j in range(3):
for k in range(10):
print('', rooms[i][j][k], end='')
print()
... | 12 | 12 | 373 | 359 | rooms = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for i in range(n):
b, f, r, v = map(int, input().split())
rooms[b - 1][f - 1][r - 1] += v
for i in range(4):
for j in range(3):
for k in range(10):
print("", rooms[i][j][k], end="")
print()
... | rooms = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for i in range(n):
b, f, r, v = map(int, input().split())
rooms[b - 1][f - 1][r - 1] += v
for i in range(4):
for j in range(3):
for k in range(10):
print("", rooms[i][j][k], end="")
print()
... | false | 0 | [
"- print(\"####################\")",
"+ print(\"#\" * 20)"
] | false | 0.042242 | 0.058111 | 0.726914 | [
"s199600179",
"s453619629"
] |
u241159583 | p03037 | python | s363500422 | s639726552 | 332 | 297 | 11,020 | 10,996 | Accepted | Accepted | 10.54 | N, M = [int(x) for x in input().split()]
L = []
R = []
for _ in range(M):
l, r = [int(x) for x in input().split()]
L.append(l)
R.append(r)
ans = min(R) - max(L) + 1
print((ans if ans >= 0 else 0)) | N, M = list(map(int, input().split()))
L = []
R = []
for _ in range(M):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
l = max(L)
r = min(R)
print((r-l+1 if r-l+1 > 0 else 0)) | 10 | 11 | 210 | 194 | N, M = [int(x) for x in input().split()]
L = []
R = []
for _ in range(M):
l, r = [int(x) for x in input().split()]
L.append(l)
R.append(r)
ans = min(R) - max(L) + 1
print((ans if ans >= 0 else 0))
| N, M = list(map(int, input().split()))
L = []
R = []
for _ in range(M):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
l = max(L)
r = min(R)
print((r - l + 1 if r - l + 1 > 0 else 0))
| false | 9.090909 | [
"-N, M = [int(x) for x in input().split()]",
"+N, M = list(map(int, input().split()))",
"- l, r = [int(x) for x in input().split()]",
"+ l, r = list(map(int, input().split()))",
"-ans = min(R) - max(L) + 1",
"-print((ans if ans >= 0 else 0))",
"+l = max(L)",
"+r = min(R)",
"+print((r - l + 1 i... | false | 0.041221 | 0.04239 | 0.97242 | [
"s363500422",
"s639726552"
] |
u847467233 | p02269 | python | s294153692 | s380978253 | 4,550 | 1,040 | 33,112 | 33,716 | Accepted | Accepted | 77.14 | # AOJ ALDS1_4_C Dictionary
# Python3 2018.7.3 bal4u
dic = {}
n = int(eval(input()))
for i in range(n):
id, s = input().split()
if id == "insert": dic[s] = 1
else: print(("yes" if s in dic else "no"))
| # AOJ ALDS1_4_C Dictionary
# Python3 2018.7.3 bal4u
import sys
from sys import stdin
input = stdin.readline
dic = {}
n = int(eval(input()))
for i in range(n):
s = eval(input())
if s[0] == 'i': dic[s[7:]] = 1
else: print(("yes" if s[5:] in dic else "no"))
| 9 | 13 | 204 | 258 | # AOJ ALDS1_4_C Dictionary
# Python3 2018.7.3 bal4u
dic = {}
n = int(eval(input()))
for i in range(n):
id, s = input().split()
if id == "insert":
dic[s] = 1
else:
print(("yes" if s in dic else "no"))
| # AOJ ALDS1_4_C Dictionary
# Python3 2018.7.3 bal4u
import sys
from sys import stdin
input = stdin.readline
dic = {}
n = int(eval(input()))
for i in range(n):
s = eval(input())
if s[0] == "i":
dic[s[7:]] = 1
else:
print(("yes" if s[5:] in dic else "no"))
| false | 30.769231 | [
"+import sys",
"+from sys import stdin",
"+",
"+input = stdin.readline",
"- id, s = input().split()",
"- if id == \"insert\":",
"- dic[s] = 1",
"+ s = eval(input())",
"+ if s[0] == \"i\":",
"+ dic[s[7:]] = 1",
"- print((\"yes\" if s in dic else \"no\"))",
"+ ... | false | 0.038044 | 0.041885 | 0.908305 | [
"s294153692",
"s380978253"
] |
u729133443 | p02820 | python | s396071339 | s686480112 | 186 | 47 | 44,004 | 3,956 | Accepted | Accepted | 74.73 | *n,t=open(0).read().split()
n,k,r,s,p=list(map(int,n))
d={'r':p,'s':r,'p':s}
b=['']*n*2
a=0
for i,c in enumerate(t[:n]):
if c!=b[i-k]:
b[i]=c
a+=d[c]
print(a) | *n,t=open(0).read().split()
n,k,r,s,p=list(map(int,n))
*t,=t
for i in range(n-k):
if t[i+k]==t[i]:t[i+k]=5
a,b,c=list(map(t.count,'rsp'))
print((a*p+b*r+c*s)) | 10 | 7 | 171 | 152 | *n, t = open(0).read().split()
n, k, r, s, p = list(map(int, n))
d = {"r": p, "s": r, "p": s}
b = [""] * n * 2
a = 0
for i, c in enumerate(t[:n]):
if c != b[i - k]:
b[i] = c
a += d[c]
print(a)
| *n, t = open(0).read().split()
n, k, r, s, p = list(map(int, n))
(*t,) = t
for i in range(n - k):
if t[i + k] == t[i]:
t[i + k] = 5
a, b, c = list(map(t.count, "rsp"))
print((a * p + b * r + c * s))
| false | 30 | [
"-d = {\"r\": p, \"s\": r, \"p\": s}",
"-b = [\"\"] * n * 2",
"-a = 0",
"-for i, c in enumerate(t[:n]):",
"- if c != b[i - k]:",
"- b[i] = c",
"- a += d[c]",
"-print(a)",
"+(*t,) = t",
"+for i in range(n - k):",
"+ if t[i + k] == t[i]:",
"+ t[i + k] = 5",
"+a, b, c... | false | 0.053104 | 0.132943 | 0.399451 | [
"s396071339",
"s686480112"
] |
u620259318 | p02594 | python | s048749571 | s484445775 | 30 | 26 | 8,952 | 9,160 | Accepted | Accepted | 13.33 | deg = int(eval(input()))
if deg >= 30:
print("Yes")
else:
print("No")
| n = int(eval(input()))
if n < 30:
print("No")
else:
print("Yes") | 6 | 6 | 78 | 72 | deg = int(eval(input()))
if deg >= 30:
print("Yes")
else:
print("No")
| n = int(eval(input()))
if n < 30:
print("No")
else:
print("Yes")
| false | 0 | [
"-deg = int(eval(input()))",
"-if deg >= 30:",
"+n = int(eval(input()))",
"+if n < 30:",
"+ print(\"No\")",
"+else:",
"-else:",
"- print(\"No\")"
] | false | 0.033867 | 0.040165 | 0.84321 | [
"s048749571",
"s484445775"
] |
u576432509 | p03353 | python | s821591478 | s834702014 | 48 | 39 | 3,060 | 4,464 | Accepted | Accepted | 18.75 | s=eval(input())
k=int(eval(input()))
#s=list(input())
#t=[]
#for kk in range(k):
# t.append(s)
t=["zzzzz"]*k
for i in range(len(s)):
for j in range(i,min(len(s),i+k)):
sij=s[i:j+1]
for kk in range(k):
if t[kk]==sij:
break
if t[kk]>sij:
... | s=eval(input())
k=int(eval(input()))
sb=set()
for i in range(len(s)):
for ii in range(i,i+k):
if ii<len(s):
# print(s[i:ii+1])
sb.add(s[i:ii+1])
sb2=list(sb)
sb2.sort()
print((sb2[k-1]))
| 23 | 12 | 392 | 232 | s = eval(input())
k = int(eval(input()))
# s=list(input())
# t=[]
# for kk in range(k):
# t.append(s)
t = ["zzzzz"] * k
for i in range(len(s)):
for j in range(i, min(len(s), i + k)):
sij = s[i : j + 1]
for kk in range(k):
if t[kk] == sij:
break
if t[kk] > sij:
... | s = eval(input())
k = int(eval(input()))
sb = set()
for i in range(len(s)):
for ii in range(i, i + k):
if ii < len(s):
# print(s[i:ii+1])
sb.add(s[i : ii + 1])
sb2 = list(sb)
sb2.sort()
print((sb2[k - 1]))
| false | 47.826087 | [
"-# s=list(input())",
"-# t=[]",
"-# for kk in range(k):",
"-# t.append(s)",
"-t = [\"zzzzz\"] * k",
"+sb = set()",
"- for j in range(i, min(len(s), i + k)):",
"- sij = s[i : j + 1]",
"- for kk in range(k):",
"- if t[kk] == sij:",
"- break",
"- ... | false | 0.034716 | 0.037864 | 0.916862 | [
"s821591478",
"s834702014"
] |
u204842730 | p02695 | python | s145556041 | s535866120 | 1,248 | 1,078 | 9,136 | 9,168 | Accepted | Accepted | 13.62 | import itertools
n,m,q=list(map(int,input().split()))
lis=[]
ans=0
for _ in range(q):
a,b,c,d = list(map(int, input().split()))
lis.append([a-1,b-1,c,d])
for i in itertools.combinations_with_replacement(list(range(1,m+1)),n):
tmp=0
for j in range(q):
if i[lis[j][1]] - i[lis[j][0]] ... | import itertools
n,m,q=list(map(int,input().split()))
a=[0 for i in range(q)]
b=[0 for i in range(q)]
c=[0 for i in range(q)]
d=[0 for i in range(q)]
for i in range(q):
a[i],b[i],c[i],d[i]=list(map(int,input().split()))
a[i]-=1
b[i]-=1
ans=0
for i in itertools.combinations_with_replacement(list... | 16 | 19 | 377 | 451 | import itertools
n, m, q = list(map(int, input().split()))
lis = []
ans = 0
for _ in range(q):
a, b, c, d = list(map(int, input().split()))
lis.append([a - 1, b - 1, c, d])
for i in itertools.combinations_with_replacement(list(range(1, m + 1)), n):
tmp = 0
for j in range(q):
if i[lis[j][1]] - i... | import itertools
n, m, q = list(map(int, input().split()))
a = [0 for i in range(q)]
b = [0 for i in range(q)]
c = [0 for i in range(q)]
d = [0 for i in range(q)]
for i in range(q):
a[i], b[i], c[i], d[i] = list(map(int, input().split()))
a[i] -= 1
b[i] -= 1
ans = 0
for i in itertools.combinations_with_rep... | false | 15.789474 | [
"-lis = []",
"+a = [0 for i in range(q)]",
"+b = [0 for i in range(q)]",
"+c = [0 for i in range(q)]",
"+d = [0 for i in range(q)]",
"+for i in range(q):",
"+ a[i], b[i], c[i], d[i] = list(map(int, input().split()))",
"+ a[i] -= 1",
"+ b[i] -= 1",
"-for _ in range(q):",
"- a, b, c, d... | false | 0.068176 | 0.059296 | 1.149766 | [
"s145556041",
"s535866120"
] |
u936985471 | p02792 | python | s650046256 | s923145262 | 219 | 172 | 3,444 | 3,316 | Accepted | Accepted | 21.46 | N=int(eval(input()))
from collections import defaultdict
dic=defaultdict(int)
for i in range(1,N+1):
n=str(i)
dic[(int(n[0]),int(n[-1]))]+=1
ans=0
for i in range(1,10):
for j in range(1,10):
ans+=dic[(i,j)]*dic[(j,i)]
print(ans) | from collections import defaultdict as d
dic=d(int)
for i in range(1,int(eval(input()))+1):
dic[(int(str(i)[0]),i%10)]+=1
ans=0
for i in range(10):
for j in range(10):
ans+=dic[(i,j)]*dic[(j,i)]
print(ans) | 14 | 9 | 254 | 215 | N = int(eval(input()))
from collections import defaultdict
dic = defaultdict(int)
for i in range(1, N + 1):
n = str(i)
dic[(int(n[0]), int(n[-1]))] += 1
ans = 0
for i in range(1, 10):
for j in range(1, 10):
ans += dic[(i, j)] * dic[(j, i)]
print(ans)
| from collections import defaultdict as d
dic = d(int)
for i in range(1, int(eval(input())) + 1):
dic[(int(str(i)[0]), i % 10)] += 1
ans = 0
for i in range(10):
for j in range(10):
ans += dic[(i, j)] * dic[(j, i)]
print(ans)
| false | 35.714286 | [
"-N = int(eval(input()))",
"-from collections import defaultdict",
"+from collections import defaultdict as d",
"-dic = defaultdict(int)",
"-for i in range(1, N + 1):",
"- n = str(i)",
"- dic[(int(n[0]), int(n[-1]))] += 1",
"+dic = d(int)",
"+for i in range(1, int(eval(input())) + 1):",
"+ ... | false | 0.216078 | 0.070873 | 3.048818 | [
"s650046256",
"s923145262"
] |
u340781749 | p03246 | python | s382678019 | s406852386 | 113 | 76 | 21,568 | 18,656 | Accepted | Accepted | 32.74 | from collections import Counter
from itertools import takewhile
n = int(eval(input()))
vvv = list(map(int, input().split()))
cnt1 = Counter(vvv[0::2])
cnt2 = Counter(vvv[1::2])
mc1 = cnt1.most_common()
mc2 = cnt2.most_common()
mcs1 = list(takewhile(lambda x: x[1] == mc1[0][1], mc1))
mcs2 = list(takewhile(lam... | from collections import Counter
n = int(eval(input()))
vvv = list(map(int, input().split()))
cnt1 = Counter(vvv[0::2])
cnt2 = Counter(vvv[1::2])
mc1 = cnt1.most_common(2)
mc2 = cnt2.most_common(2)
if mc1[0][0] == mc2[0][0]:
sc1 = mc1[1][1] if len(mc1) > 1 else 0
sc2 = mc2[1][1] if len(mc2) > 1 else 0... | 24 | 14 | 827 | 418 | from collections import Counter
from itertools import takewhile
n = int(eval(input()))
vvv = list(map(int, input().split()))
cnt1 = Counter(vvv[0::2])
cnt2 = Counter(vvv[1::2])
mc1 = cnt1.most_common()
mc2 = cnt2.most_common()
mcs1 = list(takewhile(lambda x: x[1] == mc1[0][1], mc1))
mcs2 = list(takewhile(lambda x: x[1... | from collections import Counter
n = int(eval(input()))
vvv = list(map(int, input().split()))
cnt1 = Counter(vvv[0::2])
cnt2 = Counter(vvv[1::2])
mc1 = cnt1.most_common(2)
mc2 = cnt2.most_common(2)
if mc1[0][0] == mc2[0][0]:
sc1 = mc1[1][1] if len(mc1) > 1 else 0
sc2 = mc2[1][1] if len(mc2) > 1 else 0
print... | false | 41.666667 | [
"-from itertools import takewhile",
"-mc1 = cnt1.most_common()",
"-mc2 = cnt2.most_common()",
"-mcs1 = list(takewhile(lambda x: x[1] == mc1[0][1], mc1))",
"-mcs2 = list(takewhile(lambda x: x[1] == mc2[0][1], mc2))",
"-if len(mcs1) == len(mcs2) and mcs1[0][0] == mcs2[0][0]:",
"- if len(mc1) > 1:",
"... | false | 0.069069 | 0.100079 | 0.690142 | [
"s382678019",
"s406852386"
] |
u627803856 | p02720 | python | s106360108 | s686459592 | 347 | 223 | 61,776 | 65,008 | Accepted | Accepted | 35.73 | k = int(eval(input()))
def dfs(d, val, A):
A.append(val)
if d == 10:
return
for i in range(-1, 2):
add = (val % 10) + i
if add >= 0 and add <= 9:
dfs(d + 1, val * 10 + add, A)
A = []
for v in range(1, 10): # 呼び出し
dfs(1, v, A)
A.sort()
print((A[k - 1])) |
def calc_next(arr):
res = []
for val in arr:
for j in range(-1, 2):
add = (val % 10) + j
if add >= 0 and add <= 9:
res.append(val * 10 + add)
return res
k = int(eval(input()))
cur = []
A = []
for v in range(1, 10):
cur.append(v)
A.append(v)
for d in range(1, 10):
cur = calc_next... | 18 | 24 | 278 | 373 | k = int(eval(input()))
def dfs(d, val, A):
A.append(val)
if d == 10:
return
for i in range(-1, 2):
add = (val % 10) + i
if add >= 0 and add <= 9:
dfs(d + 1, val * 10 + add, A)
A = []
for v in range(1, 10): # 呼び出し
dfs(1, v, A)
A.sort()
print((A[k - 1]))
| def calc_next(arr):
res = []
for val in arr:
for j in range(-1, 2):
add = (val % 10) + j
if add >= 0 and add <= 9:
res.append(val * 10 + add)
return res
k = int(eval(input()))
cur = []
A = []
for v in range(1, 10):
cur.append(v)
A.append(v)
for d in ... | false | 25 | [
"-k = int(eval(input()))",
"+def calc_next(arr):",
"+ res = []",
"+ for val in arr:",
"+ for j in range(-1, 2):",
"+ add = (val % 10) + j",
"+ if add >= 0 and add <= 9:",
"+ res.append(val * 10 + add)",
"+ return res",
"-def dfs(d, val, A):",
... | false | 0.24427 | 0.141525 | 1.725982 | [
"s106360108",
"s686459592"
] |
u634046173 | p03774 | python | s143463593 | s602083210 | 73 | 66 | 67,804 | 66,220 | Accepted | Accepted | 9.59 | N,M = list(map(int,input().split()))
students = [list(map(int,input().split()))for i in range(N)]
checkPoints = [list(map(int,input().split()))for i in range(M)]
for i in range(N):
idx = -1
mindis = 3*10**8
sx,sy = students[i]
for j in range(M):
cx,cy = checkPoints[j]
distance... | N,M = list(map(int,input().split()))
students = [list(map(int,input().split()))for i in range(N)]
checkPoints = [list(map(int,input().split()))for i in range(M)]
for i in range(N):
idx = 1
mindis = abs(students[i][0]-checkPoints[0][0])+ abs(students[i][1]-checkPoints[0][1])
sx,sy = students[i]
... | 16 | 16 | 443 | 513 | N, M = list(map(int, input().split()))
students = [list(map(int, input().split())) for i in range(N)]
checkPoints = [list(map(int, input().split())) for i in range(M)]
for i in range(N):
idx = -1
mindis = 3 * 10**8
sx, sy = students[i]
for j in range(M):
cx, cy = checkPoints[j]
distance ... | N, M = list(map(int, input().split()))
students = [list(map(int, input().split())) for i in range(N)]
checkPoints = [list(map(int, input().split())) for i in range(M)]
for i in range(N):
idx = 1
mindis = abs(students[i][0] - checkPoints[0][0]) + abs(
students[i][1] - checkPoints[0][1]
)
sx, sy =... | false | 0 | [
"- idx = -1",
"- mindis = 3 * 10**8",
"+ idx = 1",
"+ mindis = abs(students[i][0] - checkPoints[0][0]) + abs(",
"+ students[i][1] - checkPoints[0][1]",
"+ )",
"- for j in range(M):",
"+ for j in range(1, M):"
] | false | 0.045143 | 0.040727 | 1.108447 | [
"s143463593",
"s602083210"
] |
u357751375 | p02954 | python | s940791530 | s182576767 | 155 | 101 | 25,552 | 17,816 | Accepted | Accepted | 34.84 | s = eval(input())
ans = [0] * len(s)
x = 0
y = 'R'
z = []
for i in s:
if y == i:
x += 1
else:
z.append([y,x])
x = 1
y = i
z.append([y,x])
ans = [0] * len(s)
i = 0
j = 0
while i < len(z):
x = z[i][1]
if z[i][0] == 'R':
j += x-1
if x % 2 ... | s = eval(input())
x = 0
y = 'R'
rle = []
for c in s:
if y == c:
x += 1
else:
rle.append(x)
x = 1
y = c
rle.append(x)
ans = [0] * len(s)
i = 0
y = 'R'
for c in rle:
if y == 'R':
j = i + c - 1
if c % 2 == 0:
ans[j] += c // 2
... | 36 | 34 | 674 | 623 | s = eval(input())
ans = [0] * len(s)
x = 0
y = "R"
z = []
for i in s:
if y == i:
x += 1
else:
z.append([y, x])
x = 1
y = i
z.append([y, x])
ans = [0] * len(s)
i = 0
j = 0
while i < len(z):
x = z[i][1]
if z[i][0] == "R":
j += x - 1
if x % 2 == 0:
... | s = eval(input())
x = 0
y = "R"
rle = []
for c in s:
if y == c:
x += 1
else:
rle.append(x)
x = 1
y = c
rle.append(x)
ans = [0] * len(s)
i = 0
y = "R"
for c in rle:
if y == "R":
j = i + c - 1
if c % 2 == 0:
ans[j] += c // 2
else:
... | false | 5.555556 | [
"-ans = [0] * len(s)",
"-z = []",
"-for i in s:",
"- if y == i:",
"+rle = []",
"+for c in s:",
"+ if y == c:",
"- z.append([y, x])",
"+ rle.append(x)",
"- y = i",
"-z.append([y, x])",
"+ y = c",
"+rle.append(x)",
"-j = 0",
"-while i < len(z):",
"- x... | false | 0.03764 | 0.053134 | 0.7084 | [
"s940791530",
"s182576767"
] |
u729133443 | p04006 | python | s406843273 | s925898463 | 895 | 818 | 35,228 | 3,188 | Accepted | Accepted | 8.6 | n,x,*a=list(map(int,open(0).read().split()));i,m=0,1e18;exec('m=min(m,sum(a)+x*i);i+=1;a=[min(t)for t in zip(a,a[-1:]+a)];'*n);print(m) | n,x,*a=list(map(int,open(0).read().split()))
m=1e18
for i in range(n):m=min(m,sum(a)+x*i);a=[min(t)for t in zip(a,a[-1:]+a)]
print(m) | 1 | 4 | 129 | 130 | n, x, *a = list(map(int, open(0).read().split()))
i, m = 0, 1e18
exec("m=min(m,sum(a)+x*i);i+=1;a=[min(t)for t in zip(a,a[-1:]+a)];" * n)
print(m)
| n, x, *a = list(map(int, open(0).read().split()))
m = 1e18
for i in range(n):
m = min(m, sum(a) + x * i)
a = [min(t) for t in zip(a, a[-1:] + a)]
print(m)
| false | 75 | [
"-i, m = 0, 1e18",
"-exec(\"m=min(m,sum(a)+x*i);i+=1;a=[min(t)for t in zip(a,a[-1:]+a)];\" * n)",
"+m = 1e18",
"+for i in range(n):",
"+ m = min(m, sum(a) + x * i)",
"+ a = [min(t) for t in zip(a, a[-1:] + a)]"
] | false | 0.036044 | 0.073826 | 0.488224 | [
"s406843273",
"s925898463"
] |
u887207211 | p03212 | python | s410063945 | s994306394 | 93 | 45 | 3,064 | 5,156 | Accepted | Accepted | 51.61 | N = int(eval(input()))
def abc114_c(s):
if(int(s) > N):
return 0
if(all(s.count(c) > 0 for c in "753")):
ans = 1
else:
ans = 0
for c in "753":
ans += abc114_c(s+c)
return ans
print((abc114_c("0"))) | N = eval(input())
nums = ['3', '5', '7']
for i in range(len(N)):
for num in nums:
if(len(num) == i):
nums.append(num + '3')
nums.append(num + '5')
nums.append(num + '7')
cnt = 0
for num in nums:
if(int(num) <= int(N) and '3' in num and '5' in num and '7' in num):
cnt += 1
print... | 13 | 13 | 228 | 319 | N = int(eval(input()))
def abc114_c(s):
if int(s) > N:
return 0
if all(s.count(c) > 0 for c in "753"):
ans = 1
else:
ans = 0
for c in "753":
ans += abc114_c(s + c)
return ans
print((abc114_c("0")))
| N = eval(input())
nums = ["3", "5", "7"]
for i in range(len(N)):
for num in nums:
if len(num) == i:
nums.append(num + "3")
nums.append(num + "5")
nums.append(num + "7")
cnt = 0
for num in nums:
if int(num) <= int(N) and "3" in num and "5" in num and "7" in num:
... | false | 0 | [
"-N = int(eval(input()))",
"-",
"-",
"-def abc114_c(s):",
"- if int(s) > N:",
"- return 0",
"- if all(s.count(c) > 0 for c in \"753\"):",
"- ans = 1",
"- else:",
"- ans = 0",
"- for c in \"753\":",
"- ans += abc114_c(s + c)",
"- return ans",
"-",
... | false | 0.008088 | 0.076129 | 0.106239 | [
"s410063945",
"s994306394"
] |
u691018832 | p02693 | python | s831384385 | s771591069 | 61 | 22 | 61,612 | 9,168 | Accepted | Accepted | 63.93 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
k = int(readline())
a, b = list(map(int, readline().split()))
for i in range(a, b + 1):
if i % k == 0:
print('OK')
exit()
print('NG')
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
k, a, b = list(map(int, read().split()))
for i in range(a, b + 1):
if i % k == 0:
print('OK')
exit()
print('NG')
| 13 | 12 | 308 | 286 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
k = int(readline())
a, b = list(map(int, readline().split()))
for i in range(a, b + 1):
if i % k == 0:
print("OK")
exit()
print("NG")
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
k, a, b = list(map(int, read().split()))
for i in range(a, b + 1):
if i % k == 0:
print("OK")
exit()
print("NG")
| false | 7.692308 | [
"-k = int(readline())",
"-a, b = list(map(int, readline().split()))",
"+k, a, b = list(map(int, read().split()))"
] | false | 0.041175 | 0.036541 | 1.126819 | [
"s831384385",
"s771591069"
] |
u621935300 | p02918 | python | s815242265 | s834924341 | 72 | 56 | 52,956 | 36,892 | Accepted | Accepted | 22.22 | N,K=list(map(int, input().split()))
S=list(input())
L=[]
now=None
for i,s in enumerate(S):
if i==0:
now=s
cnt=1
elif now==s:
cnt+=1
elif now!=s:
L.append([now,cnt])
cnt=1
now=s
else:
L.append([now,cnt])
l=len(L)
for i in range(1,min(K*2,l),2):
s=L[i][0]
if s=="L": L[i][0]="... | # -*- coding: utf-8 -*-
import sys
N,K=list(map(int, sys.stdin.readline().split()))
S=sys.stdin.readline().strip()
L=[]
cnt=0
for i,x in enumerate(S):
if i==0:
cnt+=1
prev=x
else:
if prev==x: #前の文字と今の文字が同じ
cnt+=1
else: #前の文字と今の文字が異なる
L.... | 46 | 21 | 579 | 421 | N, K = list(map(int, input().split()))
S = list(input())
L = []
now = None
for i, s in enumerate(S):
if i == 0:
now = s
cnt = 1
elif now == s:
cnt += 1
elif now != s:
L.append([now, cnt])
cnt = 1
now = s
else:
L.append([now, cnt])
l = len(L)
for i in range... | # -*- coding: utf-8 -*-
import sys
N, K = list(map(int, sys.stdin.readline().split()))
S = sys.stdin.readline().strip()
L = []
cnt = 0
for i, x in enumerate(S):
if i == 0:
cnt += 1
prev = x
else:
if prev == x: # 前の文字と今の文字が同じ
cnt += 1
else: # 前の文字と今の文字が異なる
... | false | 54.347826 | [
"-N, K = list(map(int, input().split()))",
"-S = list(input())",
"+# -*- coding: utf-8 -*-",
"+import sys",
"+",
"+N, K = list(map(int, sys.stdin.readline().split()))",
"+S = sys.stdin.readline().strip()",
"-now = None",
"-for i, s in enumerate(S):",
"+cnt = 0",
"+for i, x in enumerate(S):",
"... | false | 0.035422 | 0.048375 | 0.732229 | [
"s815242265",
"s834924341"
] |
u644907318 | p03147 | python | s225813481 | s436486824 | 178 | 64 | 39,536 | 67,152 | Accepted | Accepted | 64.04 | N = int(eval(input()))
H = list(map(int,input().split()))
cnt = 0
while True:
flag = 0
for i in range(N):
if H[i]>0:
cur = i
flag = 1
break
if flag==0:break
cmin = H[cur]
flag = 1
for i in range(cur,N):
if H[i]>0 and flag==1:
... | N = int(eval(input()))
H = list(map(int,input().split()))
tot = 0
while True:
if H[0]>0:
cnt = 1
else:
cnt = 0
for i in range(1,N):
if H[i]>0 and H[i-1]==0:
cnt += 1
tot += cnt
for i in range(N):
if H[i]>0:
H[i] -= 1
flag = 0... | 31 | 22 | 696 | 437 | N = int(eval(input()))
H = list(map(int, input().split()))
cnt = 0
while True:
flag = 0
for i in range(N):
if H[i] > 0:
cur = i
flag = 1
break
if flag == 0:
break
cmin = H[cur]
flag = 1
for i in range(cur, N):
if H[i] > 0 and flag == 1:... | N = int(eval(input()))
H = list(map(int, input().split()))
tot = 0
while True:
if H[0] > 0:
cnt = 1
else:
cnt = 0
for i in range(1, N):
if H[i] > 0 and H[i - 1] == 0:
cnt += 1
tot += cnt
for i in range(N):
if H[i] > 0:
H[i] -= 1
flag = 0
... | false | 29.032258 | [
"-cnt = 0",
"+tot = 0",
"+ if H[0] > 0:",
"+ cnt = 1",
"+ else:",
"+ cnt = 0",
"+ for i in range(1, N):",
"+ if H[i] > 0 and H[i - 1] == 0:",
"+ cnt += 1",
"+ tot += cnt",
"+ for i in range(N):",
"+ if H[i] > 0:",
"+ H[i] -= 1"... | false | 0.055985 | 0.042371 | 1.321312 | [
"s225813481",
"s436486824"
] |
u678167152 | p02588 | python | s221342522 | s311194341 | 867 | 266 | 39,996 | 95,676 | Accepted | Accepted | 69.32 | from decimal import Decimal
def waru(N,num):
cnt = 0
while N%num==0:
N //= num
cnt += 1
return cnt
def solve():
N = int(eval(input()))
num = [[0]*101 for _ in range(101)]
lis = [0]*N
for i in range(N):
a = int(round(float(eval(input()))*10**9))
p,q = waru(a,2)-9-50,waru(a,5)-9... | import sys
input = sys.stdin.readline
def waru(N,num):
cnt = 0
while N%num==0:
N //= num
cnt += 1
return cnt
def solve():
N = int(eval(input()))
num = [[0]*101 for _ in range(101)]
lis = [0]*N
for i in range(N):
a = int(round(float(eval(input()))*10**9))
p,q = waru(a,2)-9-50,... | 31 | 32 | 719 | 730 | from decimal import Decimal
def waru(N, num):
cnt = 0
while N % num == 0:
N //= num
cnt += 1
return cnt
def solve():
N = int(eval(input()))
num = [[0] * 101 for _ in range(101)]
lis = [0] * N
for i in range(N):
a = int(round(float(eval(input())) * 10**9))
... | import sys
input = sys.stdin.readline
def waru(N, num):
cnt = 0
while N % num == 0:
N //= num
cnt += 1
return cnt
def solve():
N = int(eval(input()))
num = [[0] * 101 for _ in range(101)]
lis = [0] * N
for i in range(N):
a = int(round(float(eval(input())) * 10**9... | false | 3.125 | [
"-from decimal import Decimal",
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.107452 | 0.04206 | 2.554725 | [
"s221342522",
"s311194341"
] |
u945181840 | p03578 | python | s435592597 | s568463137 | 258 | 222 | 57,056 | 69,344 | Accepted | Accepted | 13.95 | from collections import Counter
N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
d = Counter(D)
t = Counter(T)
for key, value in list(t.items()):
if d.get(key, 0) < value:
print('NO')
exit()
else:
print('YES') | from collections import Counter
def main():
N = int(eval(input()))
D = input().split()
M = int(eval(input()))
T = input().split()
d = Counter(D)
t = Counter(T)
for key, value in list(t.items()):
if d.get(key, 0) < value:
print('NO')
exit()
... | 15 | 21 | 300 | 375 | from collections import Counter
N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
d = Counter(D)
t = Counter(T)
for key, value in list(t.items()):
if d.get(key, 0) < value:
print("NO")
exit()
else:
print("YES")
| from collections import Counter
def main():
N = int(eval(input()))
D = input().split()
M = int(eval(input()))
T = input().split()
d = Counter(D)
t = Counter(T)
for key, value in list(t.items()):
if d.get(key, 0) < value:
print("NO")
exit()
else:
... | false | 28.571429 | [
"-N = int(eval(input()))",
"-D = list(map(int, input().split()))",
"-M = int(eval(input()))",
"-T = list(map(int, input().split()))",
"-d = Counter(D)",
"-t = Counter(T)",
"-for key, value in list(t.items()):",
"- if d.get(key, 0) < value:",
"- print(\"NO\")",
"- exit()",
"-else... | false | 0.041424 | 0.041412 | 1.000295 | [
"s435592597",
"s568463137"
] |
u983918956 | p03194 | python | s241832365 | s842639364 | 124 | 59 | 3,064 | 3,188 | Accepted | Accepted | 52.42 | import math
N,P = list(map(int,input().split()))
if N == 1:
print(P)
exit()
ans = 1
for i in range(2,math.floor(pow(P,1/2)) + 1):
if P % i == 0:
count = 1
P = P // i
while P % i == 0:
count += 1
P = P // i
ans *= pow(i,count // N)
print(a... | import math
def factoring(n,dict_count = {}):
sup = math.floor(pow(n,1/2))
n_new = n
for i in range(2,sup + 1):
if n % i == 0:
n_new = n // i
if i in dict_count:
dict_count[i] += 1
else:
dict_count[i] = 1
brea... | 15 | 25 | 317 | 673 | import math
N, P = list(map(int, input().split()))
if N == 1:
print(P)
exit()
ans = 1
for i in range(2, math.floor(pow(P, 1 / 2)) + 1):
if P % i == 0:
count = 1
P = P // i
while P % i == 0:
count += 1
P = P // i
ans *= pow(i, count // N)
print(ans)
| import math
def factoring(n, dict_count={}):
sup = math.floor(pow(n, 1 / 2))
n_new = n
for i in range(2, sup + 1):
if n % i == 0:
n_new = n // i
if i in dict_count:
dict_count[i] += 1
else:
dict_count[i] = 1
break
... | false | 40 | [
"+",
"+def factoring(n, dict_count={}):",
"+ sup = math.floor(pow(n, 1 / 2))",
"+ n_new = n",
"+ for i in range(2, sup + 1):",
"+ if n % i == 0:",
"+ n_new = n // i",
"+ if i in dict_count:",
"+ dict_count[i] += 1",
"+ else:",
"+ ... | false | 0.082093 | 0.046204 | 1.77674 | [
"s241832365",
"s842639364"
] |
u763249708 | p02641 | python | s922292388 | s570763489 | 33 | 26 | 8,952 | 9,004 | Accepted | Accepted | 21.21 | x, n = list(map(int, input().split()))
if n == 0:
print(x)
exit()
p = list(map(int, input().split()))
for d in range(x + 2):
for s in [-1, 1]:
a = x + s * d
if a not in p:
print(a)
exit() | x, n = list(map(int, input().split()))
if n == 0:
print(x)
exit()
p = list(map(int, input().split()))
for d in range(x + 2):
if x - d not in p:
print((x-d))
exit()
if x + d not in p:
print((x+d))
exit() | 13 | 13 | 214 | 223 | x, n = list(map(int, input().split()))
if n == 0:
print(x)
exit()
p = list(map(int, input().split()))
for d in range(x + 2):
for s in [-1, 1]:
a = x + s * d
if a not in p:
print(a)
exit()
| x, n = list(map(int, input().split()))
if n == 0:
print(x)
exit()
p = list(map(int, input().split()))
for d in range(x + 2):
if x - d not in p:
print((x - d))
exit()
if x + d not in p:
print((x + d))
exit()
| false | 0 | [
"- for s in [-1, 1]:",
"- a = x + s * d",
"- if a not in p:",
"- print(a)",
"- exit()",
"+ if x - d not in p:",
"+ print((x - d))",
"+ exit()",
"+ if x + d not in p:",
"+ print((x + d))",
"+ exit()"
] | false | 0.046899 | 0.047755 | 0.982066 | [
"s922292388",
"s570763489"
] |
u197300260 | p03373 | python | s754522073 | s245392659 | 143 | 88 | 9,700 | 9,972 | Accepted | Accepted | 38.46 | # Problem: https://atcoder.jp/contests/arc096/tasks/arc096_a
# Python 1st Try
import sys
# from collections import defaultdict
# import heapq,copy
import pprint as pp
# from collections import deque
def II(): return int(sys.stdin.readline())
def MI(): return list(map(int, sys.stdin.readline().split()))
def L... | # Problem: https://atcoder.jp/contests/arc096/tasks/arc096_a
# Python 2nd Try
import sys
# from collections import defaultdict
# import heapq,copy
import pprint as pp
# from collections import deque
def II(): return int(sys.stdin.readline())
def MI(): return list(map(int, sys.stdin.readline().split()))
def L... | 33 | 38 | 1,065 | 1,262 | # Problem: https://atcoder.jp/contests/arc096/tasks/arc096_a
# Python 1st Try
import sys
# from collections import defaultdict
# import heapq,copy
import pprint as pp
# from collections import deque
def II():
return int(sys.stdin.readline())
def MI():
return list(map(int, sys.stdin.readline().split()))
de... | # Problem: https://atcoder.jp/contests/arc096/tasks/arc096_a
# Python 2nd Try
import sys
# from collections import defaultdict
# import heapq,copy
import pprint as pp
# from collections import deque
def II():
return int(sys.stdin.readline())
def MI():
return list(map(int, sys.stdin.readline().split()))
de... | false | 13.157895 | [
"-# Python 1st Try",
"+# Python 2nd Try",
"-# CONST",
"+# Const",
"+MAXSHEET = 10**5",
"-def solver(a_price, b_price, c_price, target_x, target_y):",
"- result = MAXSIZE",
"- for mix_i in range(0, 2 * 10**5 + 1, +1):",
"- a_i = target_x - mix_i // 2",
"- b_i = target_y - mix_i ... | false | 0.177419 | 0.150622 | 1.177906 | [
"s754522073",
"s245392659"
] |
u747602774 | p03048 | python | s814505695 | s827644459 | 267 | 216 | 41,068 | 40,684 | Accepted | Accepted | 19.1 | R,G,B,N = list(map(int,input().split()))
ans = 0
for b in range(N+1):
for g in range(N+1):
if N-B*b-G*g >= 0 and (N-B*b-G*g)%R == 0:
ans += 1
print(ans)
| R,G,B,N = list(map(int,input().split()))
ans = 0
for b in range(N+1):
for g in range(N+1):
if N-B*b-G*g < 0:
break
if (N-B*b-G*g)%R == 0:
ans += 1
print(ans)
| 9 | 10 | 181 | 206 | R, G, B, N = list(map(int, input().split()))
ans = 0
for b in range(N + 1):
for g in range(N + 1):
if N - B * b - G * g >= 0 and (N - B * b - G * g) % R == 0:
ans += 1
print(ans)
| R, G, B, N = list(map(int, input().split()))
ans = 0
for b in range(N + 1):
for g in range(N + 1):
if N - B * b - G * g < 0:
break
if (N - B * b - G * g) % R == 0:
ans += 1
print(ans)
| false | 10 | [
"- if N - B * b - G * g >= 0 and (N - B * b - G * g) % R == 0:",
"+ if N - B * b - G * g < 0:",
"+ break",
"+ if (N - B * b - G * g) % R == 0:"
] | false | 0.918651 | 0.397135 | 2.313195 | [
"s814505695",
"s827644459"
] |
u933341648 | p02695 | python | s811817403 | s614676326 | 589 | 540 | 9,108 | 9,092 | Accepted | Accepted | 8.32 | n, m, q = list(map(int, input().split()))
queries = [tuple(map(int, input().split())) for _ in range(q)]
ans = 0
def calc_score(p):
score = 0
for a, b, c, d in queries:
if p[b-1] - p[a-1] == c:
score += d
return score
def f(p):
if len(p) == n:
global ans
... | from itertools import combinations_with_replacement as comb
n, m, q = list(map(int, input().split()))
queries = [tuple(map(int, input().split())) for _ in range(q)]
ans = 0
def calc_score(p):
score = 0
for a, b, c, d in queries:
if p[b-1] - p[a-1] == c:
score += d
return sco... | 23 | 17 | 467 | 402 | n, m, q = list(map(int, input().split()))
queries = [tuple(map(int, input().split())) for _ in range(q)]
ans = 0
def calc_score(p):
score = 0
for a, b, c, d in queries:
if p[b - 1] - p[a - 1] == c:
score += d
return score
def f(p):
if len(p) == n:
global ans
ans =... | from itertools import combinations_with_replacement as comb
n, m, q = list(map(int, input().split()))
queries = [tuple(map(int, input().split())) for _ in range(q)]
ans = 0
def calc_score(p):
score = 0
for a, b, c, d in queries:
if p[b - 1] - p[a - 1] == c:
score += d
return score
f... | false | 26.086957 | [
"+from itertools import combinations_with_replacement as comb",
"+",
"-def f(p):",
"- if len(p) == n:",
"- global ans",
"- ans = max(ans, calc_score(p))",
"- return",
"- l = p[-1] if len(p) else 1",
"- for x in range(l, m + 1):",
"- f(p + [x])",
"-",
"-",
... | false | 0.198545 | 0.144707 | 1.372053 | [
"s811817403",
"s614676326"
] |
u560867850 | p03087 | python | s439617648 | s553442280 | 473 | 332 | 30,744 | 9,476 | Accepted | Accepted | 29.81 | from itertools import accumulate
n, q = list(map(int, input().split()))
s = eval(input())
problems = [list(map(int, input().split())) for _ in range(q)]
def count(total, i):
return total + 1 if s[i-1:i+1] == 'AC' else total
cumsum = list(accumulate(list(range(n)), count))
for l, r in problems... | from sys import stdin
from itertools import accumulate
def fin(f):
"""
INput with Function
f(input())と同じ。書きやすさのために作成した。
:param f: 入力に対して呼び出す関数
:return: 関数の処理結果
"""
return f(stdin.readline().rstrip())
def gin(f, nl=1):
"""
INput with function and Generator
空白区... | 17 | 45 | 342 | 917 | from itertools import accumulate
n, q = list(map(int, input().split()))
s = eval(input())
problems = [list(map(int, input().split())) for _ in range(q)]
def count(total, i):
return total + 1 if s[i - 1 : i + 1] == "AC" else total
cumsum = list(accumulate(list(range(n)), count))
for l, r in problems:
print(... | from sys import stdin
from itertools import accumulate
def fin(f):
"""
INput with Function
f(input())と同じ。書きやすさのために作成した。
:param f: 入力に対して呼び出す関数
:return: 関数の処理結果
"""
return f(stdin.readline().rstrip())
def gin(f, nl=1):
"""
INput with function and Generator
空白区切りの入力の各値に対して関数fを用... | false | 62.222222 | [
"+from sys import stdin",
"-n, q = list(map(int, input().split()))",
"+",
"+def fin(f):",
"+ \"\"\"",
"+ INput with Function",
"+ f(input())と同じ。書きやすさのために作成した。",
"+ :param f: 入力に対して呼び出す関数",
"+ :return: 関数の処理結果",
"+ \"\"\"",
"+ return f(stdin.readline().rstrip())",
"+",
"+... | false | 0.043335 | 0.109931 | 0.394203 | [
"s439617648",
"s553442280"
] |
u411923565 | p03486 | python | s958784216 | s145216194 | 31 | 26 | 9,036 | 9,064 | Accepted | Accepted | 16.13 | #28 B - Two Anagrams
s = list(eval(input()))
t = list(eval(input()))
s = sorted(s,reverse = False)
t = sorted(t,reverse = True)
result = 'No'
rang = min(len(s),len(t))
for i in range(rang):
if ord(s[i]) < ord(t[i]):
result = 'Yes'
break
else:
# 文字が一緒で t の方が文字数が多いとき
if (s[:ra... | #28 B - Two Anagrams AC
s = list(eval(input()))
t = list(eval(input()))
s = sorted(s,reverse = False)
t = sorted(t,reverse = True)
s = ''.join(s)
t = ''.join(t)
if s < t:
print('Yes')
else:
print('No') | 18 | 13 | 384 | 211 | # 28 B - Two Anagrams
s = list(eval(input()))
t = list(eval(input()))
s = sorted(s, reverse=False)
t = sorted(t, reverse=True)
result = "No"
rang = min(len(s), len(t))
for i in range(rang):
if ord(s[i]) < ord(t[i]):
result = "Yes"
break
else:
# 文字が一緒で t の方が文字数が多いとき
if (s[:rang] == t[:rang]) ... | # 28 B - Two Anagrams AC
s = list(eval(input()))
t = list(eval(input()))
s = sorted(s, reverse=False)
t = sorted(t, reverse=True)
s = "".join(s)
t = "".join(t)
if s < t:
print("Yes")
else:
print("No")
| false | 27.777778 | [
"-# 28 B - Two Anagrams",
"+# 28 B - Two Anagrams AC",
"-result = \"No\"",
"-rang = min(len(s), len(t))",
"-for i in range(rang):",
"- if ord(s[i]) < ord(t[i]):",
"- result = \"Yes\"",
"- break",
"+s = \"\".join(s)",
"+t = \"\".join(t)",
"+if s < t:",
"+ print(\"Yes\")",
... | false | 0.034453 | 0.059331 | 0.580683 | [
"s958784216",
"s145216194"
] |
u754022296 | p02992 | python | s068631985 | s610296227 | 1,707 | 208 | 23,404 | 33,032 | Accepted | Accepted | 87.81 | import sys
input = sys.stdin.readline
from itertools import accumulate
MOD = 10**9+7
def main():
n, k = list(map(int, input().split()))
S = set()
i = 1
while i * i <= n:
S.add(i)
S.add(n//i)
i += 1
L = [0] + sorted(S)
l = len(L) - 1
num = [0]*l
for i in range(l):
num[i]... | import sys
input = sys.stdin.readline
import numpy as np
MOD = 10**9+7
n, k = list(map(int, input().split()))
S = set()
i = 1
while i * i <= n:
S.add(i)
S.add(n//i)
i += 1
L = np.array([0] + sorted(S), dtype=np.int64)
l = len(L) - 1
num = np.diff(L)
dp = np.zeros(l, dtype=np.int64)
dp[0] = 1
f... | 30 | 23 | 563 | 421 | import sys
input = sys.stdin.readline
from itertools import accumulate
MOD = 10**9 + 7
def main():
n, k = list(map(int, input().split()))
S = set()
i = 1
while i * i <= n:
S.add(i)
S.add(n // i)
i += 1
L = [0] + sorted(S)
l = len(L) - 1
num = [0] * l
for i in ... | import sys
input = sys.stdin.readline
import numpy as np
MOD = 10**9 + 7
n, k = list(map(int, input().split()))
S = set()
i = 1
while i * i <= n:
S.add(i)
S.add(n // i)
i += 1
L = np.array([0] + sorted(S), dtype=np.int64)
l = len(L) - 1
num = np.diff(L)
dp = np.zeros(l, dtype=np.int64)
dp[0] = 1
for _ in ... | false | 23.333333 | [
"-from itertools import accumulate",
"+import numpy as np",
"-",
"-",
"-def main():",
"- n, k = list(map(int, input().split()))",
"- S = set()",
"- i = 1",
"- while i * i <= n:",
"- S.add(i)",
"- S.add(n // i)",
"- i += 1",
"- L = [0] + sorted(S)",
"- ... | false | 0.497252 | 0.344523 | 1.443309 | [
"s068631985",
"s610296227"
] |
u370331385 | p03212 | python | s838528176 | s460883613 | 1,974 | 187 | 36,980 | 6,772 | Accepted | Accepted | 90.53 | import itertools
N = eval(input())
N1 = int(N)
N2 = len(N)
num753_comb = []
for i in range(N2):
num753_comb.append([0,3,5,7])
All_comb = list(itertools.product(*num753_comb))
count = 0
for i in range(len(All_comb)):
tmp = list(All_comb[i])
tmp_num = 0
judge0,judge3,judge5,judge7 = 0,0,0,0
for... | import itertools
N_ = eval(input())
N = int(N_)
n = len(list(N_)) #Nの桁数
#(方針) N<=10**9 だと3,5,7のみを使ってできる数は多くても3**9=2*10**4通りなので全探索
A = ['3','5','7']
ans = 0
if(n >= 3): #桁数が3以上なら
for i in range(3,n+1):
Comb = list(itertools.product(A, repeat=i)) #重複組み合わせ
for j in range(len(Comb)):
tmp = list(... | 29 | 40 | 660 | 901 | import itertools
N = eval(input())
N1 = int(N)
N2 = len(N)
num753_comb = []
for i in range(N2):
num753_comb.append([0, 3, 5, 7])
All_comb = list(itertools.product(*num753_comb))
count = 0
for i in range(len(All_comb)):
tmp = list(All_comb[i])
tmp_num = 0
judge0, judge3, judge5, judge7 = 0, 0, 0, 0
... | import itertools
N_ = eval(input())
N = int(N_)
n = len(list(N_)) # Nの桁数
# (方針) N<=10**9 だと3,5,7のみを使ってできる数は多くても3**9=2*10**4通りなので全探索
A = ["3", "5", "7"]
ans = 0
if n >= 3: # 桁数が3以上なら
for i in range(3, n + 1):
Comb = list(itertools.product(A, repeat=i)) # 重複組み合わせ
for j in range(len(Comb)):
... | false | 27.5 | [
"-N = eval(input())",
"-N1 = int(N)",
"-N2 = len(N)",
"-num753_comb = []",
"-for i in range(N2):",
"- num753_comb.append([0, 3, 5, 7])",
"-All_comb = list(itertools.product(*num753_comb))",
"-count = 0",
"-for i in range(len(All_comb)):",
"- tmp = list(All_comb[i])",
"- tmp_num = 0",
... | false | 0.044808 | 0.04663 | 0.960939 | [
"s838528176",
"s460883613"
] |
u803848678 | p03241 | python | s960093635 | s682689213 | 31 | 22 | 3,316 | 3,060 | Accepted | Accepted | 29.03 | from collections import Counter
n, m = list(map(int, input().split()))
def factorize(m):
c = Counter()
t = 2
while t**2 <= m:
if m % t:
t += 1
continue
while not m%t:
c[t] += 1
m //= t
if m > 1:
c[m] += 1
return ... | from math import sqrt
n, m = list(map(int, input().split()))
ans = 1
for i in range(int(sqrt(m))):
if m%(i+1)==0:
if n <= m//(i+1) : ans= max(ans, i+1)
if n <= i+1 : ans = max(ans,m//(i+1))
print(ans) | 29 | 8 | 603 | 221 | from collections import Counter
n, m = list(map(int, input().split()))
def factorize(m):
c = Counter()
t = 2
while t**2 <= m:
if m % t:
t += 1
continue
while not m % t:
c[t] += 1
m //= t
if m > 1:
c[m] += 1
return c
yakusu ... | from math import sqrt
n, m = list(map(int, input().split()))
ans = 1
for i in range(int(sqrt(m))):
if m % (i + 1) == 0:
if n <= m // (i + 1):
ans = max(ans, i + 1)
if n <= i + 1:
ans = max(ans, m // (i + 1))
print(ans)
| false | 72.413793 | [
"-from collections import Counter",
"+from math import sqrt",
"-",
"-",
"-def factorize(m):",
"- c = Counter()",
"- t = 2",
"- while t**2 <= m:",
"- if m % t:",
"- t += 1",
"- continue",
"- while not m % t:",
"- c[t] += 1",
"- ... | false | 0.046633 | 0.052663 | 0.885504 | [
"s960093635",
"s682689213"
] |
u046187684 | p02947 | python | s481493017 | s449584311 | 347 | 312 | 27,528 | 27,852 | Accepted | Accepted | 10.09 | def solve(string):
n, *ss = string.split()
d = {}
for s in ["".join(sorted(x)) for x in ss]:
d[s] = 1 + d[s] if s in list(d.keys()) else 1
return str(sum([v * (v - 1) // 2 for v in list(d.values())]))
if __name__ == '__main__':
n = int(eval(input()))
print((solve('{}\n'.forma... | from collections import Counter
def solve(string):
n, *ss = string.split()
d = Counter(s for s in ["".join(sorted(x)) for x in ss])
return str(sum([v * (v - 1) // 2 for v in list(d.values())]))
if __name__ == '__main__':
n = int(eval(input()))
print((solve('{}\n'.format(n) + '\n'.join... | 11 | 12 | 354 | 344 | def solve(string):
n, *ss = string.split()
d = {}
for s in ["".join(sorted(x)) for x in ss]:
d[s] = 1 + d[s] if s in list(d.keys()) else 1
return str(sum([v * (v - 1) // 2 for v in list(d.values())]))
if __name__ == "__main__":
n = int(eval(input()))
print((solve("{}\n".format(n) + "\n... | from collections import Counter
def solve(string):
n, *ss = string.split()
d = Counter(s for s in ["".join(sorted(x)) for x in ss])
return str(sum([v * (v - 1) // 2 for v in list(d.values())]))
if __name__ == "__main__":
n = int(eval(input()))
print((solve("{}\n".format(n) + "\n".join([eval(inpu... | false | 8.333333 | [
"+from collections import Counter",
"+",
"+",
"- d = {}",
"- for s in [\"\".join(sorted(x)) for x in ss]:",
"- d[s] = 1 + d[s] if s in list(d.keys()) else 1",
"+ d = Counter(s for s in [\"\".join(sorted(x)) for x in ss])"
] | false | 0.007056 | 0.116286 | 0.06068 | [
"s481493017",
"s449584311"
] |
u422104747 | p03286 | python | s090158012 | s136567782 | 333 | 303 | 116,976 | 117,872 | Accepted | Accepted | 9.01 | import bisect
def put(a,b): #結果の表示
l=max(len(a),len(b)) #aとbの長さが違うときに壊れるので以下で十分な長さの0を結合しておく
a="0"*l+a
b="0"*l+b
s=""
for i in range(-1,-l-1,-1): #長さの偶奇を考えたくないので逆順に生成してあとで反転
s+=a[i]+b[i]
s=s[-1::-1] #反転
ind=s.find("1")
print((s[ind:])) #頭にたくさんついている0を除いて表示
def quad(i):... | import bisect
def put(a, b): # 結果の表示
l = max(len(a), len(b)) # aとbの長さが違うときに壊れるので以下で十分な長さの0を結合しておく
a = "0" * l + a
b = "0" * l + b
s = ""
for i in range(-1, -l-1, -1): # 長さの偶奇を考えたくないので逆順に生成してあとで反転
s += a[i] + b[i]
s = s[-1::-1] # 反転
print((s[s.find("1"):])) # 頭にたくさんつ... | 32 | 35 | 754 | 829 | import bisect
def put(a, b): # 結果の表示
l = max(len(a), len(b)) # aとbの長さが違うときに壊れるので以下で十分な長さの0を結合しておく
a = "0" * l + a
b = "0" * l + b
s = ""
for i in range(-1, -l - 1, -1): # 長さの偶奇を考えたくないので逆順に生成してあとで反転
s += a[i] + b[i]
s = s[-1::-1] # 反転
ind = s.find("1")
print((s[ind:])) # 頭に... | import bisect
def put(a, b): # 結果の表示
l = max(len(a), len(b)) # aとbの長さが違うときに壊れるので以下で十分な長さの0を結合しておく
a = "0" * l + a
b = "0" * l + b
s = ""
for i in range(-1, -l - 1, -1): # 長さの偶奇を考えたくないので逆順に生成してあとで反転
s += a[i] + b[i]
s = s[-1::-1] # 反転
print((s[s.find("1") :])) # 頭にたくさんついている0を除い... | false | 8.571429 | [
"- ind = s.find(\"1\")",
"- print((s[ind:])) # 頭にたくさんついている0を除いて表示",
"+ print((s[s.find(\"1\") :])) # 頭にたくさんついている0を除いて表示"
] | false | 0.823783 | 0.649332 | 1.268661 | [
"s090158012",
"s136567782"
] |
u957167787 | p03086 | python | s931228998 | s205039962 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | S = eval(input())
ans = 0
for i in range(len(S)):
tmp = 0
for j in range(i, len(S)):
if S[j] == 'A' or S[j] == 'T' or S[j] == 'G' or S[j] == 'C':
tmp += 1
else:
ans = max(ans, tmp)
break
if j == len(S) - 1:
ans = max(ans, tmp)
... | S = eval(input())
ans = 0
for i in range(len(S)):
tmp = 0
for j in range(i, len(S)):
if S[j] == 'A' or S[j] == 'T' or S[j] == 'G' or S[j] == 'C':
tmp += 1
else:
break
ans = max(ans, tmp)
print(ans)
| 17 | 15 | 332 | 262 | S = eval(input())
ans = 0
for i in range(len(S)):
tmp = 0
for j in range(i, len(S)):
if S[j] == "A" or S[j] == "T" or S[j] == "G" or S[j] == "C":
tmp += 1
else:
ans = max(ans, tmp)
break
if j == len(S) - 1:
ans = max(ans, tmp)
print(ans)
| S = eval(input())
ans = 0
for i in range(len(S)):
tmp = 0
for j in range(i, len(S)):
if S[j] == "A" or S[j] == "T" or S[j] == "G" or S[j] == "C":
tmp += 1
else:
break
ans = max(ans, tmp)
print(ans)
| false | 11.764706 | [
"- ans = max(ans, tmp)",
"- if j == len(S) - 1:",
"- ans = max(ans, tmp)",
"+ ans = max(ans, tmp)"
] | false | 0.036082 | 0.037928 | 0.951339 | [
"s931228998",
"s205039962"
] |
u864197622 | p02726 | python | s653170008 | s594411397 | 327 | 267 | 48,604 | 46,044 | Accepted | Accepted | 18.35 | N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
def dist(a, b):
return min(abs(b-a), abs(X-a) + 1 + abs(b-Y), abs(Y-a) + 1 + abs(b-X))
ANS = [0] * N
for i in range(N):
for j in range(i):
ANS[dist(i, j)] += 1
for a in ANS[1:]:
print(a) | N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
def dist(a, b):
return min(abs(b-a), abs(X-a) + 1 + abs(b-Y))
ANS = [0] * N
for i in range(N):
for j in range(i):
ANS[dist(j, i)] += 1
for a in ANS[1:]:
print(a) | 14 | 14 | 272 | 247 | N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
def dist(a, b):
return min(abs(b - a), abs(X - a) + 1 + abs(b - Y), abs(Y - a) + 1 + abs(b - X))
ANS = [0] * N
for i in range(N):
for j in range(i):
ANS[dist(i, j)] += 1
for a in ANS[1:]:
print(a)
| N, X, Y = list(map(int, input().split()))
X -= 1
Y -= 1
def dist(a, b):
return min(abs(b - a), abs(X - a) + 1 + abs(b - Y))
ANS = [0] * N
for i in range(N):
for j in range(i):
ANS[dist(j, i)] += 1
for a in ANS[1:]:
print(a)
| false | 0 | [
"- return min(abs(b - a), abs(X - a) + 1 + abs(b - Y), abs(Y - a) + 1 + abs(b - X))",
"+ return min(abs(b - a), abs(X - a) + 1 + abs(b - Y))",
"- ANS[dist(i, j)] += 1",
"+ ANS[dist(j, i)] += 1"
] | false | 0.068432 | 0.053339 | 1.282955 | [
"s653170008",
"s594411397"
] |
u077291787 | p03103 | python | s524917725 | s975630727 | 404 | 321 | 28,648 | 27,812 | Accepted | Accepted | 20.54 | # ABC121C - Energy Drink Collector
import sys
input = sys.stdin.readline
n, m = list(map(int, input().rstrip().split()))
lst = sorted([list(map(int, input().rstrip().split())) for _ in range(n)])
ans = 0
for i in lst:
while i[1] > 0 and m > 0:
ans += i[0]
i[1] -= 1
m -= 1
print(... | # ABC121C - Energy Drink Collector
import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().rstrip().split()))
lst = sorted(list(map(int, input().split())) for _ in range(n))
ans = 0
for i in lst:
while i[1] > 0 and m > 0:
ans += i[0]
i[1... | 13 | 18 | 324 | 406 | # ABC121C - Energy Drink Collector
import sys
input = sys.stdin.readline
n, m = list(map(int, input().rstrip().split()))
lst = sorted([list(map(int, input().rstrip().split())) for _ in range(n)])
ans = 0
for i in lst:
while i[1] > 0 and m > 0:
ans += i[0]
i[1] -= 1
m -= 1
print(ans)
| # ABC121C - Energy Drink Collector
import sys
input = sys.stdin.readline
def main():
n, m = list(map(int, input().rstrip().split()))
lst = sorted(list(map(int, input().split())) for _ in range(n))
ans = 0
for i in lst:
while i[1] > 0 and m > 0:
ans += i[0]
i[1] -= 1
... | false | 27.777778 | [
"-n, m = list(map(int, input().rstrip().split()))",
"-lst = sorted([list(map(int, input().rstrip().split())) for _ in range(n)])",
"-ans = 0",
"-for i in lst:",
"- while i[1] > 0 and m > 0:",
"- ans += i[0]",
"- i[1] -= 1",
"- m -= 1",
"-print(ans)",
"+",
"+",
"+def mai... | false | 0.04209 | 0.053421 | 0.787897 | [
"s524917725",
"s975630727"
] |
u950708010 | p03608 | python | s490421215 | s349090823 | 1,748 | 621 | 9,696 | 19,420 | Accepted | Accepted | 64.47 | import itertools
import sys
input = sys.stdin.readline
def solve():
n,m,R = (int(i) for i in input().split())
r = list(int(i) for i in input().split())
d = [[float("Inf")]*n for _ in range(n)]
for i in range(m):
a,b,c = (int(i) for i in input().split())
d[a-1][b-1] = c
d[b-1][a-1] = c
... | import itertools
from scipy.sparse.csgraph import dijkstra
import sys
input = sys.stdin.readline
def solve():
n,m,R = (int(i) for i in input().split())
r = list(int(i) for i in input().split())
d = [[float("Inf")]*n for _ in range(n)]
for i in range(m):
a,b,c = (int(i) for i in input().split())
... | 31 | 27 | 782 | 693 | import itertools
import sys
input = sys.stdin.readline
def solve():
n, m, R = (int(i) for i in input().split())
r = list(int(i) for i in input().split())
d = [[float("Inf")] * n for _ in range(n)]
for i in range(m):
a, b, c = (int(i) for i in input().split())
d[a - 1][b - 1] = c
... | import itertools
from scipy.sparse.csgraph import dijkstra
import sys
input = sys.stdin.readline
def solve():
n, m, R = (int(i) for i in input().split())
r = list(int(i) for i in input().split())
d = [[float("Inf")] * n for _ in range(n)]
for i in range(m):
a, b, c = (int(i) for i in input().... | false | 12.903226 | [
"+from scipy.sparse.csgraph import dijkstra",
"- for k in range(n):",
"- for i in range(n):",
"- for j in range(n):",
"- if d[i][j] > d[i][k] + d[k][j]:",
"- d[i][j] = d[i][k] + d[k][j]",
"+ d = dijkstra(d)",
"- print(cost)",
"+ print((... | false | 0.036742 | 0.66725 | 0.055065 | [
"s490421215",
"s349090823"
] |
u365512540 | p02971 | python | s559025616 | s478207996 | 967 | 461 | 68,896 | 25,220 | Accepted | Accepted | 52.33 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
a_sorted = sorted(a)[::-1][:2]
for an in a:
print((a_sorted[an == a_sorted[0]])) | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
a_sorted = sorted(a, reverse=True)[:2]
print(('\n'.join(map(str, [a_sorted[an == a_sorted[0]] for an in a])))) | 5 | 4 | 140 | 165 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
a_sorted = sorted(a)[::-1][:2]
for an in a:
print((a_sorted[an == a_sorted[0]]))
| n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
a_sorted = sorted(a, reverse=True)[:2]
print(("\n".join(map(str, [a_sorted[an == a_sorted[0]] for an in a]))))
| false | 20 | [
"-a_sorted = sorted(a)[::-1][:2]",
"-for an in a:",
"- print((a_sorted[an == a_sorted[0]]))",
"+a_sorted = sorted(a, reverse=True)[:2]",
"+print((\"\\n\".join(map(str, [a_sorted[an == a_sorted[0]] for an in a]))))"
] | false | 0.077358 | 0.043697 | 1.770319 | [
"s559025616",
"s478207996"
] |
u687159441 | p02983 | python | s949523126 | s738817956 | 981 | 44 | 148,280 | 3,060 | Accepted | Accepted | 95.51 | # lとrの差が2019以上ならば間に必ず2019の倍数が存在するので0になる
# lとrの差が2019より小さければ、余りのリストを作成しi、jの組み合わせをすべて計算してminを求める
# 2019C2なので10**8を上回ることはない
import itertools
l, r = list(map(int, input().split()))
l_rest = l % 2019
r_rest = r % 2019
if l_rest == 0 or r_rest == 0:
print((0))
elif r-l < 2019:
lr_list = list(range(l_res... | # 前から計算して見つかったら止めるのが一番早い
l,r=list(map(int, input().split()))
import sys
ans = 2018
for i in range(l,r):
for j in range(i+1,r+1):
a = (i*j) % 2019
if a < ans:
ans = a
if ans == 0:
print(ans)
sys.exit()
print(ans) | 22 | 13 | 571 | 281 | # lとrの差が2019以上ならば間に必ず2019の倍数が存在するので0になる
# lとrの差が2019より小さければ、余りのリストを作成しi、jの組み合わせをすべて計算してminを求める
# 2019C2なので10**8を上回ることはない
import itertools
l, r = list(map(int, input().split()))
l_rest = l % 2019
r_rest = r % 2019
if l_rest == 0 or r_rest == 0:
print((0))
elif r - l < 2019:
lr_list = list(range(l_rest, r_rest +... | # 前から計算して見つかったら止めるのが一番早い
l, r = list(map(int, input().split()))
import sys
ans = 2018
for i in range(l, r):
for j in range(i + 1, r + 1):
a = (i * j) % 2019
if a < ans:
ans = a
if ans == 0:
print(ans)
sys.exit()
print(ans)
| false | 40.909091 | [
"-# lとrの差が2019以上ならば間に必ず2019の倍数が存在するので0になる",
"-# lとrの差が2019より小さければ、余りのリストを作成しi、jの組み合わせをすべて計算してminを求める",
"-# 2019C2なので10**8を上回ることはない",
"-import itertools",
"+# 前から計算して見つかったら止めるのが一番早い",
"+l, r = list(map(int, input().split()))",
"+import sys",
"-l, r = list(map(int, input().split()))",
"-l_rest = l % 2... | false | 0.084995 | 0.037784 | 2.249505 | [
"s949523126",
"s738817956"
] |
u222668979 | p03089 | python | s720939597 | s535375384 | 262 | 138 | 63,564 | 63,184 | Accepted | Accepted | 47.33 | n = int(input())
b = list(map(int, input().split()))
ans = []
for _ in range(n):
for i, bi in enumerate(b[::-1]):
i = len(b) - i
if i == bi:
ans.append(b.pop(i-1))
break
print(*(ans[::-1] if len(ans) == n else[-1]), sep='\n')
| n = int(input())
b = list(map(int, input().split()))
ans = []
for _ in range(n):
for i, bi in enumerate(b[::-1]):
if len(b) == bi + i:
ans.append(b.pop(len(b) - i - 1))
break
print(*(ans[::-1] if len(ans) == n else [-1]), sep='\n')
| 11 | 10 | 281 | 278 | n = int(input())
b = list(map(int, input().split()))
ans = []
for _ in range(n):
for i, bi in enumerate(b[::-1]):
i = len(b) - i
if i == bi:
ans.append(b.pop(i - 1))
break
print(*(ans[::-1] if len(ans) == n else [-1]), sep="\n")
| n = int(input())
b = list(map(int, input().split()))
ans = []
for _ in range(n):
for i, bi in enumerate(b[::-1]):
if len(b) == bi + i:
ans.append(b.pop(len(b) - i - 1))
break
print(*(ans[::-1] if len(ans) == n else [-1]), sep="\n")
| false | 9.090909 | [
"- i = len(b) - i",
"- if i == bi:",
"- ans.append(b.pop(i - 1))",
"+ if len(b) == bi + i:",
"+ ans.append(b.pop(len(b) - i - 1))"
] | false | 0.072685 | 0.10806 | 0.672634 | [
"s720939597",
"s535375384"
] |
u191874006 | p03674 | python | s993522319 | s069959315 | 767 | 412 | 69,080 | 57,744 | Accepted | Accepted | 46.28 | #!/usr/bin/env python3
#ABC66 D
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counte... | #!/usr/bin/env python3
#ABC66 D
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counte... | 57 | 49 | 1,320 | 1,143 | #!/usr/bin/env python3
# ABC66 D
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from co... | #!/usr/bin/env python3
# ABC66 D
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from co... | false | 14.035088 | [
"-def f(a, b):",
"- if b == 0:",
"- return 1",
"- if b % 2 == 0:",
"- d = f(a, b // 2)",
"- return d * d % mod",
"- if b % 2 == 1:",
"- return (a * f(a, b - 1)) % mod",
"-",
"-",
"- invfact[i] = invfact[i - 1] * f(i, mod - 2) % mod",
"+ invfact[i] = i... | false | 0.04052 | 0.035125 | 1.153612 | [
"s993522319",
"s069959315"
] |
u699296734 | p03645 | python | s629048695 | s021155194 | 681 | 437 | 81,284 | 23,868 | Accepted | Accepted | 35.83 | n, m = list(map(int, input().split()))
root_map = dict()
root_map[1] = set()
root_map[n] = set()
for i in range(m):
a, b = list(map(int, input().split()))
if a not in root_map:
root_map[a] = set()
root_map[a].add(b)
else:
root_map[a].add(b)
if b not in root_map:
... | n, m = list(map(int, input().split()))
root_map = dict()
root_map[1] = set()
root_map[n] = set()
for i in range(m):
a, b = list(map(int, input().split()))
if a == 1 or a == n:
root_map[a].add(b)
if b == 1 or b == n:
root_map[b].add(a)
for i in root_map[1]:
if i in root_map... | 24 | 18 | 525 | 387 | n, m = list(map(int, input().split()))
root_map = dict()
root_map[1] = set()
root_map[n] = set()
for i in range(m):
a, b = list(map(int, input().split()))
if a not in root_map:
root_map[a] = set()
root_map[a].add(b)
else:
root_map[a].add(b)
if b not in root_map:
root_map[... | n, m = list(map(int, input().split()))
root_map = dict()
root_map[1] = set()
root_map[n] = set()
for i in range(m):
a, b = list(map(int, input().split()))
if a == 1 or a == n:
root_map[a].add(b)
if b == 1 or b == n:
root_map[b].add(a)
for i in root_map[1]:
if i in root_map[n]:
pr... | false | 25 | [
"- if a not in root_map:",
"- root_map[a] = set()",
"+ if a == 1 or a == n:",
"- else:",
"- root_map[a].add(b)",
"- if b not in root_map:",
"- root_map[b] = set()",
"- root_map[b].add(a)",
"- else:",
"+ if b == 1 or b == n:"
] | false | 0.070648 | 0.03965 | 1.781799 | [
"s629048695",
"s021155194"
] |
u308684517 | p04031 | python | s797727362 | s199441764 | 25 | 17 | 3,060 | 3,060 | Accepted | Accepted | 32 | n = int(eval(input()))
A = list(map(int, input().split()))
ans = 10**10
for i in range(-100, 101):
t = 0
for j in A:
t += (j-i)**2
if t < ans:
ans = t
print(ans) | n = int(eval(input()))
A = list(map(int, input().split()))
avg = sum(A)//n
avg2 = sum(A)//n + 1
ans = 0
ans2 = 0
for i in A:
ans += (i-avg)**2
ans2 += (i-avg2)**2
print((min(ans, ans2))) | 10 | 10 | 192 | 195 | n = int(eval(input()))
A = list(map(int, input().split()))
ans = 10**10
for i in range(-100, 101):
t = 0
for j in A:
t += (j - i) ** 2
if t < ans:
ans = t
print(ans)
| n = int(eval(input()))
A = list(map(int, input().split()))
avg = sum(A) // n
avg2 = sum(A) // n + 1
ans = 0
ans2 = 0
for i in A:
ans += (i - avg) ** 2
ans2 += (i - avg2) ** 2
print((min(ans, ans2)))
| false | 0 | [
"-ans = 10**10",
"-for i in range(-100, 101):",
"- t = 0",
"- for j in A:",
"- t += (j - i) ** 2",
"- if t < ans:",
"- ans = t",
"-print(ans)",
"+avg = sum(A) // n",
"+avg2 = sum(A) // n + 1",
"+ans = 0",
"+ans2 = 0",
"+for i in A:",
"+ ans += (i - avg) ** 2",
"... | false | 0.068281 | 0.15891 | 0.429685 | [
"s797727362",
"s199441764"
] |
u606045429 | p03911 | python | s529081080 | s409439260 | 525 | 478 | 9,148 | 9,148 | Accepted | Accepted | 8.95 | class UnionFind:
def __init__(self, size):
self.data = [-1] * size
def find(self, x):
if self.data[x] < 0:
return x
else:
self.data[x] = self.find(self.data[x])
return self.data[x]
def union(self, x, y):
x, y = self.find(x), s... | class UnionFind:
def __init__(self, size):
self.data = [-1] * size
def find(self, x):
if self.data[x] < 0:
return x
else:
self.data[x] = self.find(self.data[x])
return self.data[x]
def union(self, x, y):
x, y = self.find(x), s... | 40 | 40 | 954 | 950 | class UnionFind:
def __init__(self, size):
self.data = [-1] * size
def find(self, x):
if self.data[x] < 0:
return x
else:
self.data[x] = self.find(self.data[x])
return self.data[x]
def union(self, x, y):
x, y = self.find(x), self.find(y)
... | class UnionFind:
def __init__(self, size):
self.data = [-1] * size
def find(self, x):
if self.data[x] < 0:
return x
else:
self.data[x] = self.find(self.data[x])
return self.data[x]
def union(self, x, y):
x, y = self.find(x), self.find(y)
... | false | 0 | [
"-uf = UnionFind(N + M + 1)",
"+uf = UnionFind(M + 1)",
"-for i in range(1, N + 1):",
"+for _ in range(N):",
"- uf.union(i, l + N)",
"- used.add(l)",
"-if uf.size(1) - len(used) == N:",
"+ uf.union(L[0], l)",
"+ used.update(L)",
"+if uf.size(used.pop()) == 1 + len(used):"
] | false | 0.054343 | 0.040148 | 1.353589 | [
"s529081080",
"s409439260"
] |
u761989513 | p03574 | python | s482192061 | s693804694 | 31 | 22 | 3,064 | 3,064 | Accepted | Accepted | 29.03 | h, w = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(h)]
for i in range(h):
ans = []
for j in range(w):
bomb = 0
if s[i][j] == ".":
for k in [0, -1, 1]:
for n in [0, -1, 1]:
if i + k < h and j + n < w:
... | h, w = list(map(int, input().split()))
s = [list(eval(input())) for i in range(h)]
for i in range(h):
T = ""
for j in range(w):
if s[i][j] == ".":
count = 0
if i < h - 1:
if s[i + 1][j] == "#":
count += 1
if j < w - 1:... | 18 | 35 | 581 | 1,098 | h, w = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(h)]
for i in range(h):
ans = []
for j in range(w):
bomb = 0
if s[i][j] == ".":
for k in [0, -1, 1]:
for n in [0, -1, 1]:
if i + k < h and j + n < w:
... | h, w = list(map(int, input().split()))
s = [list(eval(input())) for i in range(h)]
for i in range(h):
T = ""
for j in range(w):
if s[i][j] == ".":
count = 0
if i < h - 1:
if s[i + 1][j] == "#":
count += 1
if j < w - 1:
... | false | 48.571429 | [
"-s = [list(eval(input())) for _ in range(h)]",
"+s = [list(eval(input())) for i in range(h)]",
"- ans = []",
"+ T = \"\"",
"- bomb = 0",
"- for k in [0, -1, 1]:",
"- for n in [0, -1, 1]:",
"- if i + k < h and j + n < w:",
"- ... | false | 0.040269 | 0.107202 | 0.375638 | [
"s482192061",
"s693804694"
] |
u203843959 | p03700 | python | s617700215 | s672167949 | 784 | 410 | 60,456 | 118,620 | Accepted | Accepted | 47.7 | import sys
input=sys.stdin.readline
N,A,B=list(map(int,input().split()))
hlist=[]
for i in range(N):
hlist.append(int(eval(input())))
mh=max(hlist)
#print(mh,hlist)
def isOK(m):
if m==0:
return False
hlist2=list(hlist)
for i in range(N):
hlist2[i]-=m*B
#print(m,hlist2)
if max(... | import sys
input=sys.stdin.readline
N,A,B=list(map(int,input().split()))
hlist=[]
mh=0
for i in range(N):
h=int(eval(input()))
hlist.append(h)
mh=max(mh,h)
#print(mh,hlist)
res_dic={0:False}
def isOK(m):
if m in res_dic:
return res_dic[m]
h2list=[]
mh2=-float("inf")
for i in ra... | 38 | 46 | 627 | 766 | import sys
input = sys.stdin.readline
N, A, B = list(map(int, input().split()))
hlist = []
for i in range(N):
hlist.append(int(eval(input())))
mh = max(hlist)
# print(mh,hlist)
def isOK(m):
if m == 0:
return False
hlist2 = list(hlist)
for i in range(N):
hlist2[i] -= m * B
# print(m,... | import sys
input = sys.stdin.readline
N, A, B = list(map(int, input().split()))
hlist = []
mh = 0
for i in range(N):
h = int(eval(input()))
hlist.append(h)
mh = max(mh, h)
# print(mh,hlist)
res_dic = {0: False}
def isOK(m):
if m in res_dic:
return res_dic[m]
h2list = []
mh2 = -float("... | false | 17.391304 | [
"+mh = 0",
"- hlist.append(int(eval(input())))",
"-mh = max(hlist)",
"+ h = int(eval(input()))",
"+ hlist.append(h)",
"+ mh = max(mh, h)",
"+res_dic = {0: False}",
"+",
"+",
"- if m == 0:",
"- return False",
"- hlist2 = list(hlist)",
"+ if m in res_dic:",
"+ ... | false | 0.041814 | 0.041914 | 0.997598 | [
"s617700215",
"s672167949"
] |
u076917070 | p03044 | python | s092482294 | s377495562 | 934 | 732 | 156,208 | 85,204 | Accepted | Accepted | 21.63 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5)
N = int(eval(input()))
G = [[] for _ in range(N)]
for _ in range(N-1):
u, v, w = list(map(int, input().split()))
G[u-1].append([v-1, w])
G[v-1].append([u-1, w])
ans = [0]*N
def dfs(v, p, c):
global ans
ans[v] = c
... | import sys
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
N = int(eval(input()))
G = [[] for _ in range(N)]
for _ in range(N-1):
u, v, w = list(map(int, input().split()))
G[u-1].append([v-1, w])
G[v-1].append([u-1, w])
ans = [0]*N
def dfs(v, p, c):
global ans
ans[v] = c
... | 35 | 35 | 616 | 616 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5)
N = int(eval(input()))
G = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
G[u - 1].append([v - 1, w])
G[v - 1].append([u - 1, w])
ans = [0] * N
def dfs(v, p, c):
global ans
ans[v] = c
f... | import sys
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
N = int(eval(input()))
G = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = list(map(int, input().split()))
G[u - 1].append([v - 1, w])
G[v - 1].append([u - 1, w])
ans = [0] * N
def dfs(v, p, c):
global ans
ans[v] = c
f... | false | 0 | [
"+sys.setrecursionlimit(10**5)",
"-sys.setrecursionlimit(10**5)"
] | false | 0.125642 | 0.044152 | 2.845686 | [
"s092482294",
"s377495562"
] |
u073852194 | p03108 | python | s210906531 | s916070353 | 1,142 | 731 | 111,960 | 35,936 | Accepted | Accepted | 35.99 | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [i for i in range(n)]
self.rank = [0 for _ in range(n)]
self.size = [1 for _ in range(n)]
def find(self, x):
root = x
while self.parents[root] != root:
root = self.parents[r... | 45 | 59 | 1,140 | 1,673 | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = se... | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [i for i in range(n)]
self.rank = [0 for _ in range(n)]
self.size = [1 for _ in range(n)]
def find(self, x):
root = x
while self.parents[root] != root:
root = self.parents[root]
... | false | 23.728814 | [
"- self.parents = [-1] * n",
"+ self.parents = [i for i in range(n)]",
"+ self.rank = [0 for _ in range(n)]",
"+ self.size = [1 for _ in range(n)]",
"- if self.parents[x] < 0:",
"- return x",
"+ root = x",
"+ while self.parents[root] != root:... | false | 0.075446 | 0.046786 | 1.612594 | [
"s210906531",
"s916070353"
] |
u917558625 | p02787 | python | s118864264 | s032722855 | 1,671 | 414 | 3,668 | 14,528 | Accepted | Accepted | 75.22 | n,m=list(map(int, input().split()))
s=[list(map(int, input().split())) for i in range(m)]
x=max(a for a,b in s)
dp=[0]*(n+x)
for i in range(0,n+x):
if i>0:
dp[i]=min(dp[i-a]+b for a,b in s)
print((min(dp[n:]))) | import numpy as np
n,m=list(map(int,input().split()))
a=np.zeros(m,dtype=int)
b=np.zeros(m,dtype=int)
for i in range(m):
a[i],b[i]=list(map(int,input().split()))
dp=np.zeros(10001,dtype=int)
for i in range(1,10001):
dp[i]=(dp[i-a]+b).min()
print((dp[n])) | 8 | 11 | 215 | 259 | n, m = list(map(int, input().split()))
s = [list(map(int, input().split())) for i in range(m)]
x = max(a for a, b in s)
dp = [0] * (n + x)
for i in range(0, n + x):
if i > 0:
dp[i] = min(dp[i - a] + b for a, b in s)
print((min(dp[n:])))
| import numpy as np
n, m = list(map(int, input().split()))
a = np.zeros(m, dtype=int)
b = np.zeros(m, dtype=int)
for i in range(m):
a[i], b[i] = list(map(int, input().split()))
dp = np.zeros(10001, dtype=int)
for i in range(1, 10001):
dp[i] = (dp[i - a] + b).min()
print((dp[n]))
| false | 27.272727 | [
"+import numpy as np",
"+",
"-s = [list(map(int, input().split())) for i in range(m)]",
"-x = max(a for a, b in s)",
"-dp = [0] * (n + x)",
"-for i in range(0, n + x):",
"- if i > 0:",
"- dp[i] = min(dp[i - a] + b for a, b in s)",
"-print((min(dp[n:])))",
"+a = np.zeros(m, dtype=int)",
... | false | 0.137726 | 0.223127 | 0.617254 | [
"s118864264",
"s032722855"
] |
u349449706 | p03151 | python | s292043676 | s408245335 | 135 | 123 | 95,008 | 95,804 | Accepted | Accepted | 8.89 | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = sorted([A[i] - B[i] for i in range(N)])
if sum(C) < 0:
print((-1))
elif min(C) >= 0:
print((0))
else:
D = sorted([i for i in C if i > 0], reverse=True)
r = [D[0]]
for i in ran... | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = sorted([A[i] - B[i] for i in range(N)])
if sum(C) < 0:
print((-1))
elif min(C) >= 0:
print((0))
else:
D = [i for i in C if i < 0]
m = sum(D)
for i in range(N-1,-1,-1):
... | 15 | 17 | 451 | 392 | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = sorted([A[i] - B[i] for i in range(N)])
if sum(C) < 0:
print((-1))
elif min(C) >= 0:
print((0))
else:
D = sorted([i for i in C if i > 0], reverse=True)
r = [D[0]]
for i in range(len(D) -... | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = sorted([A[i] - B[i] for i in range(N)])
if sum(C) < 0:
print((-1))
elif min(C) >= 0:
print((0))
else:
D = [i for i in C if i < 0]
m = sum(D)
for i in range(N - 1, -1, -1):
m += C... | false | 11.764706 | [
"- D = sorted([i for i in C if i > 0], reverse=True)",
"- r = [D[0]]",
"- for i in range(len(D) - 1):",
"- r.append(r[i] + D[i + 1])",
"- print(",
"- (",
"- len([i for i in C if i < 0])",
"- + bisect.bisect_left(r, sum(-i for i in C if i < 0))",
"- ... | false | 0.042346 | 0.046737 | 0.906053 | [
"s292043676",
"s408245335"
] |
u644907318 | p03951 | python | s333495578 | s809856040 | 66 | 24 | 61,920 | 9,184 | Accepted | Accepted | 63.64 | N = int(eval(input()))
s = input().strip()
t = input().strip()
ind = -1
for i in range(N):
x = s[i:]
y = t[:N-i]
if x==y:
ind = i
break
if ind>=0:
print((N+i))
else:
print((2*N)) | N = int(eval(input()))
s = input().strip()
t = input().strip()
lmin = 2*N
for i in range(1,N+1):
if s[-i:]==t[:i]:
lmin = min(lmin,2*N-i)
print(lmin) | 14 | 8 | 217 | 162 | N = int(eval(input()))
s = input().strip()
t = input().strip()
ind = -1
for i in range(N):
x = s[i:]
y = t[: N - i]
if x == y:
ind = i
break
if ind >= 0:
print((N + i))
else:
print((2 * N))
| N = int(eval(input()))
s = input().strip()
t = input().strip()
lmin = 2 * N
for i in range(1, N + 1):
if s[-i:] == t[:i]:
lmin = min(lmin, 2 * N - i)
print(lmin)
| false | 42.857143 | [
"-ind = -1",
"-for i in range(N):",
"- x = s[i:]",
"- y = t[: N - i]",
"- if x == y:",
"- ind = i",
"- break",
"-if ind >= 0:",
"- print((N + i))",
"-else:",
"- print((2 * N))",
"+lmin = 2 * N",
"+for i in range(1, N + 1):",
"+ if s[-i:] == t[:i]:",
"+ ... | false | 0.038102 | 0.035936 | 1.060264 | [
"s333495578",
"s809856040"
] |
u667135132 | p02882 | python | s609364928 | s905577205 | 148 | 17 | 12,488 | 3,060 | Accepted | Accepted | 88.51 | import numpy as np
a,b,x = list(map(int,input().split()))
l = x/(a*a)
if l<=b/2.0:
f = b**2.0/(2.0*a*l)
else:
f = 2.0*(b-l)/a
ans = np.rad2deg(np.arctan(f))
print(ans) | import math
a,b,x = list(map(int,input().split()))
l = x/(a*a)
if l<=b/2.0:
f = b**2.0/(2.0*a*l)
else:
f = 2.0*(b-l)/a
ans = math.degrees(math.atan(f))
print(ans) | 13 | 13 | 191 | 186 | import numpy as np
a, b, x = list(map(int, input().split()))
l = x / (a * a)
if l <= b / 2.0:
f = b**2.0 / (2.0 * a * l)
else:
f = 2.0 * (b - l) / a
ans = np.rad2deg(np.arctan(f))
print(ans)
| import math
a, b, x = list(map(int, input().split()))
l = x / (a * a)
if l <= b / 2.0:
f = b**2.0 / (2.0 * a * l)
else:
f = 2.0 * (b - l) / a
ans = math.degrees(math.atan(f))
print(ans)
| false | 0 | [
"-import numpy as np",
"+import math",
"-ans = np.rad2deg(np.arctan(f))",
"+ans = math.degrees(math.atan(f))"
] | false | 0.730914 | 0.126649 | 5.77117 | [
"s609364928",
"s905577205"
] |
u624475441 | p03494 | python | s086276235 | s057389556 | 35 | 18 | 3,064 | 3,060 | Accepted | Accepted | 48.57 | N=int(eval(input()))
A=list(map(int,input().split()))
ans=0
while 1 not in[a%2 for a in A]:
A=[a//2 for a in A]
ans+=1
print(ans) | eval(input())
n=eval(input().replace(' ','|'))
print((len(bin(n&-n))-3)) | 7 | 3 | 131 | 66 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
while 1 not in [a % 2 for a in A]:
A = [a // 2 for a in A]
ans += 1
print(ans)
| eval(input())
n = eval(input().replace(" ", "|"))
print((len(bin(n & -n)) - 3))
| false | 57.142857 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-ans = 0",
"-while 1 not in [a % 2 for a in A]:",
"- A = [a // 2 for a in A]",
"- ans += 1",
"-print(ans)",
"+eval(input())",
"+n = eval(input().replace(\" \", \"|\"))",
"+print((len(bin(n & -n)) - 3))"
] | false | 0.0456 | 0.049339 | 0.924228 | [
"s086276235",
"s057389556"
] |
u150984829 | p00099 | python | s641331038 | s140560122 | 370 | 300 | 13,716 | 13,712 | Accepted | Accepted | 18.92 | import sys
n,q=list(map(int,input().split()))
s=[0]*-~n
w=m=0
for e in sys.stdin:
a,v=list(map(int,e.split()))
s[a]+=v
if v<0 and a==w:m=max(s);w=s.index(m)
elif s[a]>m:w,m=a,s[a]
elif s[a]==m:w=min(w,a)
print((w,m))
| import sys
def f():
w=m=0;n,q=list(map(int,input().split()));s=[0]*-~n
for e in sys.stdin:
a,v=list(map(int,e.split()));s[a]+=v
if v<0 and a==w:m=max(s);w=s.index(m)
elif s[a]>m:w,m=a,s[a]
elif s[a]==m:w=min(w,a)
print((w,m))
if'__main__'==__name__:f()
| 11 | 10 | 219 | 260 | import sys
n, q = list(map(int, input().split()))
s = [0] * -~n
w = m = 0
for e in sys.stdin:
a, v = list(map(int, e.split()))
s[a] += v
if v < 0 and a == w:
m = max(s)
w = s.index(m)
elif s[a] > m:
w, m = a, s[a]
elif s[a] == m:
w = min(w, a)
print((w, m))
| import sys
def f():
w = m = 0
n, q = list(map(int, input().split()))
s = [0] * -~n
for e in sys.stdin:
a, v = list(map(int, e.split()))
s[a] += v
if v < 0 and a == w:
m = max(s)
w = s.index(m)
elif s[a] > m:
w, m = a, s[a]
eli... | false | 9.090909 | [
"-n, q = list(map(int, input().split()))",
"-s = [0] * -~n",
"-w = m = 0",
"-for e in sys.stdin:",
"- a, v = list(map(int, e.split()))",
"- s[a] += v",
"- if v < 0 and a == w:",
"- m = max(s)",
"- w = s.index(m)",
"- elif s[a] > m:",
"- w, m = a, s[a]",
"- e... | false | 0.046319 | 0.064357 | 0.719719 | [
"s641331038",
"s140560122"
] |
u466917094 | p03291 | python | s684718314 | s407817383 | 1,819 | 1,562 | 20,768 | 18,624 | Accepted | Accepted | 14.13 | import numpy as np
s=eval(input())
A=np.array([0,0,0,0])
B=np.array([0,0,0,0])
C=np.array([0,0,0,0])
t=0
for c in s:
if c=="A":
A[0]+=1
if c=="B":
B+=A
if c=='C':
C+=B
if c=='?':
C[1]+=B[0]
C[2]+=B[1]
C[3]+=B[2]
B[1]+=A[0]
B[2]+=A[1]
A[1]+=1
t+=1
ans=0
for i in range(4):
... | import numpy as np
s=eval(input())
A=np.array([0,0,0,0])
B=np.array([0,0,0,0])
C=np.array([0,0,0,0])
t=0
for c in s:
if c=="A":
A[0]+=1
if c=="B":
B+=A
if c=='C':
C+=B
if c=='?':
C+=np.roll(B,1)
B[1]+=A[0]
B[2]+=A[1]
A[1]+=1
t+=1
ans=0
for i in range(4):
ans+=pow(3,t-i)*C[i]
p... | 25 | 23 | 362 | 339 | import numpy as np
s = eval(input())
A = np.array([0, 0, 0, 0])
B = np.array([0, 0, 0, 0])
C = np.array([0, 0, 0, 0])
t = 0
for c in s:
if c == "A":
A[0] += 1
if c == "B":
B += A
if c == "C":
C += B
if c == "?":
C[1] += B[0]
C[2] += B[1]
C[3] += B[2]
... | import numpy as np
s = eval(input())
A = np.array([0, 0, 0, 0])
B = np.array([0, 0, 0, 0])
C = np.array([0, 0, 0, 0])
t = 0
for c in s:
if c == "A":
A[0] += 1
if c == "B":
B += A
if c == "C":
C += B
if c == "?":
C += np.roll(B, 1)
B[1] += A[0]
B[2] += A[1... | false | 8 | [
"- C[1] += B[0]",
"- C[2] += B[1]",
"- C[3] += B[2]",
"+ C += np.roll(B, 1)"
] | false | 0.338026 | 0.186037 | 1.81698 | [
"s684718314",
"s407817383"
] |
u352394527 | p00454 | python | s733355738 | s895764420 | 2,730 | 940 | 25,332 | 21,832 | Accepted | Accepted | 65.57 | import sys
sys.setrecursionlimit(100000000)
while True:
w, h = list(map(int, input().split()))
if not w:
break
n = int(eval(input()))
xlst = [0, w - 1]
ylst = [0, h - 1]
plst = []
for i in range(n):
x1, y1, x2, y2 = list(map(int, input().split()))
plst.append([x1,y1,x2 - ... | def main():
while True:
w, h = list(map(int, input().split()))
if not w:
break
n = int(eval(input()))
xlst = [0, w - 1]
ylst = [0, h - 1]
plst = []
for i in range(n):
x1, y1, x2, y2 = list(map(int, input().split()))
plst.append([x1,y1,x2 - 1,y2 - 1]... | 78 | 69 | 1,854 | 1,705 | import sys
sys.setrecursionlimit(100000000)
while True:
w, h = list(map(int, input().split()))
if not w:
break
n = int(eval(input()))
xlst = [0, w - 1]
ylst = [0, h - 1]
plst = []
for i in range(n):
x1, y1, x2, y2 = list(map(int, input().split()))
plst.append([x1, y1... | def main():
while True:
w, h = list(map(int, input().split()))
if not w:
break
n = int(eval(input()))
xlst = [0, w - 1]
ylst = [0, h - 1]
plst = []
for i in range(n):
x1, y1, x2, y2 = list(map(int, input().split()))
plst.app... | false | 11.538462 | [
"-import sys",
"+def main():",
"+ while True:",
"+ w, h = list(map(int, input().split()))",
"+ if not w:",
"+ break",
"+ n = int(eval(input()))",
"+ xlst = [0, w - 1]",
"+ ylst = [0, h - 1]",
"+ plst = []",
"+ for i in range(n):",
... | false | 0.039371 | 0.039423 | 0.99868 | [
"s733355738",
"s895764420"
] |
u477320129 | p03546 | python | s802549487 | s919282979 | 37 | 33 | 3,316 | 3,316 | Accepted | Accepted | 10.81 | #!/usr/bin/env python3
import sys
def solve(H: int, W: int, c: "List[List[int]]", A: "List[List[int]]"):
#print(*c, sep='\n')
for _ in range(10):
for i in range(10):
for j in range(10):
for k in range(10):
c[i][j] = min(c[i][j], c[i][k]+c[k][j]... | #!/usr/bin/env python3
import sys
def solve(H: int, W: int, c: "List[List[int]]", A: "List[List[int]]"):
#print(*c, sep='\n')
for k in range(10):
for i in range(10):
for j in range(10):
c[i][j] = min(c[i][j], c[i][k]+c[k][j])
#print(*c, sep='\n')
cost = 0... | 41 | 40 | 1,170 | 1,129 | #!/usr/bin/env python3
import sys
def solve(H: int, W: int, c: "List[List[int]]", A: "List[List[int]]"):
# print(*c, sep='\n')
for _ in range(10):
for i in range(10):
for j in range(10):
for k in range(10):
c[i][j] = min(c[i][j], c[i][k] + c[k][j])
#... | #!/usr/bin/env python3
import sys
def solve(H: int, W: int, c: "List[List[int]]", A: "List[List[int]]"):
# print(*c, sep='\n')
for k in range(10):
for i in range(10):
for j in range(10):
c[i][j] = min(c[i][j], c[i][k] + c[k][j])
# print(*c, sep='\n')
cost = 0
fo... | false | 2.439024 | [
"- for _ in range(10):",
"+ for k in range(10):",
"- for k in range(10):",
"- c[i][j] = min(c[i][j], c[i][k] + c[k][j])",
"+ c[i][j] = min(c[i][j], c[i][k] + c[k][j])"
] | false | 0.043149 | 0.036117 | 1.194679 | [
"s802549487",
"s919282979"
] |
u677440371 | p03353 | python | s482152181 | s965201407 | 42 | 36 | 5,068 | 5,068 | Accepted | Accepted | 14.29 | s = str(eval(input()))
k = int(eval(input()))
check = []
a = min(len(s),k)
for i in range(len(s)):
for j in range(a):
if i <= i+j <=len(s)+1:
check.append(s[i:i+j+1])
print((sorted(set(check))[k-1])) | s = str(eval(input()))
k = int(eval(input()))
check = []
for i in range(len(s)):
for j in range(k):
check.append(s[i:i+j+1])
print((sorted(list(set(check)))[k-1])) | 11 | 9 | 233 | 179 | s = str(eval(input()))
k = int(eval(input()))
check = []
a = min(len(s), k)
for i in range(len(s)):
for j in range(a):
if i <= i + j <= len(s) + 1:
check.append(s[i : i + j + 1])
print((sorted(set(check))[k - 1]))
| s = str(eval(input()))
k = int(eval(input()))
check = []
for i in range(len(s)):
for j in range(k):
check.append(s[i : i + j + 1])
print((sorted(list(set(check)))[k - 1]))
| false | 18.181818 | [
"-a = min(len(s), k)",
"- for j in range(a):",
"- if i <= i + j <= len(s) + 1:",
"- check.append(s[i : i + j + 1])",
"-print((sorted(set(check))[k - 1]))",
"+ for j in range(k):",
"+ check.append(s[i : i + j + 1])",
"+print((sorted(list(set(check)))[k - 1]))"
] | false | 0.039167 | 0.038461 | 1.018372 | [
"s482152181",
"s965201407"
] |
u757117214 | p02766 | python | s091187768 | s555704476 | 41 | 18 | 3,060 | 2,940 | Accepted | Accepted | 56.1 | def func(x,n):
if int(x/n):
return func(int(x/n),n)+str(x%n)
return str(x%n)
N,K=list(map(int,input().split()))
print((len(func(N,K)))) | N,K = list(map(int,input().split()))
cnt = 0
while N > 0:
N //= K
cnt += 1
print(cnt) | 7 | 6 | 154 | 92 | def func(x, n):
if int(x / n):
return func(int(x / n), n) + str(x % n)
return str(x % n)
N, K = list(map(int, input().split()))
print((len(func(N, K))))
| N, K = list(map(int, input().split()))
cnt = 0
while N > 0:
N //= K
cnt += 1
print(cnt)
| false | 14.285714 | [
"-def func(x, n):",
"- if int(x / n):",
"- return func(int(x / n), n) + str(x % n)",
"- return str(x % n)",
"-",
"-",
"-print((len(func(N, K))))",
"+cnt = 0",
"+while N > 0:",
"+ N //= K",
"+ cnt += 1",
"+print(cnt)"
] | false | 0.094193 | 0.075189 | 1.252745 | [
"s091187768",
"s555704476"
] |
u923668099 | p02277 | python | s633357206 | s662837561 | 1,280 | 1,130 | 23,628 | 23,528 | Accepted | Accepted | 11.72 | from collections import namedtuple
Card = namedtuple('Card', ['suit', 'value', 'init'])
def QuickSort(A, begin, end):
if end - begin <= 1:
return
piv = A[end - 1].value
left, right = begin, begin
for i in range(begin, end - 1):
if A[i].value <= piv:
if i - le... | from sys import stdin
from collections import namedtuple
Card = namedtuple('Card', ['suit', 'value', 'init'])
def QuickSort(A, begin, end):
if end - begin <= 1:
return
piv = A[end - 1].value
left, right = begin, begin
for i in range(begin, end - 1):
if A[i].value <= piv:... | 42 | 41 | 890 | 915 | from collections import namedtuple
Card = namedtuple("Card", ["suit", "value", "init"])
def QuickSort(A, begin, end):
if end - begin <= 1:
return
piv = A[end - 1].value
left, right = begin, begin
for i in range(begin, end - 1):
if A[i].value <= piv:
if i - left > 0:
... | from sys import stdin
from collections import namedtuple
Card = namedtuple("Card", ["suit", "value", "init"])
def QuickSort(A, begin, end):
if end - begin <= 1:
return
piv = A[end - 1].value
left, right = begin, begin
for i in range(begin, end - 1):
if A[i].value <= piv:
i... | false | 2.380952 | [
"+from sys import stdin",
"-n = int(eval(input()))",
"-A = []",
"+n = int(stdin.readline())",
"+A = [None] * n",
"- suit, value = input().split()",
"- value = int(value)",
"- A.append(Card(suit, value, i))",
"+ suit, value = stdin.readline().split()",
"+ A[i] = Card(suit, int(value)... | false | 0.046103 | 0.049155 | 0.937921 | [
"s633357206",
"s662837561"
] |
u298297089 | p02873 | python | s310389562 | s348816102 | 220 | 120 | 6,300 | 11,860 | Accepted | Accepted | 45.45 | # for c in '03210120123452101':
# 3 2 5 2
s = eval(input())
lst = []
tmp = ''
cnt = 1
for c in s:
if tmp == c:
cnt += 1
else :
lst.append(cnt)
cnt = 1
tmp = c
lst.append(cnt)
ans = 0
if s[0] == '<':
idx = 1
else:
idx = 0
if (len(lst) - idx ) % 2 == 1:
... | def run_length(data, init=''):
length = []
tmp = init
cnt = 0
for c in data:
if tmp != c:
length.append(cnt)
cnt = 0
tmp = c
cnt += 1
length.append(cnt)
return length
def resolve():
s = eval(input())
if s[0] != '<':
... | 37 | 34 | 726 | 735 | # for c in '03210120123452101':
# 3 2 5 2
s = eval(input())
lst = []
tmp = ""
cnt = 1
for c in s:
if tmp == c:
cnt += 1
else:
lst.append(cnt)
cnt = 1
tmp = c
lst.append(cnt)
ans = 0
if s[0] == "<":
idx = 1
else:
idx = 0
if (len(lst) - idx) % 2 == 1:
lst.append(1)
for i in... | def run_length(data, init=""):
length = []
tmp = init
cnt = 0
for c in data:
if tmp != c:
length.append(cnt)
cnt = 0
tmp = c
cnt += 1
length.append(cnt)
return length
def resolve():
s = eval(input())
if s[0] != "<":
s = "<" + s
... | false | 8.108108 | [
"-# for c in '03210120123452101':",
"-# 3 2 5 2",
"-s = eval(input())",
"-lst = []",
"-tmp = \"\"",
"-cnt = 1",
"-for c in s:",
"- if tmp == c:",
"+def run_length(data, init=\"\"):",
"+ length = []",
"+ tmp = init",
"+ cnt = 0",
"+ for c in data:",
"+ if tmp != c:",
... | false | 0.08529 | 0.047497 | 1.795684 | [
"s310389562",
"s348816102"
] |
u418149936 | p02837 | python | s550223447 | s487504407 | 276 | 250 | 9,196 | 9,128 | Accepted | Accepted | 9.42 | N = int(eval(input()))
testimo_ls = [ [] for i in range(N) ]
rst = 0
for i in range(N):
A = int(eval(input()))
for j in range(A):
x, y = list(map(int, input().split(' ')))
testimo_ls[i].append([x - 1, y])
for i in range(1 << N):
honest_ls = []
for j in range(N):
if i >... | N = int(eval(input()))
testimo_ls = [ [] for i in range(N) ]
rst = 0
for i in range(N):
A = int(eval(input()))
for j in range(A):
x, y = list(map(int, input().split(' ')))
testimo_ls[i].append([x - 1, y])
for i in range(1 << N):
honest_ls = []
for j in range(N):
if i >... | 25 | 25 | 696 | 696 | N = int(eval(input()))
testimo_ls = [[] for i in range(N)]
rst = 0
for i in range(N):
A = int(eval(input()))
for j in range(A):
x, y = list(map(int, input().split(" ")))
testimo_ls[i].append([x - 1, y])
for i in range(1 << N):
honest_ls = []
for j in range(N):
if i >> j & 1:
... | N = int(eval(input()))
testimo_ls = [[] for i in range(N)]
rst = 0
for i in range(N):
A = int(eval(input()))
for j in range(A):
x, y = list(map(int, input().split(" ")))
testimo_ls[i].append([x - 1, y])
for i in range(1 << N):
honest_ls = []
for j in range(N):
if i >> j & 1:
... | false | 0 | [
"- if t[0] not in honest_ls and t[1] == 1:",
"+ if t[1] == 0 and t[0] in honest_ls:",
"- if t[0] in honest_ls and t[1] == 0:",
"+ if t[1] == 1 and t[0] not in honest_ls:"
] | false | 0.035216 | 0.042051 | 0.837476 | [
"s550223447",
"s487504407"
] |
u312025627 | p03610 | python | s229725445 | s020113354 | 168 | 18 | 39,536 | 3,188 | Accepted | Accepted | 89.29 | s = eval(input())
print((s[0::2])) | def main():
S = eval(input())
print((S[0::2]))
if __name__ == '__main__':
main()
| 2 | 7 | 27 | 93 | s = eval(input())
print((s[0::2]))
| def main():
S = eval(input())
print((S[0::2]))
if __name__ == "__main__":
main()
| false | 71.428571 | [
"-s = eval(input())",
"-print((s[0::2]))",
"+def main():",
"+ S = eval(input())",
"+ print((S[0::2]))",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ main()"
] | false | 0.089333 | 0.047714 | 1.872282 | [
"s229725445",
"s020113354"
] |
u102461423 | p03767 | python | s163855796 | s579357980 | 197 | 131 | 31,500 | 37,400 | Accepted | Accepted | 33.5 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,*A = list(map(int,read().split()))
A.sort()
answer = sum(A[N::2])
print(answer) | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *A = list(map(int, read().split()))
A.sort()
x = sum(A[N::2])
print(x) | 10 | 10 | 202 | 194 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *A = list(map(int, read().split()))
A.sort()
answer = sum(A[N::2])
print(answer)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *A = list(map(int, read().split()))
A.sort()
x = sum(A[N::2])
print(x)
| false | 0 | [
"-answer = sum(A[N::2])",
"-print(answer)",
"+x = sum(A[N::2])",
"+print(x)"
] | false | 0.035614 | 0.043842 | 0.812308 | [
"s163855796",
"s579357980"
] |
u263830634 | p03524 | python | s762659195 | s116683674 | 42 | 26 | 3,956 | 4,340 | Accepted | Accepted | 38.1 | S = list(eval(input()))
lst = [0] * 3
for s in S:
if s == 'a':
lst[0] += 1
elif s == 'b':
lst[1] += 1
elif s == 'c':
lst[2] += 1
if max(abs(lst[0] - lst[1]), abs(lst[1] - lst[2]), abs(lst[2] - lst[0])) >= 2:
print ('NO')
else:
print ('YES') | from collections import Counter
lst = list(eval(input()))
c = Counter(lst)
A = c['a']
B = c['b']
C = c['c']
if max(max(A, B), C) - min(min(A, B), C) <= 1:
print ('YES')
else:
print ('NO') | 15 | 14 | 294 | 206 | S = list(eval(input()))
lst = [0] * 3
for s in S:
if s == "a":
lst[0] += 1
elif s == "b":
lst[1] += 1
elif s == "c":
lst[2] += 1
if max(abs(lst[0] - lst[1]), abs(lst[1] - lst[2]), abs(lst[2] - lst[0])) >= 2:
print("NO")
else:
print("YES")
| from collections import Counter
lst = list(eval(input()))
c = Counter(lst)
A = c["a"]
B = c["b"]
C = c["c"]
if max(max(A, B), C) - min(min(A, B), C) <= 1:
print("YES")
else:
print("NO")
| false | 6.666667 | [
"-S = list(eval(input()))",
"-lst = [0] * 3",
"-for s in S:",
"- if s == \"a\":",
"- lst[0] += 1",
"- elif s == \"b\":",
"- lst[1] += 1",
"- elif s == \"c\":",
"- lst[2] += 1",
"-if max(abs(lst[0] - lst[1]), abs(lst[1] - lst[2]), abs(lst[2] - lst[0])) >= 2:",
"+from... | false | 0.037122 | 0.038753 | 0.9579 | [
"s762659195",
"s116683674"
] |
u759412327 | p02791 | python | s061827350 | s342226029 | 119 | 88 | 32,376 | 32,380 | Accepted | Accepted | 26.05 | N = int(eval(input()))
P = list(map(int,input().split()))
a = 0
s = 10**6
for p in P:
if p<s:
a+=1
s = min(s,p)
print(a) | N = int(eval(input()))
P = list(map(int,input().split()))
a = 0
s = 10**6
for p in P:
if p<s:
a+=1
s=p
print(a) | 11 | 11 | 134 | 127 | N = int(eval(input()))
P = list(map(int, input().split()))
a = 0
s = 10**6
for p in P:
if p < s:
a += 1
s = min(s, p)
print(a)
| N = int(eval(input()))
P = list(map(int, input().split()))
a = 0
s = 10**6
for p in P:
if p < s:
a += 1
s = p
print(a)
| false | 0 | [
"- s = min(s, p)",
"+ s = p"
] | false | 0.040819 | 0.036691 | 1.112491 | [
"s061827350",
"s342226029"
] |
u057109575 | p02762 | python | s723920895 | s727207227 | 1,287 | 698 | 117,336 | 143,236 | Accepted | Accepted | 45.77 | from collections import deque, Counter
N, M, K = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
CD = [list(map(int, input().split())) for _ in range(K)]
def dfs(s, c):
"""
s: node
c: number
"""
q = deque()
q.append(s)
visited[s] = Tr... |
class UnionFind:
def __init__(self, n):
self.par = list(range(n))
self.rank = [0] * n
self.size = [1] * n
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
return self.par[x]
... | 55 | 62 | 1,119 | 1,397 | from collections import deque, Counter
N, M, K = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
CD = [list(map(int, input().split())) for _ in range(K)]
def dfs(s, c):
"""
s: node
c: number
"""
q = deque()
q.append(s)
visited[s] = True
color[s... | class UnionFind:
def __init__(self, n):
self.par = list(range(n))
self.rank = [0] * n
self.size = [1] * n
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
return self.par[x]
def unite(sel... | false | 11.290323 | [
"-from collections import deque, Counter",
"+class UnionFind:",
"+ def __init__(self, n):",
"+ self.par = list(range(n))",
"+ self.rank = [0] * n",
"+ self.size = [1] * n",
"+",
"+ def find(self, x):",
"+ if self.par[x] == x:",
"+ return x",
"+ ... | false | 0.043768 | 0.037171 | 1.177468 | [
"s723920895",
"s727207227"
] |
u607563136 | p02596 | python | s444115595 | s405067634 | 1,528 | 981 | 9,176 | 9,168 | Accepted | Accepted | 35.8 | import sys
k = int(eval(input()))
a =7%k
if a == 0:
print((1))
sys.exit()
for i in range(2,10**7):
a = (10*a+7) % k
if a == 0:
print(i)
sys.exit()
print((-1)) | import sys
def main():
k = int(eval(input()))
a =7%k
if a == 0:
print((1))
sys.exit()
for i in range(2,10**7):
a = (10*a+7) % k
if a == 0:
print(i)
sys.exit()
print((-1))
main() | 16 | 18 | 203 | 268 | import sys
k = int(eval(input()))
a = 7 % k
if a == 0:
print((1))
sys.exit()
for i in range(2, 10**7):
a = (10 * a + 7) % k
if a == 0:
print(i)
sys.exit()
print((-1))
| import sys
def main():
k = int(eval(input()))
a = 7 % k
if a == 0:
print((1))
sys.exit()
for i in range(2, 10**7):
a = (10 * a + 7) % k
if a == 0:
print(i)
sys.exit()
print((-1))
main()
| false | 11.111111 | [
"-k = int(eval(input()))",
"-a = 7 % k",
"-if a == 0:",
"- print((1))",
"- sys.exit()",
"-for i in range(2, 10**7):",
"- a = (10 * a + 7) % k",
"+",
"+def main():",
"+ k = int(eval(input()))",
"+ a = 7 % k",
"- print(i)",
"+ print((1))",
"-print((-1))",
"+ ... | false | 0.298124 | 1.100333 | 0.27094 | [
"s444115595",
"s405067634"
] |
u761320129 | p04034 | python | s430837035 | s087065321 | 355 | 241 | 18,120 | 24,060 | Accepted | Accepted | 32.11 | N,M = list(map(int,input().split()))
XY = [tuple(map(int,input().split())) for i in range(M)]
rs = [0] * N
rs[0] = 1
cs = [1] * N
for x,y in XY:
x,y = x-1,y-1
if rs[x]:
if cs[x]==1:
rs[x] = 0
rs[y] = 1
cs[x] -= 1
cs[y] += 1
print((sum(rs))) | N,M = list(map(int,input().split()))
XY = [tuple(map(int,input().split())) for i in range(M)]
may_red = [0] * N
may_red[0] = 1
balls = [1] * N
for x,y in XY:
x,y = x-1,y-1
if may_red[x]:
may_red[y] = 1
if balls[x] == 1:
may_red[x] = 0
balls[x] -= 1
balls[y] +=... | 15 | 16 | 291 | 337 | N, M = list(map(int, input().split()))
XY = [tuple(map(int, input().split())) for i in range(M)]
rs = [0] * N
rs[0] = 1
cs = [1] * N
for x, y in XY:
x, y = x - 1, y - 1
if rs[x]:
if cs[x] == 1:
rs[x] = 0
rs[y] = 1
cs[x] -= 1
cs[y] += 1
print((sum(rs)))
| N, M = list(map(int, input().split()))
XY = [tuple(map(int, input().split())) for i in range(M)]
may_red = [0] * N
may_red[0] = 1
balls = [1] * N
for x, y in XY:
x, y = x - 1, y - 1
if may_red[x]:
may_red[y] = 1
if balls[x] == 1:
may_red[x] = 0
balls[x] -= 1
balls[y] += 1
pri... | false | 6.25 | [
"-rs = [0] * N",
"-rs[0] = 1",
"-cs = [1] * N",
"+may_red = [0] * N",
"+may_red[0] = 1",
"+balls = [1] * N",
"- if rs[x]:",
"- if cs[x] == 1:",
"- rs[x] = 0",
"- rs[y] = 1",
"- cs[x] -= 1",
"- cs[y] += 1",
"-print((sum(rs)))",
"+ if may_red[x]:",
"+ ... | false | 0.040521 | 0.037193 | 1.089484 | [
"s430837035",
"s087065321"
] |
u423966555 | p02791 | python | s410615898 | s235106663 | 129 | 92 | 24,744 | 24,744 | Accepted | Accepted | 28.68 | n = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
min_p = P[0]
for p in P:
if p <= min_p:
ans += 1
min_p = min(min_p, p)
print(ans)
| n = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
min_p = P[0]
for p in P:
if p <= min_p:
ans += 1
min_p = p
print(ans)
| 11 | 11 | 175 | 163 | n = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
min_p = P[0]
for p in P:
if p <= min_p:
ans += 1
min_p = min(min_p, p)
print(ans)
| n = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
min_p = P[0]
for p in P:
if p <= min_p:
ans += 1
min_p = p
print(ans)
| false | 0 | [
"- min_p = min(min_p, p)",
"+ min_p = p"
] | false | 0.046092 | 0.045866 | 1.004944 | [
"s410615898",
"s235106663"
] |
u408620326 | p03633 | python | s163260458 | s113853887 | 21 | 17 | 3,316 | 3,060 | Accepted | Accepted | 19.05 | from collections import deque
N = int(eval(input()))
T = list(set([int(eval(input())) for _ in range(N)]))
ret = T[0]
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
for t in T[1:]:
ret = ret * t // gcd(ret, t)
print(ret) | import sys
input = sys.stdin.readline
N = int(eval(input()))
def gcd(x, y):
if y == 0:
return x
return gcd(y, x % y)
def lcm(x, y):
return x * y // gcd(x, y)
T = int(eval(input()))
for i in range(N-1):
T_ = int(eval(input()))
T = lcm(T, T_)
print(T) | 15 | 18 | 256 | 280 | from collections import deque
N = int(eval(input()))
T = list(set([int(eval(input())) for _ in range(N)]))
ret = T[0]
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
for t in T[1:]:
ret = ret * t // gcd(ret, t)
print(ret)
| import sys
input = sys.stdin.readline
N = int(eval(input()))
def gcd(x, y):
if y == 0:
return x
return gcd(y, x % y)
def lcm(x, y):
return x * y // gcd(x, y)
T = int(eval(input()))
for i in range(N - 1):
T_ = int(eval(input()))
T = lcm(T, T_)
print(T)
| false | 16.666667 | [
"-from collections import deque",
"+import sys",
"+input = sys.stdin.readline",
"-T = list(set([int(eval(input())) for _ in range(N)]))",
"-ret = T[0]",
"-def gcd(a, b):",
"- if b == 0:",
"- return a",
"- else:",
"- return gcd(b, a % b)",
"+def gcd(x, y):",
"+ if y == 0:... | false | 0.046477 | 0.041661 | 1.11559 | [
"s163260458",
"s113853887"
] |
u588341295 | p02788 | python | s412309802 | s416857411 | 1,090 | 849 | 104,256 | 98,112 | Accepted | Accepted | 22.11 | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_right
from operator import itemgetter
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):... | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_right
from operator import itemgetter
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):... | 82 | 46 | 2,096 | 1,181 | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_right
from operator import itemgetter
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, ... | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_right
from operator import itemgetter
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, ... | false | 43.902439 | [
"- return int(input())",
"+ return int(eval(input()))",
"- return map(int, input().split())",
"+ return list(map(int, input().split()))",
"-",
"-",
"-class BIT2:",
"- \"\"\"区間加算BIT(区間加算・区間合計取得)\"\"\"",
"-",
"- def __init__(self, N):",
"- # 添字0が使えないので、内部的には全て1-indexedとして扱... | false | 0.045685 | 0.042615 | 1.072044 | [
"s412309802",
"s416857411"
] |
u716530146 | p03262 | python | s591177303 | s237119859 | 144 | 123 | 16,236 | 14,588 | Accepted | Accepted | 14.58 | #!/usr/bin/env python3
from bisect import insort_left
from fractions import gcd
def lcm(m,n):
return (m*n)//gcd(m,n)
n,X=list(map(int,input().split()))
x=list(map(int,input().split()))
x.append(X)
x.sort()
g=x[1]-x[0]
for i in range(n):
g=gcd(g,x[i+1]-x[i])
print(g)
| #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n,x = list(map(int,input().split()))
X = list(map(int,input().split()))
X.append(x)
X.sort()
d... | 13 | 23 | 281 | 523 | #!/usr/bin/env python3
from bisect import insort_left
from fractions import gcd
def lcm(m, n):
return (m * n) // gcd(m, n)
n, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x.append(X)
x.sort()
g = x[1] - x[0]
for i in range(n):
g = gcd(g, x[i + 1] - x[i])
print(g)
| #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n, x = list(map(int, input().split()))
X = list(map(int, input().split()))
X.append(x)
X.sort()
def gcd(... | false | 43.478261 | [
"-from bisect import insort_left",
"-from fractions import gcd",
"+import sys, math, itertools, collections, bisect",
"+",
"+input = lambda: sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")",
"+inf = float(\"inf\")",
"+mod = 10**9 + 7",
"+mans = inf",
"+ans = 0",
"+count = 0",
"+pro = 1",
... | false | 0.050489 | 0.041393 | 1.219735 | [
"s591177303",
"s237119859"
] |
u893063840 | p02744 | python | s628135476 | s497286223 | 163 | 127 | 14,784 | 14,464 | Accepted | Accepted | 22.09 | n = int(input())
lets = [chr(i) for i in range(ord("a"), ord("a") + n)]
d = {e: i for i, e in enumerate(lets)}
s = ["a"]
for i in range(1, n):
nxt = []
for e in s:
mx = 0
for l in e:
mx = max(mx, d[l])
for j in range(mx + 2):
nxt.append(e + lets[j])
... | n = int(input())
lets = [chr(i) for i in range(ord("a"), ord("z") + 1)]
ans = []
def dfs(s, l, mx):
if l == n:
ans.append(s)
return
for i in range(mx + 2):
dfs(s + lets[i], l + 1, max(mx, i))
dfs("", 0, -1)
print(*ans, sep="\n")
| 16 | 17 | 355 | 283 | n = int(input())
lets = [chr(i) for i in range(ord("a"), ord("a") + n)]
d = {e: i for i, e in enumerate(lets)}
s = ["a"]
for i in range(1, n):
nxt = []
for e in s:
mx = 0
for l in e:
mx = max(mx, d[l])
for j in range(mx + 2):
nxt.append(e + lets[j])
s = nxt
pr... | n = int(input())
lets = [chr(i) for i in range(ord("a"), ord("z") + 1)]
ans = []
def dfs(s, l, mx):
if l == n:
ans.append(s)
return
for i in range(mx + 2):
dfs(s + lets[i], l + 1, max(mx, i))
dfs("", 0, -1)
print(*ans, sep="\n")
| false | 5.882353 | [
"-lets = [chr(i) for i in range(ord(\"a\"), ord(\"a\") + n)]",
"-d = {e: i for i, e in enumerate(lets)}",
"-s = [\"a\"]",
"-for i in range(1, n):",
"- nxt = []",
"- for e in s:",
"- mx = 0",
"- for l in e:",
"- mx = max(mx, d[l])",
"- for j in range(mx + 2):",... | false | 0.049358 | 0.04891 | 1.009171 | [
"s628135476",
"s497286223"
] |
u627234757 | p02975 | python | s124731616 | s020483479 | 664 | 52 | 14,212 | 14,704 | Accepted | Accepted | 92.17 | N = int(eval(input()))
A = list(map(int, input().split()))
for i in range(N):
A[i] = bin(A[i])
max_len = len(A[N-1]) - 2
for i in range(N):
A[i] = A[i][2:].zfill(max_len)
check = True
for i in range(max_len):
count0 = 0
count1 = 0
for j in range(N):
if(A[j][i] == '0'):
count0 += 1
... | n = int(eval(input()))
nums = list(map(int, input().split()))
#set型にしてからlistにキャストすることで,複数存在するものを省いている
unq = list(set(nums))
#違う数字が4個以上存在したら,正しい答えは存在しない
if len(unq) > 3:
print("No")
if len(unq) == 3:
#list,unqをアンパックしてa,b,cにいれている
a,b,c = unq
if a ^ b ^ c == 0:
if nums.count(a) == nums.c... | 27 | 36 | 506 | 721 | N = int(eval(input()))
A = list(map(int, input().split()))
for i in range(N):
A[i] = bin(A[i])
max_len = len(A[N - 1]) - 2
for i in range(N):
A[i] = A[i][2:].zfill(max_len)
check = True
for i in range(max_len):
count0 = 0
count1 = 0
for j in range(N):
if A[j][i] == "0":
count0 +=... | n = int(eval(input()))
nums = list(map(int, input().split()))
# set型にしてからlistにキャストすることで,複数存在するものを省いている
unq = list(set(nums))
# 違う数字が4個以上存在したら,正しい答えは存在しない
if len(unq) > 3:
print("No")
if len(unq) == 3:
# list,unqをアンパックしてa,b,cにいれている
a, b, c = unq
if a ^ b ^ c == 0:
if nums.count(a) == nums.count(b... | false | 25 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-for i in range(N):",
"- A[i] = bin(A[i])",
"-max_len = len(A[N - 1]) - 2",
"-for i in range(N):",
"- A[i] = A[i][2:].zfill(max_len)",
"-check = True",
"-for i in range(max_len):",
"- count0 = 0",
"- count1 = 0",
"... | false | 0.103195 | 0.043645 | 2.364402 | [
"s124731616",
"s020483479"
] |
u077898957 | p02910 | python | s100735696 | s842584143 | 20 | 18 | 3,060 | 3,064 | Accepted | Accepted | 10 | s = eval(input())
x = sorted(set(s[::2]))
y = sorted(set(s[1::2]))
countx = 0
county = 0
for i in x:
if i in 'RDU':
countx += 1
for i in y:
if i in 'LDU':
county += 1
print(('Yes' if countx==len(x) and county==len(y) else 'No'))
| s=eval(input())
ans='Yes'
for i in range(len(s)):
if i%2==0:
if s[i]=='L':
ans='No'
break
else:
if s[i]=='R':
ans='No'
break
print(ans) | 12 | 12 | 256 | 212 | s = eval(input())
x = sorted(set(s[::2]))
y = sorted(set(s[1::2]))
countx = 0
county = 0
for i in x:
if i in "RDU":
countx += 1
for i in y:
if i in "LDU":
county += 1
print(("Yes" if countx == len(x) and county == len(y) else "No"))
| s = eval(input())
ans = "Yes"
for i in range(len(s)):
if i % 2 == 0:
if s[i] == "L":
ans = "No"
break
else:
if s[i] == "R":
ans = "No"
break
print(ans)
| false | 0 | [
"-x = sorted(set(s[::2]))",
"-y = sorted(set(s[1::2]))",
"-countx = 0",
"-county = 0",
"-for i in x:",
"- if i in \"RDU\":",
"- countx += 1",
"-for i in y:",
"- if i in \"LDU\":",
"- county += 1",
"-print((\"Yes\" if countx == len(x) and county == len(y) else \"No\"))",
"+a... | false | 0.042084 | 0.100422 | 0.41907 | [
"s100735696",
"s842584143"
] |
u013513417 | p02779 | python | s429826727 | s414294605 | 184 | 112 | 26,812 | 33,612 | Accepted | Accepted | 39.13 | N=int(eval(input()))
S=list(map(int,input().split()))
S.sort()
banpei=0
for i in range(N):
if banpei==S[i]:
print("NO")
exit()
else:
banpei=S[i]
print("YES") | N=int(eval(input()))
S=list(map(int,input().split()))
dic={}
for i in range(N):
dic[S[i]]=1
if len(dic)==N:
print("YES")
else:
print("NO") | 13 | 10 | 201 | 154 | N = int(eval(input()))
S = list(map(int, input().split()))
S.sort()
banpei = 0
for i in range(N):
if banpei == S[i]:
print("NO")
exit()
else:
banpei = S[i]
print("YES")
| N = int(eval(input()))
S = list(map(int, input().split()))
dic = {}
for i in range(N):
dic[S[i]] = 1
if len(dic) == N:
print("YES")
else:
print("NO")
| false | 23.076923 | [
"-S.sort()",
"-banpei = 0",
"+dic = {}",
"- if banpei == S[i]:",
"- print(\"NO\")",
"- exit()",
"- else:",
"- banpei = S[i]",
"-print(\"YES\")",
"+ dic[S[i]] = 1",
"+if len(dic) == N:",
"+ print(\"YES\")",
"+else:",
"+ print(\"NO\")"
] | false | 0.034574 | 0.035895 | 0.963208 | [
"s429826727",
"s414294605"
] |
u190405389 | p03201 | python | s083548002 | s560989374 | 595 | 404 | 112,980 | 113,492 | Accepted | Accepted | 32.1 | import bisect
n = int(eval(input()))
aa = list(map(int,input().split()))
aa.sort()
a = [aa[0]]
b = [1]
for i in range(1,n):
if a[-1]==aa[i]:
b[-1]+=1
else:
a.append(aa[i])
b.append(1)
ans = 0
for i in range(len(a)):
while b[-i-1]!=0:
c = 2**(len(bin... | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
c = Counter(a)
ans = 0
for x in a[::-1]:
if c[x]>0:
c[x]-=1
y = 2**x.bit_length()-x
if c[y]>0:
c[y]-=1
ans += 1
print(ans) | 38 | 17 | 719 | 287 | import bisect
n = int(eval(input()))
aa = list(map(int, input().split()))
aa.sort()
a = [aa[0]]
b = [1]
for i in range(1, n):
if a[-1] == aa[i]:
b[-1] += 1
else:
a.append(aa[i])
b.append(1)
ans = 0
for i in range(len(a)):
while b[-i - 1] != 0:
c = 2 ** (len(bin(a[-i - 1])) -... | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
c = Counter(a)
ans = 0
for x in a[::-1]:
if c[x] > 0:
c[x] -= 1
y = 2 ** x.bit_length() - x
if c[y] > 0:
c[y] -= 1
ans += 1
print(ans)
| false | 55.263158 | [
"-import bisect",
"+from collections import Counter",
"-aa = list(map(int, input().split()))",
"-aa.sort()",
"-a = [aa[0]]",
"-b = [1]",
"-for i in range(1, n):",
"- if a[-1] == aa[i]:",
"- b[-1] += 1",
"- else:",
"- a.append(aa[i])",
"- b.append(1)",
"+a = list(ma... | false | 0.036689 | 0.059393 | 0.617742 | [
"s083548002",
"s560989374"
] |
u020390084 | p03087 | python | s019283541 | s188288249 | 593 | 340 | 30,316 | 13,948 | Accepted | Accepted | 42.66 | import bisect
n, q = list(map(int,input().split()))
s = eval(input())
lr = [list(map(int,input().split())) for _ in range(q)]
AC_index = []
for index in range(len(s)-1):
if s[index:index+2] == "AC":
AC_index.append(index)
for i in range(len(lr)):
left_index = bisect.bisect_left(AC_index,lr[i][0]-... | #!/usr/bin/env python3
import sys
from bisect import bisect_left
def solve(N: int, Q: int, S: str, l: "List[int]", r: "List[int]"):
A_index = []
## ACの場所を全部記録しときたい→Aの場所を全部記録
for i in range(N-1):
if S[i] == 'A' and S[i+1] == 'C':
A_index.append(i)
for j in range(Q):
... | 15 | 40 | 400 | 1,077 | import bisect
n, q = list(map(int, input().split()))
s = eval(input())
lr = [list(map(int, input().split())) for _ in range(q)]
AC_index = []
for index in range(len(s) - 1):
if s[index : index + 2] == "AC":
AC_index.append(index)
for i in range(len(lr)):
left_index = bisect.bisect_left(AC_index, lr[i][... | #!/usr/bin/env python3
import sys
from bisect import bisect_left
def solve(N: int, Q: int, S: str, l: "List[int]", r: "List[int]"):
A_index = []
## ACの場所を全部記録しときたい→Aの場所を全部記録
for i in range(N - 1):
if S[i] == "A" and S[i + 1] == "C":
A_index.append(i)
for j in range(Q):
if r... | false | 62.5 | [
"-import bisect",
"+#!/usr/bin/env python3",
"+import sys",
"+from bisect import bisect_left",
"-n, q = list(map(int, input().split()))",
"-s = eval(input())",
"-lr = [list(map(int, input().split())) for _ in range(q)]",
"-AC_index = []",
"-for index in range(len(s) - 1):",
"- if s[index : inde... | false | 0.087562 | 0.044699 | 1.95894 | [
"s019283541",
"s188288249"
] |
u384793271 | p02784 | python | s693115932 | s098354920 | 47 | 41 | 13,960 | 13,964 | Accepted | Accepted | 12.77 | h, n = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in a:
h = h-i
if h <= 0:
print('Yes')
else:
print('No')
| h, n = list(map(int, input().split()))
if h <= sum(list(map(int, input().split()))):
print('Yes')
else:
print('No')
| 9 | 5 | 152 | 122 | h, n = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in a:
h = h - i
if h <= 0:
print("Yes")
else:
print("No")
| h, n = list(map(int, input().split()))
if h <= sum(list(map(int, input().split()))):
print("Yes")
else:
print("No")
| false | 44.444444 | [
"-a = list(map(int, input().split()))",
"-for i in a:",
"- h = h - i",
"-if h <= 0:",
"+if h <= sum(list(map(int, input().split()))):"
] | false | 0.035071 | 0.034672 | 1.011506 | [
"s693115932",
"s098354920"
] |
u815878613 | p03341 | python | s433905798 | s212476195 | 132 | 83 | 8,268 | 5,920 | Accepted | Accepted | 37.12 | def main():
N = int(eval(input()))
S = list(eval(input()))
S = list([0 if x == "W" else 1 for x in S])
E = 0
W = sum(S[1:N])
p = W
for i in range(1, N):
E += 1 - S[i-1]
W -= S[i]
ss = E + W
if ss < p:
p = ss
print(p)
mai... | def solver():
N = int(eval(input()))
S = list(eval(input()))
rE = S.count('E') # リーダーより右にいる人の数
rW = N - rE
lE = 0
lW = 0
c = N
for s in S:
if s == 'E':
rE -= 1
f = 1
else:
rW -= 1
f = -1
can... | 20 | 35 | 317 | 518 | def main():
N = int(eval(input()))
S = list(eval(input()))
S = list([0 if x == "W" else 1 for x in S])
E = 0
W = sum(S[1:N])
p = W
for i in range(1, N):
E += 1 - S[i - 1]
W -= S[i]
ss = E + W
if ss < p:
p = ss
print(p)
main()
| def solver():
N = int(eval(input()))
S = list(eval(input()))
rE = S.count("E") # リーダーより右にいる人の数
rW = N - rE
lE = 0
lW = 0
c = N
for s in S:
if s == "E":
rE -= 1
f = 1
else:
rW -= 1
f = -1
candidate = rE + lW
... | false | 42.857143 | [
"-def main():",
"+def solver():",
"- S = list([0 if x == \"W\" else 1 for x in S])",
"- E = 0",
"- W = sum(S[1:N])",
"- p = W",
"- for i in range(1, N):",
"- E += 1 - S[i - 1]",
"- W -= S[i]",
"- ss = E + W",
"- if ss < p:",
"- p = ss",
"... | false | 0.052234 | 0.054396 | 0.96025 | [
"s433905798",
"s212476195"
] |
u606045429 | p03310 | python | s449638173 | s950269172 | 760 | 573 | 25,116 | 24,856 | Accepted | Accepted | 24.61 | from itertools import accumulate
from bisect import bisect_left
N, *A = list(map(int, open(0).read().split()))
A = [0] + list(accumulate(A))
ans = float("inf")
for i in range(2, N - 1):
lm = A[i] // 2
l = bisect_left(A, lm)
if abs(A[l - 1] - lm) < abs(A[l] - lm):
l -= 1
rm = (A... | from itertools import accumulate
from bisect import bisect_left
def main():
N, *A = list(map(int, open(0).read().split()))
A = [0] + list(accumulate(A))
ans = float("inf")
for i in range(2, N - 1):
lm = A[i] // 2
l = bisect_left(A, lm)
if abs(A[l - 1] - lm) < abs(A... | 27 | 30 | 570 | 665 | from itertools import accumulate
from bisect import bisect_left
N, *A = list(map(int, open(0).read().split()))
A = [0] + list(accumulate(A))
ans = float("inf")
for i in range(2, N - 1):
lm = A[i] // 2
l = bisect_left(A, lm)
if abs(A[l - 1] - lm) < abs(A[l] - lm):
l -= 1
rm = (A[i] + A[N]) // 2
... | from itertools import accumulate
from bisect import bisect_left
def main():
N, *A = list(map(int, open(0).read().split()))
A = [0] + list(accumulate(A))
ans = float("inf")
for i in range(2, N - 1):
lm = A[i] // 2
l = bisect_left(A, lm)
if abs(A[l - 1] - lm) < abs(A[l] - lm):
... | false | 10 | [
"-N, *A = list(map(int, open(0).read().split()))",
"-A = [0] + list(accumulate(A))",
"-ans = float(\"inf\")",
"-for i in range(2, N - 1):",
"- lm = A[i] // 2",
"- l = bisect_left(A, lm)",
"- if abs(A[l - 1] - lm) < abs(A[l] - lm):",
"- l -= 1",
"- rm = (A[i] + A[N]) // 2",
"- ... | false | 0.049929 | 0.07895 | 0.632412 | [
"s449638173",
"s950269172"
] |
u254871849 | p03317 | python | s532011022 | s248173541 | 40 | 18 | 13,940 | 3,060 | Accepted | Accepted | 55 | import sys
n, k, *a = list(map(int, sys.stdin.read().split()))
def main():
return ((n - 1) + (k - 1) - 1) // (k - 1)
if __name__ == '__main__':
ans = main()
print(ans) | import sys
n, k = list(map(int, sys.stdin.readline().split()))
def main():
print(((n + k - 3) // (k - 1)))
if __name__ == '__main__':
main() | 10 | 9 | 185 | 152 | import sys
n, k, *a = list(map(int, sys.stdin.read().split()))
def main():
return ((n - 1) + (k - 1) - 1) // (k - 1)
if __name__ == "__main__":
ans = main()
print(ans)
| import sys
n, k = list(map(int, sys.stdin.readline().split()))
def main():
print(((n + k - 3) // (k - 1)))
if __name__ == "__main__":
main()
| false | 10 | [
"-n, k, *a = list(map(int, sys.stdin.read().split()))",
"+n, k = list(map(int, sys.stdin.readline().split()))",
"- return ((n - 1) + (k - 1) - 1) // (k - 1)",
"+ print(((n + k - 3) // (k - 1)))",
"- ans = main()",
"- print(ans)",
"+ main()"
] | false | 0.11967 | 0.126643 | 0.944941 | [
"s532011022",
"s248173541"
] |
u691018832 | p02804 | python | s314509448 | s943207256 | 436 | 306 | 31,248 | 19,340 | Accepted | Accepted | 29.82 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from bisect import bisect_left
def comb(n, k):
if n < 0 or n < k or k < 0:
return 0
return fac[n] * ifac[k] * ifac[n - k] % mod
n, k, *a ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
def comb(n, k):
if n < 0 or n < k or k < 0:
return 0
return fac[n] * ifac[k] * ifac[n - k] % mod
n, k, *a = list(map(int, read().split()))
... | 31 | 28 | 739 | 664 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
from bisect import bisect_left
def comb(n, k):
if n < 0 or n < k or k < 0:
return 0
return fac[n] * ifac[k] * ifac[n - k] % mod
n, k, *a = list(map(int, r... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
def comb(n, k):
if n < 0 or n < k or k < 0:
return 0
return fac[n] * ifac[k] * ifac[n - k] % mod
n, k, *a = list(map(int, read().split()))
a.sort()
mod = ... | false | 9.677419 | [
"-from bisect import bisect_left",
"-max_n = 2 * 10**5 + 1",
"-fac = [1] * max_n",
"-inv = [1] * max_n",
"-ifac = [1] * max_n",
"-for i in range(2, max_n):",
"+fac = [1] * n",
"+inv = [1] * n",
"+ifac = [1] * n",
"+for i in range(2, n):"
] | false | 0.724891 | 0.035526 | 20.404728 | [
"s314509448",
"s943207256"
] |
u156815136 | p02744 | python | s224913186 | s885361261 | 259 | 113 | 6,504 | 20,560 | Accepted | Accepted | 56.37 | 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 # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] -... | #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, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdi... | 48 | 40 | 1,129 | 975 | 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 # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] - k[j... | # 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, product # (string,3) 3回
# from collections import deque
from collections import deque, defaul... | false | 16.666667 | [
"-from statistics import median",
"-",
"+# from statistics import median",
"-from itertools import combinations # (string,3) 3回",
"-from collections import deque",
"-from collections import defaultdict",
"-import bisect",
"+from itertools import combinations, permutations, accumulate, product # (str... | false | 0.03974 | 0.047302 | 0.840139 | [
"s224913186",
"s885361261"
] |
u010110540 | p03721 | python | s529720331 | s531800104 | 456 | 317 | 24,320 | 24,360 | Accepted | Accepted | 30.48 | import bisect
N, K = list(map(int, input().split()))
d = []
for i in range(N):
a, b = list(map(int, input().split()))
d.append([a,b])
d.sort()
l = [0] * N
l[0] = d[0][1]
for i in range(1, N):
l[i] = d[i][1]+ l[i-1]
pos = bisect.bisect_left(l, K)
print((d[pos][0])) | import sys
import bisect
N, K = list(map(int, sys.stdin.readline().split()))
d = []
for i in range(N):
a, b = list(map(int, sys.stdin.readline().split()))
d.append([a,b])
d.sort()
l = [0] * N
l[0] = d[0][1]
for i in range(1, N):
l[i] = d[i][1]+ l[i-1]
pos = bisect.bisect_left(l, K)... | 20 | 21 | 288 | 326 | import bisect
N, K = list(map(int, input().split()))
d = []
for i in range(N):
a, b = list(map(int, input().split()))
d.append([a, b])
d.sort()
l = [0] * N
l[0] = d[0][1]
for i in range(1, N):
l[i] = d[i][1] + l[i - 1]
pos = bisect.bisect_left(l, K)
print((d[pos][0]))
| import sys
import bisect
N, K = list(map(int, sys.stdin.readline().split()))
d = []
for i in range(N):
a, b = list(map(int, sys.stdin.readline().split()))
d.append([a, b])
d.sort()
l = [0] * N
l[0] = d[0][1]
for i in range(1, N):
l[i] = d[i][1] + l[i - 1]
pos = bisect.bisect_left(l, K)
print((d[pos][0]))
| false | 4.761905 | [
"+import sys",
"-N, K = list(map(int, input().split()))",
"+N, K = list(map(int, sys.stdin.readline().split()))",
"- a, b = list(map(int, input().split()))",
"+ a, b = list(map(int, sys.stdin.readline().split()))"
] | false | 0.037337 | 0.045573 | 0.819287 | [
"s529720331",
"s531800104"
] |
u394731058 | p03807 | python | s309706912 | s528139354 | 50 | 42 | 14,108 | 14,104 | Accepted | Accepted | 16 | def main():
ans = 'YES'
n = int(eval(input()))
l = list(map(int, input().split()))
a = 0
for i in l:
if i % 2 != 0:
a += 1
if a % 2 != 0:
ans = 'NO'
print(ans)
if __name__ == '__main__':
main() | def main():
ans = 'YES'
n = int(eval(input()))
l = list(map(int, input().split()))
if sum(l)%2 != 0:
ans = 'NO'
print(ans)
if __name__ == '__main__':
main() | 14 | 10 | 239 | 178 | def main():
ans = "YES"
n = int(eval(input()))
l = list(map(int, input().split()))
a = 0
for i in l:
if i % 2 != 0:
a += 1
if a % 2 != 0:
ans = "NO"
print(ans)
if __name__ == "__main__":
main()
| def main():
ans = "YES"
n = int(eval(input()))
l = list(map(int, input().split()))
if sum(l) % 2 != 0:
ans = "NO"
print(ans)
if __name__ == "__main__":
main()
| false | 28.571429 | [
"- a = 0",
"- for i in l:",
"- if i % 2 != 0:",
"- a += 1",
"- if a % 2 != 0:",
"+ if sum(l) % 2 != 0:"
] | false | 0.165858 | 0.043798 | 3.786905 | [
"s309706912",
"s528139354"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.