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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u138537142 | p02995 | python | s201514386 | s617661630 | 35 | 18 | 5,076 | 3,064 | Accepted | Accepted | 48.57 | from fractions import gcd
def floor(a, b):
# return int((a - a%b)/b)
return a//b
# def gcd(a, b):
# while a % b != 0:
# a, b = b, a % b
# return a
def lcm(a, b):
return floor((a * b), gcd(a, b))
input = list(map(int, input().split(' ')))
total_count = input[1] + 1 - input[0]
div_c = floor(in... | def floor(a, b):
# return int((a - a%b)/b)
return a//b
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
def lcm(a, b):
return floor((a * b), gcd(a, b))
input = list(map(int, input().split(' ')))
total_count = input[1] + 1 - input[0]
div_c = floor(input[1], input[2]) - floor(input[0] -1, ... | 16 | 15 | 578 | 539 | from fractions import gcd
def floor(a, b):
# return int((a - a%b)/b)
return a // b
# def gcd(a, b):
# while a % b != 0:
# a, b = b, a % b
# return a
def lcm(a, b):
return floor((a * b), gcd(a, b))
input = list(map(int, input().split(" ")))
total_count = input[1] + 1 - input[0]
div_c = floor(... | def floor(a, b):
# return int((a - a%b)/b)
return a // b
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
def lcm(a, b):
return floor((a * b), gcd(a, b))
input = list(map(int, input().split(" ")))
total_count = input[1] + 1 - input[0]
div_c = floor(input[1], input[2]) - floor(inpu... | false | 6.25 | [
"-from fractions import gcd",
"-",
"-",
"-# def gcd(a, b):",
"-# while a % b != 0:",
"-# a, b = b, a % b",
"-# return a",
"+def gcd(a, b):",
"+ while b != 0:",
"+ a, b = b, a % b",
"+ return a",
"+",
"+"
] | false | 0.120423 | 0.083804 | 1.436959 | [
"s201514386",
"s617661630"
] |
u111497285 | p02813 | python | s073092501 | s451749660 | 58 | 29 | 8,052 | 8,308 | Accepted | Accepted | 50 | import itertools
n = int(eval(input()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
l = list(itertools.permutations(p))
l.sort()
p_i = 0
q_i = 0
for i in range(len(l)):
if list(l[i]) == p:
p_i = i
if list(l[i]) == q:
q_i = i
print((abs(p_i -... | import itertools
n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
permu_dict = list(itertools.permutations([i for i in range(1, n+1)]))
permu_dict = sorted(permu_dict)
print((abs(permu_dict.index(p)-permu_dict.index(q))))
| 23 | 11 | 324 | 276 | import itertools
n = int(eval(input()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
l = list(itertools.permutations(p))
l.sort()
p_i = 0
q_i = 0
for i in range(len(l)):
if list(l[i]) == p:
p_i = i
if list(l[i]) == q:
q_i = i
print((abs(p_i - q_i)))
| import itertools
n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
permu_dict = list(itertools.permutations([i for i in range(1, n + 1)]))
permu_dict = sorted(permu_dict)
print((abs(permu_dict.index(p) - permu_dict.index(q))))
| false | 52.173913 | [
"-p = list(map(int, input().split()))",
"-q = list(map(int, input().split()))",
"-l = list(itertools.permutations(p))",
"-l.sort()",
"-p_i = 0",
"-q_i = 0",
"-for i in range(len(l)):",
"- if list(l[i]) == p:",
"- p_i = i",
"- if list(l[i]) == q:",
"- q_i = i",
"-print((abs(... | false | 0.0388 | 0.040346 | 0.961678 | [
"s073092501",
"s451749660"
] |
u119148115 | p02913 | python | s030397216 | s157059261 | 369 | 314 | 77,032 | 69,428 | Accepted | Accepted | 14.91 | import sys
def I(): return int(sys.stdin.readline().rstrip())
def LS2(): return list(sys.stdin.readline().rstrip()) #空白なし
N = I()
S = LS2()
def Z_algorithm(S):
N = len(S)
A = [0]*N
A[0] = N
i,j = 1,0
while i < N:
while i+j < N and S[j] == S[i+j]:
j += 1
... | import sys
def I(): return int(sys.stdin.readline().rstrip())
def LS2(): return list(sys.stdin.readline().rstrip()) #空白なし
N = I()
S = LS2()
for i in range(N):
S[i] = ord(S[i])-97
# Rolling Hash
mod = 10**9+7
base = 1234
def f(n): # 長さnで条件を満たす部分列が存在するか
A = []
a = 0
for i in range... | 39 | 45 | 744 | 886 | import sys
def I():
return int(sys.stdin.readline().rstrip())
def LS2():
return list(sys.stdin.readline().rstrip()) # 空白なし
N = I()
S = LS2()
def Z_algorithm(S):
N = len(S)
A = [0] * N
A[0] = N
i, j = 1, 0
while i < N:
while i + j < N and S[j] == S[i + j]:
j += 1
... | import sys
def I():
return int(sys.stdin.readline().rstrip())
def LS2():
return list(sys.stdin.readline().rstrip()) # 空白なし
N = I()
S = LS2()
for i in range(N):
S[i] = ord(S[i]) - 97
# Rolling Hash
mod = 10**9 + 7
base = 1234
def f(n): # 長さnで条件を満たす部分列が存在するか
A = []
a = 0
for i in range(n... | false | 13.333333 | [
"+for i in range(N):",
"+ S[i] = ord(S[i]) - 97",
"+# Rolling Hash",
"+mod = 10**9 + 7",
"+base = 1234",
"-def Z_algorithm(S):",
"- N = len(S)",
"- A = [0] * N",
"- A[0] = N",
"- i, j = 1, 0",
"- while i < N:",
"- while i + j < N and S[j] == S[i + j]:",
"- ... | false | 0.042755 | 0.040816 | 1.047493 | [
"s030397216",
"s157059261"
] |
u628335443 | p02725 | python | s733866625 | s889724009 | 163 | 108 | 26,444 | 26,060 | Accepted | Accepted | 33.74 | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
d_max = 0
for i in range(n - 1):
d = a[i + 1] - a[i]
d_max = max(d_max, d)
d = (k - a[-1]) + a[0]
d_max = max(d_max, d)
print((k - d_max))
| k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
d_max = 0
for i in range(n - 1):
d = a[i + 1] - a[i]
if d > d_max:
d_max = d
d = (k - a[-1]) + a[0]
if d > d_max:
d_max = d
print((k - d_max))
| 12 | 14 | 228 | 246 | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
d_max = 0
for i in range(n - 1):
d = a[i + 1] - a[i]
d_max = max(d_max, d)
d = (k - a[-1]) + a[0]
d_max = max(d_max, d)
print((k - d_max))
| k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
d_max = 0
for i in range(n - 1):
d = a[i + 1] - a[i]
if d > d_max:
d_max = d
d = (k - a[-1]) + a[0]
if d > d_max:
d_max = d
print((k - d_max))
| false | 14.285714 | [
"- d_max = max(d_max, d)",
"+ if d > d_max:",
"+ d_max = d",
"-d_max = max(d_max, d)",
"+if d > d_max:",
"+ d_max = d"
] | false | 0.036395 | 0.03715 | 0.979685 | [
"s733866625",
"s889724009"
] |
u312025627 | p02757 | python | s159463276 | s830796247 | 220 | 88 | 52,044 | 86,900 | Accepted | Accepted | 60 | def main():
N, P = (int(i) for i in input().split())
L = [int(s) for s in eval(input())][::-1]
ans = 0
if P == 2 or P == 5:
for i, e in enumerate(L):
if e % P == 0:
ans += N-i
else:
A = [0]*N
d = 1
for i, e in enumerate(L):
... | def main():
_, P = (int(i) for i in input().split())
S = [int(s) for s in eval(input())]
ans = 0
if P == 2:
for i, v in enumerate(S, start=1):
if v % 2 == 0:
ans += i
elif P == 5:
for i, v in enumerate(S, start=1):
if v == 0 or v == 5... | 28 | 33 | 676 | 728 | def main():
N, P = (int(i) for i in input().split())
L = [int(s) for s in eval(input())][::-1]
ans = 0
if P == 2 or P == 5:
for i, e in enumerate(L):
if e % P == 0:
ans += N - i
else:
A = [0] * N
d = 1
for i, e in enumerate(L):
... | def main():
_, P = (int(i) for i in input().split())
S = [int(s) for s in eval(input())]
ans = 0
if P == 2:
for i, v in enumerate(S, start=1):
if v % 2 == 0:
ans += i
elif P == 5:
for i, v in enumerate(S, start=1):
if v == 0 or v == 5:
... | false | 15.151515 | [
"- N, P = (int(i) for i in input().split())",
"- L = [int(s) for s in eval(input())][::-1]",
"+ _, P = (int(i) for i in input().split())",
"+ S = [int(s) for s in eval(input())]",
"- if P == 2 or P == 5:",
"- for i, e in enumerate(L):",
"- if e % P == 0:",
"- ... | false | 0.035624 | 0.052759 | 0.675213 | [
"s159463276",
"s830796247"
] |
u254871849 | p03693 | python | s818418260 | s677389143 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | import sys
input = sys.stdin.readline
rgb = int(''.join(input().split()))
if rgb % 4 == 0:
print("YES")
else:
print("NO") | import sys
r, g, b = sys.stdin.readline().split()
def main():
return 'NO' if int(g + b) % 4 else 'YES'
if __name__ == '__main__':
ans = main()
print(ans) | 9 | 10 | 139 | 177 | import sys
input = sys.stdin.readline
rgb = int("".join(input().split()))
if rgb % 4 == 0:
print("YES")
else:
print("NO")
| import sys
r, g, b = sys.stdin.readline().split()
def main():
return "NO" if int(g + b) % 4 else "YES"
if __name__ == "__main__":
ans = main()
print(ans)
| false | 10 | [
"-input = sys.stdin.readline",
"-rgb = int(\"\".join(input().split()))",
"-if rgb % 4 == 0:",
"- print(\"YES\")",
"-else:",
"- print(\"NO\")",
"+r, g, b = sys.stdin.readline().split()",
"+",
"+",
"+def main():",
"+ return \"NO\" if int(g + b) % 4 else \"YES\"",
"+",
"+",
"+if __na... | false | 0.044985 | 0.04489 | 1.002119 | [
"s818418260",
"s677389143"
] |
u865138391 | p02414 | python | s312804766 | s396064226 | 230 | 130 | 8,716 | 8,588 | Accepted | Accepted | 43.48 | n, m, l = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(n)]
B = [list(map(int, input().split())) for i in range(m)]
for ARow in A:
result = []
for BCol in zip(*B):
result.append(sum([ARow[i] * BCol[i] for i in range(m)]))
print((*result)) | n, m, l = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(n)]
B = [list(map(int, input().split())) for i in range(m)]
for ARow in A:
result = []
for BCol in zip(*B):
result.append(sum([a * b for (a,b) in zip(ARow, BCol)]))
print((*result)) | 8 | 8 | 295 | 294 | n, m, l = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(n)]
B = [list(map(int, input().split())) for i in range(m)]
for ARow in A:
result = []
for BCol in zip(*B):
result.append(sum([ARow[i] * BCol[i] for i in range(m)]))
print((*result))
| n, m, l = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(n)]
B = [list(map(int, input().split())) for i in range(m)]
for ARow in A:
result = []
for BCol in zip(*B):
result.append(sum([a * b for (a, b) in zip(ARow, BCol)]))
print((*result))
| false | 0 | [
"- result.append(sum([ARow[i] * BCol[i] for i in range(m)]))",
"+ result.append(sum([a * b for (a, b) in zip(ARow, BCol)]))"
] | false | 0.073967 | 0.038177 | 1.937487 | [
"s312804766",
"s396064226"
] |
u488401358 | p03583 | python | s425663215 | s616595877 | 213 | 78 | 40,812 | 66,604 | Accepted | Accepted | 63.38 | N=int(eval(input()))
for i in range(1,3501):
for j in range(1,3501):
if 4*i*j-N*(i+j)>0 and N*i*j%(4*i*j-N*(i+j))==0:
print((i,j,N*i*j//(4*i*j-N*(i+j))))
exit() | N=int(eval(input()))
for h in range(1,3501):
for n in range(1,3501):
if 4*h*n-(n+h)*N>0 and (h*n*N)%(4*h*n-(n+h)*N)==0:
print((n,h,(h*n*N)//(4*h*n-(n+h)*N)))
exit()
| 6 | 6 | 193 | 198 | N = int(eval(input()))
for i in range(1, 3501):
for j in range(1, 3501):
if 4 * i * j - N * (i + j) > 0 and N * i * j % (4 * i * j - N * (i + j)) == 0:
print((i, j, N * i * j // (4 * i * j - N * (i + j))))
exit()
| N = int(eval(input()))
for h in range(1, 3501):
for n in range(1, 3501):
if 4 * h * n - (n + h) * N > 0 and (h * n * N) % (4 * h * n - (n + h) * N) == 0:
print((n, h, (h * n * N) // (4 * h * n - (n + h) * N)))
exit()
| false | 0 | [
"-for i in range(1, 3501):",
"- for j in range(1, 3501):",
"- if 4 * i * j - N * (i + j) > 0 and N * i * j % (4 * i * j - N * (i + j)) == 0:",
"- print((i, j, N * i * j // (4 * i * j - N * (i + j))))",
"+for h in range(1, 3501):",
"+ for n in range(1, 3501):",
"+ if 4 * h ... | false | 0.420331 | 0.462596 | 0.908635 | [
"s425663215",
"s616595877"
] |
u936985471 | p02793 | python | s113024375 | s582206347 | 2,000 | 1,610 | 264,700 | 10,008 | Accepted | Accepted | 19.5 | import math
from fractions import gcd
from functools import reduce
DIV=10**9+7
def lcm(a,b):
return a*b//(gcd(a,b))
N=int(eval(input()))
A=list(map(int,input().split()))
g=reduce(lcm,A)
ans=sum(list([g//x for x in A]))
print((ans%DIV)) | import sys
readline = sys.stdin.readline
N = int(readline())
A = list(map(int,readline().split()))
DIV = 10 ** 9 + 7
import math
from functools import reduce
def lcm(a,b,):
return (a // math.gcd(a,b)) * b
G = reduce(lcm, A)
ans = sum([G // x for x in A])
print((ans % DIV)) | 15 | 17 | 250 | 298 | import math
from fractions import gcd
from functools import reduce
DIV = 10**9 + 7
def lcm(a, b):
return a * b // (gcd(a, b))
N = int(eval(input()))
A = list(map(int, input().split()))
g = reduce(lcm, A)
ans = sum(list([g // x for x in A]))
print((ans % DIV))
| import sys
readline = sys.stdin.readline
N = int(readline())
A = list(map(int, readline().split()))
DIV = 10**9 + 7
import math
from functools import reduce
def lcm(
a,
b,
):
return (a // math.gcd(a, b)) * b
G = reduce(lcm, A)
ans = sum([G // x for x in A])
print((ans % DIV))
| false | 11.764706 | [
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+N = int(readline())",
"+A = list(map(int, readline().split()))",
"+DIV = 10**9 + 7",
"-from fractions import gcd",
"-DIV = 10**9 + 7",
"+",
"+def lcm(",
"+ a,",
"+ b,",
"+):",
"+ return (a // math.gcd(a, b)) * b",
"-def lcm... | false | 0.047012 | 0.038013 | 1.236717 | [
"s113024375",
"s582206347"
] |
u396495667 | p03485 | python | s903628009 | s433219620 | 163 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.57 | a,b =list(map(int, input().split()))
x = (a+b)/2
import math
print(( math.ceil(x))) | import math
a,b = list(map(int, input().split()))
print((math.ceil((a+b)/2))) | 6 | 3 | 82 | 71 | a, b = list(map(int, input().split()))
x = (a + b) / 2
import math
print((math.ceil(x)))
| import math
a, b = list(map(int, input().split()))
print((math.ceil((a + b) / 2)))
| false | 50 | [
"-a, b = list(map(int, input().split()))",
"-x = (a + b) / 2",
"-print((math.ceil(x)))",
"+a, b = list(map(int, input().split()))",
"+print((math.ceil((a + b) / 2)))"
] | false | 0.037652 | 0.047992 | 0.784555 | [
"s903628009",
"s433219620"
] |
u145231176 | p02726 | python | s903518918 | s041107372 | 479 | 325 | 48,860 | 86,508 | Accepted | Accepted | 32.15 | from collections import deque
n, x, y = list(map(int, input().split()))
dist = [[i - 1, i + 1] for i in range(n)]
dist[0].pop(0)
dist[-1].pop()
dist[x - 1].append(y - 1)
dist[y - 1].append(x - 1)
list = [0] * n
def line(num):
pos = deque([[num, 0]])
dp = [-1] * n
while len(pos) > 0:
... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | 28 | 79 | 641 | 1,915 | from collections import deque
n, x, y = list(map(int, input().split()))
dist = [[i - 1, i + 1] for i in range(n)]
dist[0].pop(0)
dist[-1].pop()
dist[x - 1].append(y - 1)
dist[y - 1].append(x - 1)
list = [0] * n
def line(num):
pos = deque([[num, 0]])
dp = [-1] * n
while len(pos) > 0:
now, depth = ... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | false | 64.556962 | [
"-from collections import deque",
"-",
"-n, x, y = list(map(int, input().split()))",
"-dist = [[i - 1, i + 1] for i in range(n)]",
"-dist[0].pop(0)",
"-dist[-1].pop()",
"-dist[x - 1].append(y - 1)",
"-dist[y - 1].append(x - 1)",
"-list = [0] * n",
"+def getN():",
"+ return int(eval(input()))"... | false | 0.089455 | 0.073831 | 1.21161 | [
"s903518918",
"s041107372"
] |
u197457087 | p03319 | python | s092379950 | s497773253 | 84 | 47 | 83,116 | 20,528 | Accepted | Accepted | 44.05 | N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
for i in range(N):
if A[i] == 1:
loc = i
break
#print(loc) #locは0index
left = loc
right = N-(loc+1)
ans = left//(K-1) + right//(K-1)
nokori = left%(K-1) + 1 + right%(K-1)
#print(ans,nokori)
if nokori == 1:
ans += 0
eli... | N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
n = N-1
k = K-1
ans = (n+k-1)//k
print(ans) | 21 | 6 | 373 | 114 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(N):
if A[i] == 1:
loc = i
break
# print(loc) #locは0index
left = loc
right = N - (loc + 1)
ans = left // (K - 1) + right // (K - 1)
nokori = left % (K - 1) + 1 + right % (K - 1)
# print(ans,nokori)
if nokori == ... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
n = N - 1
k = K - 1
ans = (n + k - 1) // k
print(ans)
| false | 71.428571 | [
"-for i in range(N):",
"- if A[i] == 1:",
"- loc = i",
"- break",
"-# print(loc) #locは0index",
"-left = loc",
"-right = N - (loc + 1)",
"-ans = left // (K - 1) + right // (K - 1)",
"-nokori = left % (K - 1) + 1 + right % (K - 1)",
"-# print(ans,nokori)",
"-if nokori == 1:",
"-... | false | 0.048501 | 0.212077 | 0.228695 | [
"s092379950",
"s497773253"
] |
u463864151 | p03659 | python | s783392577 | s801638595 | 196 | 175 | 23,800 | 23,800 | Accepted | Accepted | 10.71 | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 28 00:14:43 2020
@author: H_Hoshigi
"""
N = int(eval(input()))
a_list = list(map(int, input().split()))
sunuke = a_list[0]
araiguma = sum(a_list[1:])
min_difference = abs(sunuke - araiguma)
for i in range(1,N-1):
sunuke += a_list[i]
araiguma -= ... | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 28 00:29:09 2020
@author: H_Hoshigi
"""
import sys
N = int(eval(input()))
a_list = list(map(int, input().split()))
#sunuke = a_list[0]
#araiguma = sum(a_list[1:])
#min_difference = abs(sunuke - araiguma)
sunuke = 0
sum_a = sum(a_list)
min_difference ... | 21 | 29 | 441 | 619 | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 28 00:14:43 2020
@author: H_Hoshigi
"""
N = int(eval(input()))
a_list = list(map(int, input().split()))
sunuke = a_list[0]
araiguma = sum(a_list[1:])
min_difference = abs(sunuke - araiguma)
for i in range(1, N - 1):
sunuke += a_list[i]
araiguma -= a_list[i]
min... | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 28 00:29:09 2020
@author: H_Hoshigi
"""
import sys
N = int(eval(input()))
a_list = list(map(int, input().split()))
# sunuke = a_list[0]
# araiguma = sum(a_list[1:])
# min_difference = abs(sunuke - araiguma)
sunuke = 0
sum_a = sum(a_list)
min_difference = sys.maxsize
# abs... | false | 27.586207 | [
"-Created on Tue Jan 28 00:14:43 2020",
"+Created on Tue Jan 28 00:29:09 2020",
"+import sys",
"+",
"-sunuke = a_list[0]",
"-araiguma = sum(a_list[1:])",
"-min_difference = abs(sunuke - araiguma)",
"-for i in range(1, N - 1):",
"+# sunuke = a_list[0]",
"+# araiguma = sum(a_list[1:])",
"+# min_di... | false | 0.036623 | 0.043376 | 0.84432 | [
"s783392577",
"s801638595"
] |
u546285759 | p00218 | python | s609606461 | s165305799 | 70 | 50 | 7,720 | 7,780 | Accepted | Accepted | 28.57 | while True:
n = int(eval(input()))
if n == 0:
break
for _ in range(n):
p = list(map(int, input().split()))
x = sum(p) // 3
if 100 in p:
print("A")
elif (p[0] + p[1]) // 2 >= 90:
print("A")
elif x >= 80:
print("A"... | while True:
n = int(eval(input()))
if n == 0:
break
dataset = [list(map(int, input().split())) for _ in range(n)]
for p in dataset:
x = sum(p) // 3
if 100 in p:
print("A")
elif (p[0] + p[1]) // 2 >= 90:
print("A")
elif x >= 80:
... | 19 | 19 | 479 | 500 | while True:
n = int(eval(input()))
if n == 0:
break
for _ in range(n):
p = list(map(int, input().split()))
x = sum(p) // 3
if 100 in p:
print("A")
elif (p[0] + p[1]) // 2 >= 90:
print("A")
elif x >= 80:
print("A")
el... | while True:
n = int(eval(input()))
if n == 0:
break
dataset = [list(map(int, input().split())) for _ in range(n)]
for p in dataset:
x = sum(p) // 3
if 100 in p:
print("A")
elif (p[0] + p[1]) // 2 >= 90:
print("A")
elif x >= 80:
... | false | 0 | [
"- for _ in range(n):",
"- p = list(map(int, input().split()))",
"+ dataset = [list(map(int, input().split())) for _ in range(n)]",
"+ for p in dataset:"
] | false | 0.077253 | 0.095663 | 0.807554 | [
"s609606461",
"s165305799"
] |
u785578220 | p03286 | python | s912733951 | s358961512 | 20 | 18 | 3,060 | 2,940 | Accepted | Accepted | 10 | a=int(eval(input()));s=''
while a!=0:s+=str(a%2);a=-(a//2)
print((int(s[::-1]) if s != '' else 0)) | a=int(eval(input()));s=''
while a!=0:s=str(a%2)+s;a=-(a//2)
print((s if s != '' else 0)) | 3 | 3 | 92 | 82 | a = int(eval(input()))
s = ""
while a != 0:
s += str(a % 2)
a = -(a // 2)
print((int(s[::-1]) if s != "" else 0))
| a = int(eval(input()))
s = ""
while a != 0:
s = str(a % 2) + s
a = -(a // 2)
print((s if s != "" else 0))
| false | 0 | [
"- s += str(a % 2)",
"+ s = str(a % 2) + s",
"-print((int(s[::-1]) if s != \"\" else 0))",
"+print((s if s != \"\" else 0))"
] | false | 0.040426 | 0.036243 | 1.115408 | [
"s912733951",
"s358961512"
] |
u030090262 | p03487 | python | s916756870 | s152923232 | 107 | 93 | 17,780 | 18,676 | Accepted | Accepted | 13.08 | N=int(eval(input()))
d={}
ans=0
a=list(map(int,input().split()))
for i in range(N):
d[a[i]]=0
for i in range(N):
d[a[i]]+=1
for k in d:
val=d[k]
if val>=k:
ans+=d[k]-k
else:
ans+=d[k]
print(ans)
| from collections import Counter
N=int(eval(input()))
ans=0
a=list(map(int,input().split()))
d = Counter(a)
for k in d:
val = d[k]
if val>=k:
ans+=val-k
else:
ans+=val
print(ans)
| 15 | 12 | 239 | 211 | N = int(eval(input()))
d = {}
ans = 0
a = list(map(int, input().split()))
for i in range(N):
d[a[i]] = 0
for i in range(N):
d[a[i]] += 1
for k in d:
val = d[k]
if val >= k:
ans += d[k] - k
else:
ans += d[k]
print(ans)
| from collections import Counter
N = int(eval(input()))
ans = 0
a = list(map(int, input().split()))
d = Counter(a)
for k in d:
val = d[k]
if val >= k:
ans += val - k
else:
ans += val
print(ans)
| false | 20 | [
"+from collections import Counter",
"+",
"-d = {}",
"-for i in range(N):",
"- d[a[i]] = 0",
"-for i in range(N):",
"- d[a[i]] += 1",
"+d = Counter(a)",
"- ans += d[k] - k",
"+ ans += val - k",
"- ans += d[k]",
"+ ans += val"
] | false | 0.123383 | 0.047003 | 2.625028 | [
"s916756870",
"s152923232"
] |
u843175622 | p03291 | python | s366549637 | s854393978 | 244 | 159 | 9,280 | 9,204 | Accepted | Accepted | 34.84 | s = input().rstrip()
n = len(s)
mod = 10**9 + 7
dp = [0] * 4
dp[0] = 1
for i in range(n):
next = [0] * 4
if s[i] == 'A':
next[1] += dp[0]
elif s[i] == 'B':
next[2] += dp[1]
elif s[i] == 'C':
next[3] += dp[2]
else:
next[1] += dp[0]
next[2] += d... | s = input().rstrip()
dp = [0] * 4
dp[0] = 1
for i in range(len(s)):
if s[i] == 'A':
dp[1] += dp[0]
elif s[i] == 'B':
dp[2] += dp[1]
elif s[i] == 'C':
dp[3] += dp[2]
else:
dp = [dp[0]*3, dp[1]*3+dp[0], dp[2]*3+dp[1], dp[3]*3+dp[2]]
dp = list([x % (10**9+7... | 31 | 15 | 638 | 355 | s = input().rstrip()
n = len(s)
mod = 10**9 + 7
dp = [0] * 4
dp[0] = 1
for i in range(n):
next = [0] * 4
if s[i] == "A":
next[1] += dp[0]
elif s[i] == "B":
next[2] += dp[1]
elif s[i] == "C":
next[3] += dp[2]
else:
next[1] += dp[0]
next[2] += dp[1]
next... | s = input().rstrip()
dp = [0] * 4
dp[0] = 1
for i in range(len(s)):
if s[i] == "A":
dp[1] += dp[0]
elif s[i] == "B":
dp[2] += dp[1]
elif s[i] == "C":
dp[3] += dp[2]
else:
dp = [dp[0] * 3, dp[1] * 3 + dp[0], dp[2] * 3 + dp[1], dp[3] * 3 + dp[2]]
dp = list([x % (10**9 +... | false | 51.612903 | [
"-n = len(s)",
"-mod = 10**9 + 7",
"-for i in range(n):",
"- next = [0] * 4",
"+for i in range(len(s)):",
"- next[1] += dp[0]",
"+ dp[1] += dp[0]",
"- next[2] += dp[1]",
"+ dp[2] += dp[1]",
"- next[3] += dp[2]",
"+ dp[3] += dp[2]",
"- next[1]... | false | 0.037269 | 0.007396 | 5.039235 | [
"s366549637",
"s854393978"
] |
u163320134 | p02807 | python | s888098735 | s963660239 | 1,679 | 511 | 14,480 | 14,224 | Accepted | Accepted | 69.57 | mod=10**9+7
n=int(eval(input()))
arr=list(map(int,input().split()))
acum=[0]
for i in range(1,n+1):
tmp=acum[-1]+pow(i,mod-2,mod)*pow(i+1,mod-2,mod)
tmp%=mod
acum.append(tmp)
ans=0
for i in range(n-1):
ans+=arr[i]*acum[i]
ans%=mod
ans-=arr[i]*acum[n-2-i]
ans%=mod
ans-=arr[i]*pow(n-1-i,mod-... | mod=10**9+7
n=int(eval(input()))
arr=list(map(int,input().split()))
acum=[1]
for i in range(2,n+1):
tmp=acum[-1]+pow(i,mod-2,mod)
tmp%=mod
acum.append(tmp)
ans=0
for i in range(n-1):
ans+=(arr[i+1]-arr[i])*acum[i]
ans%=mod
for i in range(1,n):
ans*=i
ans%=mod
print(ans) | 23 | 16 | 455 | 293 | mod = 10**9 + 7
n = int(eval(input()))
arr = list(map(int, input().split()))
acum = [0]
for i in range(1, n + 1):
tmp = acum[-1] + pow(i, mod - 2, mod) * pow(i + 1, mod - 2, mod)
tmp %= mod
acum.append(tmp)
ans = 0
for i in range(n - 1):
ans += arr[i] * acum[i]
ans %= mod
ans -= arr[i] * acum[n ... | mod = 10**9 + 7
n = int(eval(input()))
arr = list(map(int, input().split()))
acum = [1]
for i in range(2, n + 1):
tmp = acum[-1] + pow(i, mod - 2, mod)
tmp %= mod
acum.append(tmp)
ans = 0
for i in range(n - 1):
ans += (arr[i + 1] - arr[i]) * acum[i]
ans %= mod
for i in range(1, n):
ans *= i
... | false | 30.434783 | [
"-acum = [0]",
"-for i in range(1, n + 1):",
"- tmp = acum[-1] + pow(i, mod - 2, mod) * pow(i + 1, mod - 2, mod)",
"+acum = [1]",
"+for i in range(2, n + 1):",
"+ tmp = acum[-1] + pow(i, mod - 2, mod)",
"- ans += arr[i] * acum[i]",
"- ans %= mod",
"- ans -= arr[i] * acum[n - 2 - i]",
... | false | 0.043902 | 0.037157 | 1.181523 | [
"s888098735",
"s963660239"
] |
u562016607 | p03584 | python | s721779987 | s387722493 | 1,859 | 1,122 | 74,784 | 11,204 | Accepted | Accepted | 39.64 | def issubset(x,y):
#a<<bならtrue
if len(x)>len(y):
return False
for i in range(1,len(x)+1):
if (x[-i],y[-i])==("1","0"):
return False
return True
N,K=list(map(int,input().split()))
A=[0 for i in range(N)]
B=[0 for i in range(N)]
for i in range(N):
A[i],B[i]=list... | N,K=list(map(int,input().split()))
A=[0 for i in range(N)]
B=[0 for i in range(N)]
for i in range(N):
A[i],B[i]=list(map(int,input().split()))
S=bin(K)
X=[K]
M=len(S)-2
for k in range(1,M+1):
if S[-k]=="0":continue
tmp=S[:-k]+"0"+"1"*(k-1)
X.append(int(tmp,2))
ans=0
for n in X:
tmp=0
... | 27 | 20 | 618 | 414 | def issubset(x, y):
# a<<bならtrue
if len(x) > len(y):
return False
for i in range(1, len(x) + 1):
if (x[-i], y[-i]) == ("1", "0"):
return False
return True
N, K = list(map(int, input().split()))
A = [0 for i in range(N)]
B = [0 for i in range(N)]
for i in range(N):
A[i],... | N, K = list(map(int, input().split()))
A = [0 for i in range(N)]
B = [0 for i in range(N)]
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
S = bin(K)
X = [K]
M = len(S) - 2
for k in range(1, M + 1):
if S[-k] == "0":
continue
tmp = S[:-k] + "0" + "1" * (k - 1)
X.append(int(tmp, 2)... | false | 25.925926 | [
"-def issubset(x, y):",
"- # a<<bならtrue",
"- if len(x) > len(y):",
"- return False",
"- for i in range(1, len(x) + 1):",
"- if (x[-i], y[-i]) == (\"1\", \"0\"):",
"- return False",
"- return True",
"-",
"-",
"- A[i] = bin(A[i])[2:]",
"-Ks = bin(K)[2:]",
... | false | 0.042436 | 0.037546 | 1.130243 | [
"s721779987",
"s387722493"
] |
u194637581 | p02819 | python | s127418329 | s441242338 | 25 | 17 | 3,060 | 3,060 | Accepted | Accepted | 32 | def check(num):
if num > 1:
for i in range(2, num):
if (num % i) == 0:
return False
break
else:
return True
else:
return False
a = int(eval(input()))
for i in range(a, 100500):
if check(i):
print(i)
... | def is_prime(num):
i = 5
while (i * i <= num):
if num % i == 0 or num % (i+2) ==0:
return False
i+=6
return True if num > 1 and num <=3 else False if num % 2 == 0 or num % 3 == 0 or num <=1 else True
k = int(eval(input()))
if is_prime(k):
print(k)
else:
while(not is_prime(k)... | 18 | 15 | 326 | 339 | def check(num):
if num > 1:
for i in range(2, num):
if (num % i) == 0:
return False
break
else:
return True
else:
return False
a = int(eval(input()))
for i in range(a, 100500):
if check(i):
print(i)
break
| def is_prime(num):
i = 5
while i * i <= num:
if num % i == 0 or num % (i + 2) == 0:
return False
i += 6
return (
True
if num > 1 and num <= 3
else False
if num % 2 == 0 or num % 3 == 0 or num <= 1
else True
)
k = int(eval(input()))
if... | false | 16.666667 | [
"-def check(num):",
"- if num > 1:",
"- for i in range(2, num):",
"- if (num % i) == 0:",
"- return False",
"- break",
"- else:",
"- return True",
"- else:",
"- return False",
"+def is_prime(num):",
"+ i = 5",
... | false | 0.082924 | 0.046953 | 1.766108 | [
"s127418329",
"s441242338"
] |
u852690916 | p02972 | python | s119961839 | s308285167 | 285 | 138 | 68,344 | 104,048 | Accepted | Accepted | 51.58 | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
b = list(map(int, input().split()))
lst = b[:]
for i in range(N,0,-1):
j = i
a = 0
while j <=N: a, j = a^lst[j-1], j+i
lst[i-1] = a
ans = [i+1 for i in range(N) if lst[i]]
print... | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, A):
A = [-1] + A
B = [0] * (N + 1)
for i in range(N, 0, -1):
xor = 0
for j in range(i * 2, N + 1, i):
xor ^= B[j]
B[i] = xor ^ A[i]
print((sum(B)))
print((*[i for i, b in enumerate(B)... | 19 | 18 | 389 | 467 | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
b = list(map(int, input().split()))
lst = b[:]
for i in range(N, 0, -1):
j = i
a = 0
while j <= N:
a, j = a ^ lst[j - 1], j + i
lst[i - 1] = a
ans = [i + 1 for i in range(N) if lst... | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, A):
A = [-1] + A
B = [0] * (N + 1)
for i in range(N, 0, -1):
xor = 0
for j in range(i * 2, N + 1, i):
xor ^= B[j]
B[i] = xor ^ A[i]
print((sum(B)))
print((*[i for i, b in enumerate(B) if b == ... | false | 5.263158 | [
"+# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)",
"-input = sys.stdin.readline",
"-",
"-def main():",
"- N = int(eval(input()))",
"- b = list(map(int, input().split()))",
"- lst = b[:]",
"+def main(N, A):",
"+ A = [-1] + A",
"+ B = [0] * (N + 1)",
"- j = i",
"- a ... | false | 0.038069 | 0.041012 | 0.928261 | [
"s119961839",
"s308285167"
] |
u476604182 | p02852 | python | s328974182 | s888061853 | 457 | 306 | 65,116 | 29,556 | Accepted | Accepted | 33.04 | from heapq import heappush, heappop
N, M = list(map(int, input().split()))
s = eval(input())
INF = 10**18
dp_cnt = [INF]*(N+1)
dp_next = [0]*(N+1)
dp_cnt[N] = 0
q = [(0,N)]
for i in range(N-1, -1, -1):
while True:
cnt, j = q[0]
if j-i>M:
heappop(q)
else:
break
dp_cnt[i] = cn... | from heapq import heappush, heappop
N, M = list(map(int, input().split()))
s = eval(input())
q = [(0,N)]
INF = 10**9
dic = {}
for i in range(N-1, -1, -1):
cnt, j = q[0]
while j-i>M:
heappop(q)
cnt, j = q[0]
heappush(q, (cnt,j))
cnt += 1 if s[i]!='1' else INF
heappush(q, (cnt,i))
dic[i]... | 36 | 24 | 546 | 415 | from heapq import heappush, heappop
N, M = list(map(int, input().split()))
s = eval(input())
INF = 10**18
dp_cnt = [INF] * (N + 1)
dp_next = [0] * (N + 1)
dp_cnt[N] = 0
q = [(0, N)]
for i in range(N - 1, -1, -1):
while True:
cnt, j = q[0]
if j - i > M:
heappop(q)
else:
... | from heapq import heappush, heappop
N, M = list(map(int, input().split()))
s = eval(input())
q = [(0, N)]
INF = 10**9
dic = {}
for i in range(N - 1, -1, -1):
cnt, j = q[0]
while j - i > M:
heappop(q)
cnt, j = q[0]
heappush(q, (cnt, j))
cnt += 1 if s[i] != "1" else INF
heappush(q, (c... | false | 33.333333 | [
"-INF = 10**18",
"-dp_cnt = [INF] * (N + 1)",
"-dp_next = [0] * (N + 1)",
"-dp_cnt[N] = 0",
"+INF = 10**9",
"+dic = {}",
"- while True:",
"+ cnt, j = q[0]",
"+ while j - i > M:",
"+ heappop(q)",
"- if j - i > M:",
"- heappop(q)",
"- else:",
"- ... | false | 0.159145 | 0.038028 | 4.184996 | [
"s328974182",
"s888061853"
] |
u325282913 | p02947 | python | s750878525 | s817224898 | 1,026 | 780 | 17,932 | 18,908 | Accepted | Accepted | 23.98 | import math
def P(n, r):
return math.factorial(n)//math.factorial(n-r)
def C(n, r):
return P(n, r)//math.factorial(r)
def moji(s):
tmp = []
for i in range(10):
tmp.append(s[i])
tmp.sort()
new_s = ''
for i in range(10):
new_s += tmp[i]
return new_s
N = int(... | from collections import defaultdict
import math
def P(n, r):
return math.factorial(n)//math.factorial(n-r)
def C(n, r):
if n <= 1:
return 0
return P(n, r)//math.factorial(r)
N = int(eval(input()))
d = defaultdict(int)
for i in range(N):
d[','.join(sorted(eval(input())))] += 1
ans = 0... | 29 | 16 | 558 | 369 | import math
def P(n, r):
return math.factorial(n) // math.factorial(n - r)
def C(n, r):
return P(n, r) // math.factorial(r)
def moji(s):
tmp = []
for i in range(10):
tmp.append(s[i])
tmp.sort()
new_s = ""
for i in range(10):
new_s += tmp[i]
return new_s
N = int(ev... | from collections import defaultdict
import math
def P(n, r):
return math.factorial(n) // math.factorial(n - r)
def C(n, r):
if n <= 1:
return 0
return P(n, r) // math.factorial(r)
N = int(eval(input()))
d = defaultdict(int)
for i in range(N):
d[",".join(sorted(eval(input())))] += 1
ans = 0... | false | 44.827586 | [
"+from collections import defaultdict",
"+ if n <= 1:",
"+ return 0",
"-def moji(s):",
"- tmp = []",
"- for i in range(10):",
"- tmp.append(s[i])",
"- tmp.sort()",
"- new_s = \"\"",
"- for i in range(10):",
"- new_s += tmp[i]",
"- return new_s",
"-",... | false | 0.038081 | 0.007891 | 4.825943 | [
"s750878525",
"s817224898"
] |
u426534722 | p02326 | python | s659965801 | s600365195 | 2,250 | 1,870 | 57,944 | 57,788 | Accepted | Accepted | 16.89 | import sys
h, w = list(map(int, sys.stdin.readline().split()))
dp = [[0] * w for _ in range(h)]
G = [[int(j) for j in sys.stdin.readline().split()] for _ in range(h)]
for i in range(0, h):
for j in range(0, w):
dp[i][j] = (G[i][j] + 1) % 2
for i in range(1, h):
for j in range(1, w):
if(... | import sys
h, w = list(map(int, sys.stdin.readline().split()))
dp = [[0] * w for _ in range(h)]
G = [[int(j) for j in sys.stdin.readline().split()] for _ in range(h)]
for x in range(h):
dp[x][0] = 1 if G[x][0] == 0 else 0
for y in range(w):
dp[0][y] = 1 if G[0][y] == 0 else 0
for i in range(1, h):
... | 12 | 13 | 449 | 483 | import sys
h, w = list(map(int, sys.stdin.readline().split()))
dp = [[0] * w for _ in range(h)]
G = [[int(j) for j in sys.stdin.readline().split()] for _ in range(h)]
for i in range(0, h):
for j in range(0, w):
dp[i][j] = (G[i][j] + 1) % 2
for i in range(1, h):
for j in range(1, w):
if G[i][j] ... | import sys
h, w = list(map(int, sys.stdin.readline().split()))
dp = [[0] * w for _ in range(h)]
G = [[int(j) for j in sys.stdin.readline().split()] for _ in range(h)]
for x in range(h):
dp[x][0] = 1 if G[x][0] == 0 else 0
for y in range(w):
dp[0][y] = 1 if G[0][y] == 0 else 0
for i in range(1, h):
for j in... | false | 7.692308 | [
"-for i in range(0, h):",
"- for j in range(0, w):",
"- dp[i][j] = (G[i][j] + 1) % 2",
"+for x in range(h):",
"+ dp[x][0] = 1 if G[x][0] == 0 else 0",
"+for y in range(w):",
"+ dp[0][y] = 1 if G[0][y] == 0 else 0"
] | false | 0.06459 | 0.043077 | 1.499404 | [
"s659965801",
"s600365195"
] |
u263830634 | p02781 | python | s691743675 | s041786793 | 23 | 20 | 3,188 | 3,064 | Accepted | Accepted | 13.04 | N = str(eval(input()))
K = int(eval(input()))
dp = [[[0] * 2 for _ in range(4)] for _ in range(105)]
dp[0][0][0] = 1
n = len(N)
for i in range(n):
nd = int(N[i])
for j in range(4):
for k in range(2):
for d in range(10):
ni = i + 1
nj = j
... | import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7
N = list(eval(input()))
n = len(N)
K = int(eval(input()))
dp1 = [[0] * (K + 1) for _ in range(n + 1)] #N以下が確定していて、0以外の数をk個使ったとき
dp2 = [0] * (n + 1) #N以下が確定していないときの0以外の数の個数
for i in range(n):
a = int(N[i])
... | 27 | 50 | 681 | 1,123 | N = str(eval(input()))
K = int(eval(input()))
dp = [[[0] * 2 for _ in range(4)] for _ in range(105)]
dp[0][0][0] = 1
n = len(N)
for i in range(n):
nd = int(N[i])
for j in range(4):
for k in range(2):
for d in range(10):
ni = i + 1
nj = j
nk = k... | import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9 + 7
N = list(eval(input()))
n = len(N)
K = int(eval(input()))
dp1 = [[0] * (K + 1) for _ in range(n + 1)] # N以下が確定していて、0以外の数をk個使ったとき
dp2 = [0] * (n + 1) # N以下が確定していないときの0以外の数の個数
for i in range(n):
a = int(N[i])
if a != 0:
... | false | 46 | [
"-N = str(eval(input()))",
"+import sys",
"+",
"+# input = sys.stdin.readline",
"+sys.setrecursionlimit(10**9)",
"+MOD = 10**9 + 7",
"+N = list(eval(input()))",
"+n = len(N)",
"-dp = [[[0] * 2 for _ in range(4)] for _ in range(105)]",
"-dp[0][0][0] = 1",
"-n = len(N)",
"+dp1 = [[0] * (K + 1) f... | false | 0.04142 | 0.007711 | 5.371322 | [
"s691743675",
"s041786793"
] |
u919633157 | p03416 | python | s999596867 | s354082203 | 52 | 48 | 2,940 | 2,940 | Accepted | Accepted | 7.69 | a,b=[int(i) for i in input().split()]
cnt=0
for j in range(a,b+1):
a=str(j)
if a[0] == a[-1] and \
a[1] == a[-2]:
cnt+=1
print(cnt)
| a,b=[int(i) for i in input().split()]
cnt=0
for j in range(a,b+1):
tmp=str(j)
if tmp == tmp[::-1]:
cnt+=1
print(cnt) | 8 | 7 | 151 | 130 | a, b = [int(i) for i in input().split()]
cnt = 0
for j in range(a, b + 1):
a = str(j)
if a[0] == a[-1] and a[1] == a[-2]:
cnt += 1
print(cnt)
| a, b = [int(i) for i in input().split()]
cnt = 0
for j in range(a, b + 1):
tmp = str(j)
if tmp == tmp[::-1]:
cnt += 1
print(cnt)
| false | 12.5 | [
"- a = str(j)",
"- if a[0] == a[-1] and a[1] == a[-2]:",
"+ tmp = str(j)",
"+ if tmp == tmp[::-1]:"
] | false | 0.033431 | 0.05486 | 0.609393 | [
"s999596867",
"s354082203"
] |
u670180528 | p03652 | python | s316528327 | s279242152 | 333 | 110 | 43,260 | 4,212 | Accepted | Accepted | 66.97 | import sys
input = sys.stdin.buffer.readline
n, m = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
cnt = [0] * (m + 1)
cur = [0] * n
done = [0] * (m + 1)
for i in range(n):
cnt[a[i][0]] += 1
cur[i] = a[i][0]
ans = max(cnt)
for _ in range(m - 1):
col = cnt.index(... | import sys
input = sys.stdin.buffer.readline
n, m = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
cnt = [0] * (m + 1)
cur = [0] * n
cur_idx = [0] * n
done = [0] * (m + 1)
for i in range(n):
cnt[a[i][0]] += 1
cur[i] = a[i][0]
ans = max(cnt)
for _ in range(m - 1):... | 26 | 28 | 530 | 577 | import sys
input = sys.stdin.buffer.readline
n, m = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
cnt = [0] * (m + 1)
cur = [0] * n
done = [0] * (m + 1)
for i in range(n):
cnt[a[i][0]] += 1
cur[i] = a[i][0]
ans = max(cnt)
for _ in range(m - 1):
col = cnt.index(max(... | import sys
input = sys.stdin.buffer.readline
n, m = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
cnt = [0] * (m + 1)
cur = [0] * n
cur_idx = [0] * n
done = [0] * (m + 1)
for i in range(n):
cnt[a[i][0]] += 1
cur[i] = a[i][0]
ans = max(cnt)
for _ in range(m - 1):
co... | false | 7.142857 | [
"+cur_idx = [0] * n",
"- j = 0",
"+ j = cur_idx[i]",
"+ cur_idx[i] = j"
] | false | 0.036192 | 0.035086 | 1.031497 | [
"s316528327",
"s279242152"
] |
u102461423 | p02641 | python | s513052717 | s553240373 | 22 | 20 | 9,180 | 9,168 | Accepted | Accepted | 9.09 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X, N, *P = list(map(int, read().split()))
nums = list(range(-10, 110))
for p in P:
nums.remove(p)
answer = min(nums, key=lambda x: (abs(x - X), x))
print(answer) | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X, N, *P = list(map(int, read().split()))
se = frozenset(P)
def gen_nums(X):
low, high = X-1, X
while True:
yield high
yield low
low, high = low-1, high+1
for x in gen_... | 15 | 21 | 294 | 365 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X, N, *P = list(map(int, read().split()))
nums = list(range(-10, 110))
for p in P:
nums.remove(p)
answer = min(nums, key=lambda x: (abs(x - X), x))
print(answer)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X, N, *P = list(map(int, read().split()))
se = frozenset(P)
def gen_nums(X):
low, high = X - 1, X
while True:
yield high
yield low
low, high = low - 1, high + 1
for x ... | false | 28.571429 | [
"-nums = list(range(-10, 110))",
"-for p in P:",
"- nums.remove(p)",
"-answer = min(nums, key=lambda x: (abs(x - X), x))",
"-print(answer)",
"+se = frozenset(P)",
"+",
"+",
"+def gen_nums(X):",
"+ low, high = X - 1, X",
"+ while True:",
"+ yield high",
"+ yield low",
... | false | 0.035662 | 0.037275 | 0.956729 | [
"s513052717",
"s553240373"
] |
u729133443 | p02567 | python | s068627705 | s559547612 | 128 | 81 | 14,872 | 14,848 | Accepted | Accepted | 36.72 | import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
import os, zlib, base64
open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c$}SA&2Hm15WWY<I}li`BRO&q?=i4*+Z?->-cm!5CE6BDQwk+}lim{a)?51ky|sq|eJNl17@Z+0i6SY-DPceshx7N%#}WC7q%ZZR;CEzM?0HtD8=7wC4+*R2<;6-AJ1xIC<n%j9^Ichpnj}IbFIvv>WqMQ989ZD0E@7-lBeD_{%v@fi... | import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
import os, zlib, base64
open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c$}SA&2Hm15WWY<I}lj3krE|{7kgL)ac-Mq_tINx2(m=mglS4k%ig571ikgvK0t5np+H~Cmp;bMkQ7CcRDM=4V3EW5`{v__d`HTMc2$cjGOu@{+LkL?uBW#J-_qlwg{(J5ez9ltD=FEgsbxzFDT@aq=WJeHY}*R{t$b5(UY8kJND5|-... | 6 | 6 | 1,702 | 1,758 | import sys
if sys.argv[-1] == "ONLINE_JUDGE":
import os, zlib, base64
open("solve.pyx", "wb").write(
zlib.decompress(
base64.b85decode(
"c$}SA&2Hm15WWY<I}li`BRO&q?=i4*+Z?->-cm!5CE6BDQwk+}lim{a)?51ky|sq|eJNl17@Z+0i6SY-DPceshx7N%#}WC7q%ZZR;CEzM?0HtD8=7wC4+*R2<;6-AJ1xIC<n%j9^I... | import sys
if sys.argv[-1] == "ONLINE_JUDGE":
import os, zlib, base64
open("solve.pyx", "wb").write(
zlib.decompress(
base64.b85decode(
"c$}SA&2Hm15WWY<I}lj3krE|{7kgL)ac-Mq_tINx2(m=mglS4k%ig571ikgvK0t5np+H~Cmp;bMkQ7CcRDM=4V3EW5`{v__d`HTMc2$cjGOu@{+LkL?uBW#J-_qlwg{(J5ez9ltD=... | false | 0 | [
"- \"c$}SA&2Hm15WWY<I}li`BRO&q?=i4*+Z?->-cm!5CE6BDQwk+}lim{a)?51ky|sq|eJNl17@Z+0i6SY-DPceshx7N%#}WC7q%ZZR;CEzM?0HtD8=7wC4+*R2<;6-AJ1xIC<n%j9^Ichpnj}IbFIvv>WqMQ989ZD0E@7-lBeD_{%v@fi^-D=Jx+1LLYZ8pVhCxVpvCf$*`xXZHFOu)>s+`xb=s_)N#jpT{DNCw~RCHZ~<GafX0wZm-Vjhty|CyrYwIM@8W0Dy&UkNqdzLBCt4>*DEah&Enuj4q-j=&*Xh... | false | 0.057066 | 0.054633 | 1.044529 | [
"s068627705",
"s559547612"
] |
u440566786 | p03177 | python | s830273429 | s504214947 | 1,787 | 913 | 75,280 | 49,628 | Accepted | Accepted | 48.91 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7 # 998244353
input = lambda:sys.stdin.readline().rstrip()
def resolve():
n, p = list(map(int, input().split()))
base = [list(map(int, input().split())) for _ in range(n)]
dp = [[(i == j) + 0 for j in range(n)] for... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7 # 998244353
input = lambda:sys.stdin.readline().rstrip()
def resolve():
n, p = list(map(int, input().split()))
base = [list(map(int, input().split())) for _ in range(n)]
dp = [[(i == j) + 0 for j in range(n)] for... | 19 | 19 | 678 | 690 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7 # 998244353
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n, p = list(map(int, input().split()))
base = [list(map(int, input().split())) for _ in range(n)]
dp = [[(i == j) + 0 for j in range(n)] for i in range... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7 # 998244353
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n, p = list(map(int, input().split()))
base = [list(map(int, input().split())) for _ in range(n)]
dp = [[(i == j) + 0 for j in range(n)] for i in range... | false | 0 | [
"- [sum(dp[i][k] * base[k][j] for k in range(n)) % MOD for j in range(n)]",
"+ [",
"+ sum(dp[i][k] * base[k][j] % MOD for k in range(n)) % MOD",
"+ for j in range(n)",
"+ ]",
"- [sum(base[i][k] * base[k][j] for k... | false | 0.048102 | 0.045041 | 1.067958 | [
"s830273429",
"s504214947"
] |
u731368968 | p03252 | python | s760709500 | s941243262 | 1,640 | 135 | 19,648 | 3,632 | Accepted | Accepted | 91.77 | s = eval(input())
t = eval(input())
snum = []
tnum = []
for c in range(ord('a'), ord('z') + 1):
snum.append([i for i, x in enumerate(s) if x == chr(c)])
for c in range(ord('a'), ord('z') + 1):
tnum.append([i for i, x in enumerate(t) if x == chr(c)])
snum.sort()
tnum.sort()
print(('Yes' if snum == tnum... | s = eval(input())
t = eval(input())
# snum = []
# tnum = []
# for c in range(ord('a'), ord('z') + 1):
# snum.append([i for i, x in enumerate(s) if x == chr(c)])
# for c in range(ord('a'), ord('z') + 1):
# tnum.append([i for i, x in enumerate(t) if x == chr(c)])
# snum.sort()
# tnum.sort()
# print('Yes... | 11 | 20 | 318 | 536 | s = eval(input())
t = eval(input())
snum = []
tnum = []
for c in range(ord("a"), ord("z") + 1):
snum.append([i for i, x in enumerate(s) if x == chr(c)])
for c in range(ord("a"), ord("z") + 1):
tnum.append([i for i, x in enumerate(t) if x == chr(c)])
snum.sort()
tnum.sort()
print(("Yes" if snum == tnum else "No"... | s = eval(input())
t = eval(input())
# snum = []
# tnum = []
# for c in range(ord('a'), ord('z') + 1):
# snum.append([i for i, x in enumerate(s) if x == chr(c)])
# for c in range(ord('a'), ord('z') + 1):
# tnum.append([i for i, x in enumerate(t) if x == chr(c)])
# snum.sort()
# tnum.sort()
# print('Yes' if snum ... | false | 45 | [
"-snum = []",
"-tnum = []",
"-for c in range(ord(\"a\"), ord(\"z\") + 1):",
"- snum.append([i for i, x in enumerate(s) if x == chr(c)])",
"-for c in range(ord(\"a\"), ord(\"z\") + 1):",
"- tnum.append([i for i, x in enumerate(t) if x == chr(c)])",
"-snum.sort()",
"-tnum.sort()",
"-print((\"Yes... | false | 0.05272 | 0.054705 | 0.963706 | [
"s760709500",
"s941243262"
] |
u936985471 | p03450 | python | s510213511 | s694082547 | 1,962 | 1,376 | 85,596 | 108,192 | Accepted | Accepted | 29.87 | # 人を頂点と見なしたグラフを作る。有向で、逆向きの場合は正負を反転させて辺を張る
# 頂点からの距離を記録し、一致しない箇所があればNG。
# 全ての辺を通るまで続ける。
# 辺の情報を[{0から行ける頂点},{1から行ける頂点},...]で管理する
# 親には進まないようにしてDFSする
N,M = list(map(int,input().split()))
E = [[] for i in range(N)]
for i in range(M):
L,R,D = list(map(int,input().split()))
E[L-1].append([R-1,D])
E[R-1].app... | # 人を頂点と見なしたグラフを作る。有向で、逆向きの場合は正負を反転させて辺を張る
# 頂点からの距離を記録し、一致しない箇所があればNG。
# 全ての辺を通るまで続ける。
# 辺の情報を[{0から行ける頂点},{1から行ける頂点},...]で管理する
# 親には進まないようにしてDFSする
N,M = list(map(int,input().split()))
E = [[] for i in range(N)]
for i in range(M):
L,R,D = list(map(int,input().split()))
E[L-1].append([R-1,D])
E[R-1].app... | 37 | 37 | 860 | 864 | # 人を頂点と見なしたグラフを作る。有向で、逆向きの場合は正負を反転させて辺を張る
# 頂点からの距離を記録し、一致しない箇所があればNG。
# 全ての辺を通るまで続ける。
# 辺の情報を[{0から行ける頂点},{1から行ける頂点},...]で管理する
# 親には進まないようにしてDFSする
N, M = list(map(int, input().split()))
E = [[] for i in range(N)]
for i in range(M):
L, R, D = list(map(int, input().split()))
E[L - 1].append([R - 1, D])
E[R - ... | # 人を頂点と見なしたグラフを作る。有向で、逆向きの場合は正負を反転させて辺を張る
# 頂点からの距離を記録し、一致しない箇所があればNG。
# 全ての辺を通るまで続ける。
# 辺の情報を[{0から行ける頂点},{1から行ける頂点},...]で管理する
# 親には進まないようにしてDFSする
N, M = list(map(int, input().split()))
E = [[] for i in range(N)]
for i in range(M):
L, R, D = list(map(int, input().split()))
E[L - 1].append([R - 1, D])
E[R - ... | false | 0 | [
"- v, parent = q.pop()",
"+ v, parent = q.popleft()"
] | false | 0.08296 | 0.041209 | 2.013152 | [
"s510213511",
"s694082547"
] |
u073852194 | p02564 | python | s914445629 | s582380864 | 3,580 | 2,135 | 531,976 | 308,972 | Accepted | Accepted | 40.36 | from collections import deque
class Graph(): #directed
def __init__(self, n, edge):
self.n = n
self.graph = [[] for _ in range(n)]
self.rev = [[] for _ in range(n)]
self.deg = [0 for _ in range(n)]
for e in edge:
self.graph[e[0]].append(e[1])
... | class Graph(): #directed
def __init__(self, n, edge, indexed=1):
self.n = n
self.graph = [[] for _ in range(n)]
self.rev = [[] for _ in range(n)]
self.deg = [0 for _ in range(n)]
for e in edge:
self.graph[e[0] - indexed].append(e[1] - indexed)
... | 102 | 65 | 2,985 | 2,060 | from collections import deque
class Graph: # directed
def __init__(self, n, edge):
self.n = n
self.graph = [[] for _ in range(n)]
self.rev = [[] for _ in range(n)]
self.deg = [0 for _ in range(n)]
for e in edge:
self.graph[e[0]].append(e[1])
self.re... | class Graph: # directed
def __init__(self, n, edge, indexed=1):
self.n = n
self.graph = [[] for _ in range(n)]
self.rev = [[] for _ in range(n)]
self.deg = [0 for _ in range(n)]
for e in edge:
self.graph[e[0] - indexed].append(e[1] - indexed)
self.rev... | false | 36.27451 | [
"-from collections import deque",
"-",
"-",
"- def __init__(self, n, edge):",
"+ def __init__(self, n, edge, indexed=1):",
"- self.graph[e[0]].append(e[1])",
"- self.rev[e[1]].append(e[0])",
"- self.deg[e[1]] += 1",
"+ self.graph[e[0] - indexed].appe... | false | 0.036762 | 0.035777 | 1.027529 | [
"s914445629",
"s582380864"
] |
u499381410 | p03142 | python | s155401298 | s158296439 | 561 | 260 | 106,156 | 99,768 | Accepted | Accepted | 53.65 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from copy import deepcopy
INF = 10 ** 20
sys.setrecurs... | 73 | 53 | 1,857 | 1,204 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factori... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from copy import deepcopy
INF = 10**20
sys.setrecursionlimit(2147... | false | 27.39726 | [
"-from bisect import bisect_right, bisect_left",
"+import math",
"+from bisect import bisect_left, bisect_right",
"-from itertools import permutations, accumulate, combinations, product",
"+from itertools import permutations, accumulate, combinations",
"-from bisect import bisect_left, bisect_right",
"-... | false | 0.137129 | 0.078003 | 1.757999 | [
"s155401298",
"s158296439"
] |
u905203728 | p03293 | python | s124752348 | s668903516 | 175 | 17 | 38,256 | 3,060 | Accepted | Accepted | 90.29 | s=list(eval(input()))
t=eval(input())
ans=[]
for i in range(len(s)):
s.insert(0,s.pop(-1))
ans.append("".join(s))
print(("Yes" if t in ans else "No")) | s=list(eval(input()))
t=eval(input())
for i in range(len(s)):
s.insert(0,s.pop(-1))
word="".join(s)
if word==t:
print("Yes")
exit()
print("No") | 8 | 9 | 152 | 167 | s = list(eval(input()))
t = eval(input())
ans = []
for i in range(len(s)):
s.insert(0, s.pop(-1))
ans.append("".join(s))
print(("Yes" if t in ans else "No"))
| s = list(eval(input()))
t = eval(input())
for i in range(len(s)):
s.insert(0, s.pop(-1))
word = "".join(s)
if word == t:
print("Yes")
exit()
print("No")
| false | 11.111111 | [
"-ans = []",
"- ans.append(\"\".join(s))",
"-print((\"Yes\" if t in ans else \"No\"))",
"+ word = \"\".join(s)",
"+ if word == t:",
"+ print(\"Yes\")",
"+ exit()",
"+print(\"No\")"
] | false | 0.078975 | 0.039743 | 1.987136 | [
"s124752348",
"s668903516"
] |
u022407960 | p02290 | python | s438579883 | s234261128 | 50 | 20 | 7,860 | 7,788 | Accepted | Accepted | 60 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
0 0 3 4
1
2 5
output:
3.1200000000 4.1600000000
"""
import sys
class Segment(object):
__slots__ = ('source', 'target')
def __init__(self, source, target):
self.source = complex(source)
self.target = complex(targe... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
0 0 3 4
1
2 5
output:
3.1200000000 4.1600000000
"""
import sys
class Segment(object):
__slots__ = ('source', 'target')
def __init__(self, source, target):
self.source = complex(source)
self.target = complex(targe... | 55 | 55 | 1,158 | 1,158 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
0 0 3 4
1
2 5
output:
3.1200000000 4.1600000000
"""
import sys
class Segment(object):
__slots__ = ("source", "target")
def __init__(self, source, target):
self.source = complex(source)
self.target = complex(target)
def dot(a, b):
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
0 0 3 4
1
2 5
output:
3.1200000000 4.1600000000
"""
import sys
class Segment(object):
__slots__ = ("source", "target")
def __init__(self, source, target):
self.source = complex(source)
self.target = complex(target)
def dot(a, b):
... | false | 0 | [
"+ q_num = int(_input[1])",
"- q_num = int(_input[1])"
] | false | 0.035646 | 0.035259 | 1.010974 | [
"s438579883",
"s234261128"
] |
u581187895 | p03775 | python | s507915732 | s931902673 | 30 | 27 | 3,060 | 3,060 | Accepted | Accepted | 10 | N = int(eval(input()))
ans = 1<<60
for a in range(1, int(N**0.5)+1):
if N%a==0:
b = N//a
max_len = max(len(str(a)), len(str(b)))
ans = min(ans, max_len)
print(ans) | def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
# divisors.sort()
return divisors
N = int(eval(input()))
print((len(str(make_divisors(N)[-1])))) | 9 | 13 | 182 | 308 | N = int(eval(input()))
ans = 1 << 60
for a in range(1, int(N**0.5) + 1):
if N % a == 0:
b = N // a
max_len = max(len(str(a)), len(str(b)))
ans = min(ans, max_len)
print(ans)
| def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
# divisors.sort()
return divisors
N = int(eval(input()))
print((len(str(make_divisors(N)[-1]))))
| false | 30.769231 | [
"+def make_divisors(n):",
"+ divisors = []",
"+ for i in range(1, int(n**0.5) + 1):",
"+ if n % i == 0:",
"+ divisors.append(i)",
"+ if i != n // i:",
"+ divisors.append(n // i)",
"+ # divisors.sort()",
"+ return divisors",
"+",
"+",
"-an... | false | 0.047905 | 0.042941 | 1.115619 | [
"s507915732",
"s931902673"
] |
u740909619 | p02779 | python | s541729384 | s889667390 | 103 | 66 | 39,116 | 31,152 | Accepted | Accepted | 35.92 | import collections
import sys
N = eval(input())
A = input().split()
A1 = list(map(int,list(collections.Counter(A).values())))
for i in A1:
if i >= 2:
print('NO')
sys.exit()
print('YES') | import sys
N = int(eval(input()))
A = input().split()
if N > len(set(A)):
print('NO')
sys.exit()
print('YES') | 10 | 7 | 196 | 117 | import collections
import sys
N = eval(input())
A = input().split()
A1 = list(map(int, list(collections.Counter(A).values())))
for i in A1:
if i >= 2:
print("NO")
sys.exit()
print("YES")
| import sys
N = int(eval(input()))
A = input().split()
if N > len(set(A)):
print("NO")
sys.exit()
print("YES")
| false | 30 | [
"-import collections",
"-N = eval(input())",
"+N = int(eval(input()))",
"-A1 = list(map(int, list(collections.Counter(A).values())))",
"-for i in A1:",
"- if i >= 2:",
"- print(\"NO\")",
"- sys.exit()",
"+if N > len(set(A)):",
"+ print(\"NO\")",
"+ sys.exit()"
] | false | 0.059938 | 0.056032 | 1.069706 | [
"s541729384",
"s889667390"
] |
u838644735 | p02813 | python | s613901379 | s991537819 | 33 | 26 | 9,204 | 9,164 | Accepted | Accepted | 21.21 | import math
def calc_order(A, N):
l = [i + 1 for i in range(N)]
order = 1
for i in range(N):
a = A[i]
len_l = len(l)
index = l.index(a)
# print(a, index, math.factorial(len_l - 1), order)
order += index * math.factorial(len_l - 1)
del l[index]
... | def factorial(n):
ret = 1
for i in range(n):
ret *= (i + 1)
return ret
def calc_order(A, N):
l = [i + 1 for i in range(N)]
order = 1
for i in range(N):
a = A[i]
len_l = N - i
index = l.index(a)
# print(a, index, factorial(len_l - 1), order)
... | 26 | 30 | 628 | 700 | import math
def calc_order(A, N):
l = [i + 1 for i in range(N)]
order = 1
for i in range(N):
a = A[i]
len_l = len(l)
index = l.index(a)
# print(a, index, math.factorial(len_l - 1), order)
order += index * math.factorial(len_l - 1)
del l[index]
return ord... | def factorial(n):
ret = 1
for i in range(n):
ret *= i + 1
return ret
def calc_order(A, N):
l = [i + 1 for i in range(N)]
order = 1
for i in range(N):
a = A[i]
len_l = N - i
index = l.index(a)
# print(a, index, factorial(len_l - 1), order)
order +... | false | 13.333333 | [
"-import math",
"+def factorial(n):",
"+ ret = 1",
"+ for i in range(n):",
"+ ret *= i + 1",
"+ return ret",
"- len_l = len(l)",
"+ len_l = N - i",
"- # print(a, index, math.factorial(len_l - 1), order)",
"- order += index * math.factorial(len_l - 1)",
... | false | 0.047472 | 0.047972 | 0.989587 | [
"s613901379",
"s991537819"
] |
u633068244 | p00517 | python | s566335840 | s806676921 | 30 | 20 | 4,240 | 4,240 | Accepted | Accepted | 33.33 | W,H,N = list(map(int,input().split()))
ans = 0
X,Y = list(map(int,input().split()))
for i in range(N-1):
X1,Y1 = list(map(int,input().split()))
dX,dY = X1-X,Y1-Y
if dX*dY > 0:
ans += max(abs(dY),abs(dX))
else:
ans += abs(dY) + abs(dX)
X,Y = X1,Y1
print(ans) | W,H,N = list(map(int,input().split()))
ans = 0
X,Y = list(map(int,input().split()))
for i in range(N-1):
X1,Y1 = list(map(int,input().split()))
dX,dY = X1-X,Y1-Y
s = 0 if dX*dY > 0 else 1
ans += max(abs(dY),abs(dX)) + s*min(abs(dY),abs(dX))
X,Y = X1,Y1
print(ans) | 12 | 10 | 270 | 270 | W, H, N = list(map(int, input().split()))
ans = 0
X, Y = list(map(int, input().split()))
for i in range(N - 1):
X1, Y1 = list(map(int, input().split()))
dX, dY = X1 - X, Y1 - Y
if dX * dY > 0:
ans += max(abs(dY), abs(dX))
else:
ans += abs(dY) + abs(dX)
X, Y = X1, Y1
print(ans)
| W, H, N = list(map(int, input().split()))
ans = 0
X, Y = list(map(int, input().split()))
for i in range(N - 1):
X1, Y1 = list(map(int, input().split()))
dX, dY = X1 - X, Y1 - Y
s = 0 if dX * dY > 0 else 1
ans += max(abs(dY), abs(dX)) + s * min(abs(dY), abs(dX))
X, Y = X1, Y1
print(ans)
| false | 16.666667 | [
"- if dX * dY > 0:",
"- ans += max(abs(dY), abs(dX))",
"- else:",
"- ans += abs(dY) + abs(dX)",
"+ s = 0 if dX * dY > 0 else 1",
"+ ans += max(abs(dY), abs(dX)) + s * min(abs(dY), abs(dX))"
] | false | 0.045302 | 0.045722 | 0.99083 | [
"s566335840",
"s806676921"
] |
u514401521 | p02720 | python | s728428856 | s703033930 | 84 | 70 | 11,228 | 18,480 | Accepted | Accepted | 16.67 | K = int(eval(input()))
import copy
present = [1,2,3,4,5,6,7,8,9]
while K >= len(present):
K -= len(present)
next = []
for i in range(len(present)):
tmp = present[i]
r = tmp % 10
if r != 0:
next.append(tmp * 10 + r -1)
next.append(tmp * 10 + r)
... | K = int(eval(input()))
old = []
old = [i for i in range(1, 10)]
while K > len(old):
new = []
K -= len(old)
for i in range(len(old)):
tmp = old[i]
l = tmp % 10
if l != 0:
new.append(tmp*10+l-1)
new.append(tmp*10+l)
if l != 9:
ne... | 18 | 21 | 411 | 375 | K = int(eval(input()))
import copy
present = [1, 2, 3, 4, 5, 6, 7, 8, 9]
while K >= len(present):
K -= len(present)
next = []
for i in range(len(present)):
tmp = present[i]
r = tmp % 10
if r != 0:
next.append(tmp * 10 + r - 1)
next.append(tmp * 10 + r)
if... | K = int(eval(input()))
old = []
old = [i for i in range(1, 10)]
while K > len(old):
new = []
K -= len(old)
for i in range(len(old)):
tmp = old[i]
l = tmp % 10
if l != 0:
new.append(tmp * 10 + l - 1)
new.append(tmp * 10 + l)
if l != 9:
new.appen... | false | 14.285714 | [
"-import copy",
"-",
"-present = [1, 2, 3, 4, 5, 6, 7, 8, 9]",
"-while K >= len(present):",
"- K -= len(present)",
"- next = []",
"- for i in range(len(present)):",
"- tmp = present[i]",
"- r = tmp % 10",
"- if r != 0:",
"- next.append(tmp * 10 + r - 1)",... | false | 0.039371 | 0.106026 | 0.371333 | [
"s728428856",
"s703033930"
] |
u513081876 | p03478 | python | s162004071 | s579930027 | 36 | 32 | 2,940 | 3,060 | Accepted | Accepted | 11.11 | N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N+1):
if A <= sum([int(_) for _ in list(str(i))]) <=B:
ans += i
print(ans) | N, A, B = list(map(int, input().split()))
keta = [sum([int(i) for i in str(i)]) for i in range(1, N+1)]
ans = 0
for index, i in enumerate(keta):
if A <= i <= B:
ans += index+1
print(ans) | 7 | 7 | 155 | 198 | N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
if A <= sum([int(_) for _ in list(str(i))]) <= B:
ans += i
print(ans)
| N, A, B = list(map(int, input().split()))
keta = [sum([int(i) for i in str(i)]) for i in range(1, N + 1)]
ans = 0
for index, i in enumerate(keta):
if A <= i <= B:
ans += index + 1
print(ans)
| false | 0 | [
"+keta = [sum([int(i) for i in str(i)]) for i in range(1, N + 1)]",
"-for i in range(1, N + 1):",
"- if A <= sum([int(_) for _ in list(str(i))]) <= B:",
"- ans += i",
"+for index, i in enumerate(keta):",
"+ if A <= i <= B:",
"+ ans += index + 1"
] | false | 0.046447 | 0.089572 | 0.518543 | [
"s162004071",
"s579930027"
] |
u644907318 | p03565 | python | s122667416 | s298909497 | 74 | 66 | 63,216 | 62,064 | Accepted | Accepted | 10.81 | S = input().strip()
N=len(S)
T = input().strip()
M=len(T)
A = []
for i in range(N-M+1):
flag = 0
for j in range(i,i+M):
if S[j]=="?" or S[j]==T[j-i]:continue
else:
flag=1
break
if flag==0:
X = list(S)
for j in range(i,i+M):
X... | S = input().strip()
N = len(S)
T = input().strip()
K = len(T)
flag = 0
ind = -1
for i in range(N-K,-1,-1):
A = list(S[i:i+K])
flag = 0
for j in range(K):
if A[j]!="?" and A[j]!=T[j]:
flag = 1
break
if flag == 0:
ind = i
break
if ind<0:
... | 25 | 27 | 528 | 538 | S = input().strip()
N = len(S)
T = input().strip()
M = len(T)
A = []
for i in range(N - M + 1):
flag = 0
for j in range(i, i + M):
if S[j] == "?" or S[j] == T[j - i]:
continue
else:
flag = 1
break
if flag == 0:
X = list(S)
for j in range(i,... | S = input().strip()
N = len(S)
T = input().strip()
K = len(T)
flag = 0
ind = -1
for i in range(N - K, -1, -1):
A = list(S[i : i + K])
flag = 0
for j in range(K):
if A[j] != "?" and A[j] != T[j]:
flag = 1
break
if flag == 0:
ind = i
break
if ind < 0:
pr... | false | 7.407407 | [
"-M = len(T)",
"-A = []",
"-for i in range(N - M + 1):",
"+K = len(T)",
"+flag = 0",
"+ind = -1",
"+for i in range(N - K, -1, -1):",
"+ A = list(S[i : i + K])",
"- for j in range(i, i + M):",
"- if S[j] == \"?\" or S[j] == T[j - i]:",
"- continue",
"- else:",
"... | false | 0.044971 | 0.046373 | 0.969764 | [
"s122667416",
"s298909497"
] |
u714642969 | p02782 | python | s099069357 | s028664477 | 448 | 362 | 86,256 | 85,488 | Accepted | Accepted | 19.2 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
def main():
r,c,rr,cc=map(int,in... | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
def main():
r,c,rr,cc=map(int,in... | 38 | 36 | 1,035 | 1,014 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
YesNo = lambda b: bool([print("Yes")] if b else print("No"))
YESNO = lambda b: bool([print("YES")] if b else print("NO"))
int1 = lambda x: int(x) - 1
def main():
r, c, rr, cc... | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
YesNo = lambda b: bool([print("Yes")] if b else print("No"))
YESNO = lambda b: bool([print("YES")] if b else print("NO"))
int1 = lambda x: int(x) - 1
def main():
r, c, rr, cc... | false | 5.263158 | [
"- ans = 0",
"- for i in range(c, cc + 1):",
"- ans += COM(rr + i + 1, i + 1) - COM(r + i, i + 1)",
"- ans %= MOD",
"+ ans = (",
"+ COM(rr + cc + 2, rr + 1)",
"+ - COM(rr + c + 1, c)",
"+ - COM(r + cc + 1, r)",
"+ + COM(r + c, r)",
"+ )",
"+ ... | false | 0.049801 | 0.048981 | 1.016753 | [
"s099069357",
"s028664477"
] |
u945181840 | p02725 | python | s472607061 | s395371576 | 105 | 82 | 25,196 | 25,124 | Accepted | Accepted | 21.9 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
K, N, *A = list(map(int, read().split()))
A.append(K + A[0])
D = 0
for i, j in zip(A, A[1:]):
d = j - i
if d > D:
D = d
print((K - D))
| import sys
read = sys.stdin.read
readline = sys.stdin.readline
K, N, *A = list(map(int, read().split()))
A.append(K + A[0])
d = [j - i for i, j in zip(A, A[1:])]
print((K - max(d)))
| 14 | 10 | 222 | 186 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
K, N, *A = list(map(int, read().split()))
A.append(K + A[0])
D = 0
for i, j in zip(A, A[1:]):
d = j - i
if d > D:
D = d
print((K - D))
| import sys
read = sys.stdin.read
readline = sys.stdin.readline
K, N, *A = list(map(int, read().split()))
A.append(K + A[0])
d = [j - i for i, j in zip(A, A[1:])]
print((K - max(d)))
| false | 28.571429 | [
"-D = 0",
"-for i, j in zip(A, A[1:]):",
"- d = j - i",
"- if d > D:",
"- D = d",
"-print((K - D))",
"+d = [j - i for i, j in zip(A, A[1:])]",
"+print((K - max(d)))"
] | false | 0.037805 | 0.075946 | 0.497789 | [
"s472607061",
"s395371576"
] |
u985972698 | p02695 | python | s186516427 | s733653515 | 1,675 | 937 | 9,236 | 9,100 | Accepted | Accepted | 44.06 | # -*- coding: utf-8 -*-
def input_one_number():
return int(eval(input()))
def input_multiple_number():
return list(map(int, input().split()))
def input_multiple_number_as_list():
return list(map(int, input().split()))
N,M,Q = input_multiple_number()
lists = []
for i in range(Q):
lis... | # -*- coding: utf-8 -*-
def input_one_number():
return int(eval(input()))
def input_multiple_number():
return list(map(int, input().split()))
def input_multiple_number_as_list():
return list(map(int, input().split()))
N,M,Q = input_multiple_number()
lists = []
for i in range(Q):
lis... | 43 | 35 | 915 | 644 | # -*- coding: utf-8 -*-
def input_one_number():
return int(eval(input()))
def input_multiple_number():
return list(map(int, input().split()))
def input_multiple_number_as_list():
return list(map(int, input().split()))
N, M, Q = input_multiple_number()
lists = []
for i in range(Q):
lis = input_mult... | # -*- coding: utf-8 -*-
def input_one_number():
return int(eval(input()))
def input_multiple_number():
return list(map(int, input().split()))
def input_multiple_number_as_list():
return list(map(int, input().split()))
N, M, Q = input_multiple_number()
lists = []
for i in range(Q):
lis = input_mult... | false | 18.604651 | [
"-for i in range(1, M + 1):",
"- for i2 in range(i, M + 1):",
"- for i3 in range(i2, M + 1):",
"- for i4 in range(i3, M + 1):",
"- for i5 in range(i4, M + 1):",
"- for i6 in range(i5, M + 1):",
"- for i7 in range(i6, M + 1):",... | false | 0.098843 | 0.047844 | 2.065944 | [
"s186516427",
"s733653515"
] |
u864013199 | p03164 | python | s099908287 | s647140839 | 1,089 | 267 | 312,016 | 14,028 | Accepted | Accepted | 75.48 | N,W = list(map(int,input().split()))
w,v = [0]*N,[0]*N
for i in range(N):
w[i],v[i] = list(map(int,input().split()))
V = sum(v)
dp = [[float("inf")]*(V+1) for _ in range(N+1)]
dp[0][0] = 0
for i in range(N):
for j in range(V+1):
if j-v[i] >= 0:
dp[i+1][j] = dp[i][j-v[i]]+w[i]
... | import numpy as np
N,W = list(map(int,input().split()))
dp = np.full(N*10**3+1, W+1, dtype = np.int64)
dp[0] = 0
for i in range(N):
w,v = list(map(int,input().split()))
np.minimum(dp[:-v]+w, dp[v:], out = dp[v:])
for i in range(N*10**3+1):
if dp[i] <= W:
ans = i
print(ans)
| 19 | 14 | 432 | 298 | N, W = list(map(int, input().split()))
w, v = [0] * N, [0] * N
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
V = sum(v)
dp = [[float("inf")] * (V + 1) for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for j in range(V + 1):
if j - v[i] >= 0:
dp[i + 1][j] = dp[i][j - v[... | import numpy as np
N, W = list(map(int, input().split()))
dp = np.full(N * 10**3 + 1, W + 1, dtype=np.int64)
dp[0] = 0
for i in range(N):
w, v = list(map(int, input().split()))
np.minimum(dp[:-v] + w, dp[v:], out=dp[v:])
for i in range(N * 10**3 + 1):
if dp[i] <= W:
ans = i
print(ans)
| false | 26.315789 | [
"+import numpy as np",
"+",
"-w, v = [0] * N, [0] * N",
"+dp = np.full(N * 10**3 + 1, W + 1, dtype=np.int64)",
"+dp[0] = 0",
"- w[i], v[i] = list(map(int, input().split()))",
"-V = sum(v)",
"-dp = [[float(\"inf\")] * (V + 1) for _ in range(N + 1)]",
"-dp[0][0] = 0",
"-for i in range(N):",
"- ... | false | 0.058316 | 0.496652 | 0.117419 | [
"s099908287",
"s647140839"
] |
u634079249 | p02886 | python | s190685154 | s183006251 | 185 | 37 | 15,044 | 10,216 | Accepted | Accepted | 80 | import sys, os, math, bisect, itertools, collections, heapq, queue
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict
# import fractions
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il... | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: li... | 39 | 38 | 1,154 | 1,108 | import sys, os, math, bisect, itertools, collections, heapq, queue
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict
# import fractions
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: l... | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(i... | false | 2.564103 | [
"-from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall",
"+",
"+# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall",
"-from collections import defaultdict",
"+from collections import defaultdict, deque",
"-# import fractions",
"-# lcm = lambda x, y: (x * y) // fractions... | false | 0.114334 | 0.109536 | 1.043804 | [
"s190685154",
"s183006251"
] |
u013408661 | p03332 | python | s728507295 | s850001525 | 1,772 | 389 | 26,788 | 26,720 | Accepted | Accepted | 78.05 | n,a,b,k=list(map(int,input().split()))
p=998244353
def getinv(n):
inv=[0]*(n+1)
for i in range(1,n+1):
inv[i]=pow(i,p-2,p)
return inv
def getnCr(n):
inv=getinv(n)
nCr=[0]*(n+1)
nCr[0]=1
for i in range(1,n+1):
nCr[i]=(nCr[i-1]*(n-i+1)*inv[i])%p
return nCr
def solve(n,a,b,k):
ans=... | p=998244353
def getinv(n):
inv = [0]*(n+1)
#フェルマーの小定理より、i=1の時は1であることが分かる
inv[1] = 1
for i in range(2,n+1):
#そのまま計算すると負になってしまうので、最後にmod pを取ることで正に戻す
inv[i] = (-(p//i)*inv[p%i])%p
return inv
def getCmb(n):
#逆元を取得
inv = getinv(n)
#0 <= r <= n に対してnCrを求める
nCr = [0]*(n+1)
#r=0の時は、r... | 26 | 36 | 535 | 790 | n, a, b, k = list(map(int, input().split()))
p = 998244353
def getinv(n):
inv = [0] * (n + 1)
for i in range(1, n + 1):
inv[i] = pow(i, p - 2, p)
return inv
def getnCr(n):
inv = getinv(n)
nCr = [0] * (n + 1)
nCr[0] = 1
for i in range(1, n + 1):
nCr[i] = (nCr[i - 1] * (n -... | p = 998244353
def getinv(n):
inv = [0] * (n + 1)
# フェルマーの小定理より、i=1の時は1であることが分かる
inv[1] = 1
for i in range(2, n + 1):
# そのまま計算すると負になってしまうので、最後にmod pを取ることで正に戻す
inv[i] = (-(p // i) * inv[p % i]) % p
return inv
def getCmb(n):
# 逆元を取得
inv = getinv(n)
# 0 <= r <= n に対してnCrを... | false | 27.777778 | [
"-n, a, b, k = list(map(int, input().split()))",
"- for i in range(1, n + 1):",
"- inv[i] = pow(i, p - 2, p)",
"+ # フェルマーの小定理より、i=1の時は1であることが分かる",
"+ inv[1] = 1",
"+ for i in range(2, n + 1):",
"+ # そのまま計算すると負になってしまうので、最後にmod pを取ることで正に戻す",
"+ inv[i] = (-(p // i) * inv[... | false | 0.359175 | 0.095341 | 3.767259 | [
"s728507295",
"s850001525"
] |
u676447154 | p02657 | python | s213593468 | s318468071 | 23 | 21 | 9,148 | 9,156 | Accepted | Accepted | 8.7 | a,b = input().split()
print((int(a)*int(b)))
| a,b = list(map(int,input().split()))
print((a*b)) | 3 | 3 | 46 | 44 | a, b = input().split()
print((int(a) * int(b)))
| a, b = list(map(int, input().split()))
print((a * b))
| false | 0 | [
"-a, b = input().split()",
"-print((int(a) * int(b)))",
"+a, b = list(map(int, input().split()))",
"+print((a * b))"
] | false | 0.114168 | 0.152758 | 0.747381 | [
"s213593468",
"s318468071"
] |
u853619096 | p02407 | python | s207427680 | s541308233 | 30 | 20 | 7,648 | 7,636 | Accepted | Accepted | 33.33 | n=eval(input())
n=int(n)
a=input().split()
a=a[::-1]
print((" ".join(a))) | n=int(eval(input()))
a=list(map(str,input().split()))
a=a[::-1]
print((" ".join(a))) | 5 | 4 | 69 | 79 | n = eval(input())
n = int(n)
a = input().split()
a = a[::-1]
print((" ".join(a)))
| n = int(eval(input()))
a = list(map(str, input().split()))
a = a[::-1]
print((" ".join(a)))
| false | 20 | [
"-n = eval(input())",
"-n = int(n)",
"-a = input().split()",
"+n = int(eval(input()))",
"+a = list(map(str, input().split()))"
] | false | 0.129919 | 0.037145 | 3.497618 | [
"s207427680",
"s541308233"
] |
u307516601 | p02983 | python | s341161343 | s351937643 | 782 | 57 | 3,064 | 3,064 | Accepted | Accepted | 92.71 | import sys
sys.setrecursionlimit(10**6)
l, r = list(map(int, input().split()))
MOD = 2019
#n = 2019
#pf = {}
#
#for i in range(2,int(n**0.5)+1):
# while n % i == 0:
# pf[i] = pf.get(i,0) + 1
# n //= i
#if n > 1: pf[n] = 1
#print(pf)
## 2019=3*673
import itertools
l_mod = l%MOD
... | import sys
sys.setrecursionlimit(10**6)
l, r = list(map(int, input().split()))
MOD = 2019
#n = 2019
#pf = {}
#
#for i in range(2,int(n**0.5)+1):
# while n % i == 0:
# pf[i] = pf.get(i,0) + 1
# n //= i
#if n > 1: pf[n] = 1
#print(pf)
## 2019=3*673
import itertools
l_mod = l%MOD
... | 37 | 37 | 674 | 674 | import sys
sys.setrecursionlimit(10**6)
l, r = list(map(int, input().split()))
MOD = 2019
# n = 2019
# pf = {}
#
# for i in range(2,int(n**0.5)+1):
# while n % i == 0:
# pf[i] = pf.get(i,0) + 1
# n //= i
# if n > 1: pf[n] = 1
# print(pf)
## 2019=3*673
import itertools
l_mod = l % MOD
r_mod = r % MOD
... | import sys
sys.setrecursionlimit(10**6)
l, r = list(map(int, input().split()))
MOD = 2019
# n = 2019
# pf = {}
#
# for i in range(2,int(n**0.5)+1):
# while n % i == 0:
# pf[i] = pf.get(i,0) + 1
# n //= i
# if n > 1: pf[n] = 1
# print(pf)
## 2019=3*673
import itertools
l_mod = l % MOD
r_mod = r % MOD
... | false | 0 | [
"- # if l_mod <= 3 <= r_mod and l_mod <= 673 <= r_mod:",
"- # ans = 0",
"- if l_mod < r_mod:",
"+ if l_mod <= 3 <= r_mod and l_mod <= 673 <= r_mod:",
"+ ans = 0",
"+ elif l_mod < r_mod:"
] | false | 0.071416 | 0.03565 | 2.003243 | [
"s341161343",
"s351937643"
] |
u119982147 | p03494 | python | s143911984 | s794589063 | 20 | 18 | 2,940 | 3,060 | Accepted | Accepted | 10 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
flag = True
while flag:
for i in range(n):
if a[i] % 2 == 1:
flag = False
break
else:
a[i] /= 2
ans += 1
print((ans-1))
| def count_of_div(n):
ret = 0
while n % 2 == 0:
n /= 2
ret += 1
return ret
n = int(eval(input()))
a = list(map(int, input().split()))
ans = min(list(map(count_of_div, a)))
print(ans) | 14 | 12 | 253 | 210 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
flag = True
while flag:
for i in range(n):
if a[i] % 2 == 1:
flag = False
break
else:
a[i] /= 2
ans += 1
print((ans - 1))
| def count_of_div(n):
ret = 0
while n % 2 == 0:
n /= 2
ret += 1
return ret
n = int(eval(input()))
a = list(map(int, input().split()))
ans = min(list(map(count_of_div, a)))
print(ans)
| false | 14.285714 | [
"+def count_of_div(n):",
"+ ret = 0",
"+ while n % 2 == 0:",
"+ n /= 2",
"+ ret += 1",
"+ return ret",
"+",
"+",
"-ans = 0",
"-flag = True",
"-while flag:",
"- for i in range(n):",
"- if a[i] % 2 == 1:",
"- flag = False",
"- break",
... | false | 0.04924 | 0.039754 | 1.238614 | [
"s143911984",
"s794589063"
] |
u644907318 | p03331 | python | s849817651 | s881541896 | 105 | 93 | 73,444 | 67,828 | Accepted | Accepted | 11.43 | N = int(eval(input()))
cmin = 1000
for i in range(1,N):
a = str(i)
cnt = 0
for j in range(len(a)):
cnt += int(a[j])
b = str(N-i)
for j in range(len(b)):
cnt += int(b[j])
cmin = min(cmin,cnt)
print(cmin) | N = int(eval(input()))
cmin = N
for i in range(1,N//2):
j = N-i
a = str(i)
b = str(j)
cnt = 0
for k in range(len(a)):
cnt += int(a[k])
for k in range(len(b)):
cnt += int(b[k])
cmin = min(cmin,cnt)
print(cmin) | 12 | 13 | 247 | 258 | N = int(eval(input()))
cmin = 1000
for i in range(1, N):
a = str(i)
cnt = 0
for j in range(len(a)):
cnt += int(a[j])
b = str(N - i)
for j in range(len(b)):
cnt += int(b[j])
cmin = min(cmin, cnt)
print(cmin)
| N = int(eval(input()))
cmin = N
for i in range(1, N // 2):
j = N - i
a = str(i)
b = str(j)
cnt = 0
for k in range(len(a)):
cnt += int(a[k])
for k in range(len(b)):
cnt += int(b[k])
cmin = min(cmin, cnt)
print(cmin)
| false | 7.692308 | [
"-cmin = 1000",
"-for i in range(1, N):",
"+cmin = N",
"+for i in range(1, N // 2):",
"+ j = N - i",
"+ b = str(j)",
"- for j in range(len(a)):",
"- cnt += int(a[j])",
"- b = str(N - i)",
"- for j in range(len(b)):",
"- cnt += int(b[j])",
"+ for k in range(len(a... | false | 0.165293 | 0.117486 | 1.406923 | [
"s849817651",
"s881541896"
] |
u137912513 | p02684 | python | s912210207 | s058180146 | 435 | 144 | 248,688 | 102,572 | Accepted | Accepted | 66.9 | n,k = list(map(int, input().split()))
A = tuple(map(int,input().split()))
import sys
sys.setrecursionlimit(1000000000)
from collections import deque
seen = [0 for i in range(n)]
hist = deque([]) # 頂点の訪問履歴
pos = -1 # サイクルの1成分 -1はサイクル未発見
def dfs(x, p): # pはxの親
global pos # global!!!!!!!!!!!... | n,k = list(map(int ,input().split()))
A = tuple(map(int, input().split()))
seen = [-1]*n
tmp = 0
count = 0
while True:
tmp = A[tmp]-1
count +=1
if seen[tmp] != -1:
seennum = seen.count(1)
tm = tmp
se = [-1]*n
roopmem = []
while True:
if... | 53 | 38 | 1,065 | 715 | n, k = list(map(int, input().split()))
A = tuple(map(int, input().split()))
import sys
sys.setrecursionlimit(1000000000)
from collections import deque
seen = [0 for i in range(n)]
hist = deque([]) # 頂点の訪問履歴
pos = -1 # サイクルの1成分 -1はサイクル未発見
def dfs(x, p): # pはxの親
global pos # global!!!!!!!!!!!!!!!!!!!!!!!!!!!!... | n, k = list(map(int, input().split()))
A = tuple(map(int, input().split()))
seen = [-1] * n
tmp = 0
count = 0
while True:
tmp = A[tmp] - 1
count += 1
if seen[tmp] != -1:
seennum = seen.count(1)
tm = tmp
se = [-1] * n
roopmem = []
while True:
if se[tm] != -... | false | 28.301887 | [
"-import sys",
"-",
"-sys.setrecursionlimit(1000000000)",
"-from collections import deque",
"-",
"-seen = [0 for i in range(n)]",
"-hist = deque([]) # 頂点の訪問履歴",
"-pos = -1 # サイクルの1成分 -1はサイクル未発見",
"-",
"-",
"-def dfs(x, p): # pはxの親",
"- global pos # global!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"... | false | 0.038233 | 0.038357 | 0.996774 | [
"s912210207",
"s058180146"
] |
u642120132 | p03160 | python | s024623291 | s555645319 | 181 | 130 | 13,980 | 13,928 | Accepted | Accepted | 28.18 | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float('inf')]*N
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))
print((dp[N-1])) | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float('inf')]*N
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))
print((dp[N-1])) | 9 | 8 | 256 | 227 | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * N
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[N - 1]))
| N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * N
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[N - 1]))
| false | 11.111111 | [
"- dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))",
"- dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))",
"+ dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))"
] | false | 0.1155 | 0.120406 | 0.959248 | [
"s024623291",
"s555645319"
] |
u576432509 | p03681 | python | s899782939 | s835603000 | 92 | 57 | 3,188 | 3,060 | Accepted | Accepted | 38.04 | # ==================== mod 10**9+7
mod=10**9+7
def mul(a, b):
return ((a % mod) * (b % mod)) % mod
n,m=list(map(int,input().split()))
if n==1 and m==1:
print((2))
elif n==2 and m==1:
print((2))
elif n==1 and m==2:
print((2))
elif n==2 and m==2:
print((8))
elif n+2<=m:
p... | n,m=list(map(int,input().split()))
if abs(n-m)>=2:
print((0))
else:
nm=1
p=10**9+7
for ni in range(1,n+1):
nm=nm*ni%p
for ni in range(1,m+1):
nm=nm*ni%p
if abs(n-m)==1:
print(nm)
else:
print(((2*nm)%p)) | 43 | 15 | 754 | 267 | # ==================== mod 10**9+7
mod = 10**9 + 7
def mul(a, b):
return ((a % mod) * (b % mod)) % mod
n, m = list(map(int, input().split()))
if n == 1 and m == 1:
print((2))
elif n == 2 and m == 1:
print((2))
elif n == 1 and m == 2:
print((2))
elif n == 2 and m == 2:
print((8))
elif n + 2 <= m:... | n, m = list(map(int, input().split()))
if abs(n - m) >= 2:
print((0))
else:
nm = 1
p = 10**9 + 7
for ni in range(1, n + 1):
nm = nm * ni % p
for ni in range(1, m + 1):
nm = nm * ni % p
if abs(n - m) == 1:
print(nm)
else:
print(((2 * nm) % p))
| false | 65.116279 | [
"-# ==================== mod 10**9+7",
"-mod = 10**9 + 7",
"-",
"-",
"-def mul(a, b):",
"- return ((a % mod) * (b % mod)) % mod",
"-",
"-",
"-if n == 1 and m == 1:",
"- print((2))",
"-elif n == 2 and m == 1:",
"- print((2))",
"-elif n == 1 and m == 2:",
"- print((2))",
"-elif... | false | 0.038811 | 0.039982 | 0.970724 | [
"s899782939",
"s835603000"
] |
u780475861 | p02822 | python | s875321338 | s858492367 | 1,083 | 906 | 64,120 | 59,304 | Accepted | Accepted | 16.34 | import sys
readline = sys.stdin.buffer.readline
N = int(readline())
graph = [[] for _ in range(N + 1)]
for i in range(N - 1):
a, b = list(map(int, readline().split()))
lb = 1 << i
graph[a].append(b)
graph[b].append(a)
root = 1
parent = [0] * (N + 1)
order = []
stack = [root]
while stack... | import sys
readline = sys.stdin.readline
N = int(readline())
graph = [[] for _ in range(N + 1)]
for i in range(N - 1):
a, b = list(map(int, readline().split()))
graph[a].append(b)
graph[b].append(a)
parent = [0] * (N + 1)
order = []
stack = [1]
while stack:
x = stack.pop()
order.app... | 47 | 37 | 982 | 844 | import sys
readline = sys.stdin.buffer.readline
N = int(readline())
graph = [[] for _ in range(N + 1)]
for i in range(N - 1):
a, b = list(map(int, readline().split()))
lb = 1 << i
graph[a].append(b)
graph[b].append(a)
root = 1
parent = [0] * (N + 1)
order = []
stack = [root]
while stack:
x = stack.... | import sys
readline = sys.stdin.readline
N = int(readline())
graph = [[] for _ in range(N + 1)]
for i in range(N - 1):
a, b = list(map(int, readline().split()))
graph[a].append(b)
graph[b].append(a)
parent = [0] * (N + 1)
order = []
stack = [1]
while stack:
x = stack.pop()
order.append(x)
for y... | false | 21.276596 | [
"-readline = sys.stdin.buffer.readline",
"+readline = sys.stdin.readline",
"- lb = 1 << i",
"-root = 1",
"-stack = [root]",
"+stack = [1]",
"-x = (MOD + 1) // 2",
"-power_inv = [1] * (N + 100)",
"-for i in range(1, N + 100):",
"- power_inv[i] = power_inv[i - 1] * x % MOD",
"+half = pow(2, ... | false | 0.115827 | 0.047447 | 2.441196 | [
"s875321338",
"s858492367"
] |
u321035578 | p02642 | python | s567823011 | s880160844 | 454 | 281 | 38,736 | 38,564 | Accepted | Accepted | 38.11 | def main():
n = int(eval(input()))
a = list(map(int,input().split()))
ans = 0
from collections import Counter
cnt = Counter(a)
lim = max(a) + 1
tmp = [0] * (lim)
# set_a = list(set(a))
# set_a.sort()
a.sort()
for aa in a:
if tmp[aa] == 0:
... | def main():
n = int(eval(input()))
a = list(map(int,input().split()))
ans = 0
from collections import Counter
cnt = Counter(a)
lim = max(a) + 1
tmp = [0] * (lim)
# set_a = list(set(a))
# set_a.sort()
a.sort()
for aa in a:
if tmp[aa] == 0:
... | 31 | 30 | 585 | 527 | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
from collections import Counter
cnt = Counter(a)
lim = max(a) + 1
tmp = [0] * (lim)
# set_a = list(set(a))
# set_a.sort()
a.sort()
for aa in a:
if tmp[aa] == 0:
for j in range(... | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
from collections import Counter
cnt = Counter(a)
lim = max(a) + 1
tmp = [0] * (lim)
# set_a = list(set(a))
# set_a.sort()
a.sort()
for aa in a:
if tmp[aa] == 0:
for j in range(... | false | 3.225806 | [
"- for j in range(lim):",
"- if aa * j > lim - 1:",
"- break",
"- tmp[aa * j] = 1",
"+ for j in range(aa, lim, aa):",
"+ tmp[j] = 1"
] | false | 0.040891 | 0.040099 | 1.019759 | [
"s567823011",
"s880160844"
] |
u201387466 | p03160 | python | s771368671 | s597679175 | 232 | 148 | 52,208 | 13,980 | Accepted | Accepted | 36.21 | N = int(eval(input()))
h = list(map(int,input().split()))
H = [0]*N
for i in range(1,N):
if i == 1:
H[i] = abs(h[1]-h[0])
else:
H[i] = min(H[i-1]+abs(h[i]-h[i-1]),H[i-2]+abs(h[i]-h[i-2]))
print((H[N-1])) | N = int(eval(input()))
h = list(map(int,input().split()))
H = [0]*N
for i in range(1,N):
if i == 1:
H[i] = abs(h[1]-h[0])
else:
H[i] = H[i-1]+abs(h[i]-h[i-1])
if H[i] > H[i-2]+abs(h[i]-h[i-2]):
H[i] = H[i-2]+abs(h[i]-h[i-2])
print((H[N-1]))
| 9 | 11 | 227 | 287 | N = int(eval(input()))
h = list(map(int, input().split()))
H = [0] * N
for i in range(1, N):
if i == 1:
H[i] = abs(h[1] - h[0])
else:
H[i] = min(H[i - 1] + abs(h[i] - h[i - 1]), H[i - 2] + abs(h[i] - h[i - 2]))
print((H[N - 1]))
| N = int(eval(input()))
h = list(map(int, input().split()))
H = [0] * N
for i in range(1, N):
if i == 1:
H[i] = abs(h[1] - h[0])
else:
H[i] = H[i - 1] + abs(h[i] - h[i - 1])
if H[i] > H[i - 2] + abs(h[i] - h[i - 2]):
H[i] = H[i - 2] + abs(h[i] - h[i - 2])
print((H[N - 1]))
| false | 18.181818 | [
"- H[i] = min(H[i - 1] + abs(h[i] - h[i - 1]), H[i - 2] + abs(h[i] - h[i - 2]))",
"+ H[i] = H[i - 1] + abs(h[i] - h[i - 1])",
"+ if H[i] > H[i - 2] + abs(h[i] - h[i - 2]):",
"+ H[i] = H[i - 2] + abs(h[i] - h[i - 2])"
] | false | 0.041542 | 0.036635 | 1.133955 | [
"s771368671",
"s597679175"
] |
u477320129 | p02550 | python | s300381834 | s055814341 | 170 | 129 | 17,500 | 9,308 | Accepted | Accepted | 24.12 | #!/usr/bin/env python3
import sys
# https://en.wikipedia.org/wiki/Cycle_detection
def floyd_cycle_finding(f, x0):
'''
循環していない部分の長さをlam
循環部分の長さをmuとして
(lam, mu)
を返す
>>> floyd_cycle_finding(lambda x: x**2 % 3, 2)
(1, 1)
>>> floyd_cycle_finding(lambda x: x**2 % 1001, 2)
(2,... | #!/usr/bin/env python3
import sys
# https://en.wikipedia.org/wiki/Cycle_detection
def floyd_cycle_finding(f, x0):
'''
循環していない部分の長さをlam
循環部分の長さをmuとして
(lam, mu)
を返す
>>> floyd_cycle_finding(lambda x: x**2 % 3, 2)
(1, 1)
>>> floyd_cycle_finding(lambda x: x**2 % 1001, 2)
(2,... | 92 | 79 | 2,201 | 1,879 | #!/usr/bin/env python3
import sys
# https://en.wikipedia.org/wiki/Cycle_detection
def floyd_cycle_finding(f, x0):
"""
循環していない部分の長さをlam
循環部分の長さをmuとして
(lam, mu)
を返す
>>> floyd_cycle_finding(lambda x: x**2 % 3, 2)
(1, 1)
>>> floyd_cycle_finding(lambda x: x**2 % 1001, 2)
(2, 4)
>>> f... | #!/usr/bin/env python3
import sys
# https://en.wikipedia.org/wiki/Cycle_detection
def floyd_cycle_finding(f, x0):
"""
循環していない部分の長さをlam
循環部分の長さをmuとして
(lam, mu)
を返す
>>> floyd_cycle_finding(lambda x: x**2 % 3, 2)
(1, 1)
>>> floyd_cycle_finding(lambda x: x**2 % 1001, 2)
(2, 4)
>>> f... | false | 14.130435 | [
"- # a_i = a_j",
"- # の関係が成り立つ時",
"- # a_{lam+n+k*mu} = a_{lam+n+k'*mu}",
"- # より|i-j|は循環の長さの整数倍になる",
"- # そこで",
"- # a_m = a_2m",
"- # なるmを見つける",
"- # 前述の性質からmは循環の長さの整数倍となっているため",
"- # 2m - m = m = k*mu = lam + n + k'*mu",
"- # したがって、lam + nはmuの倍数となるので",
"- # 地点... | false | 0.408121 | 0.079787 | 5.115122 | [
"s300381834",
"s055814341"
] |
u325282913 | p02743 | python | s587442019 | s233571872 | 292 | 34 | 60,396 | 5,076 | Accepted | Accepted | 88.36 | from decimal import *
getcontext().prec = 50
a, b ,c = list(map(int, input().split()))
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print('Yes')
else:
print('No') | from decimal import *
getcontext().prec = 28
a, b ,c = list(map(int, input().split()))
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print('Yes')
else:
print('No') | 7 | 7 | 187 | 187 | from decimal import *
getcontext().prec = 50
a, b, c = list(map(int, input().split()))
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print("Yes")
else:
print("No")
| from decimal import *
getcontext().prec = 28
a, b, c = list(map(int, input().split()))
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print("Yes")
else:
print("No")
| false | 0 | [
"-getcontext().prec = 50",
"+getcontext().prec = 28"
] | false | 0.042562 | 0.118099 | 0.360393 | [
"s587442019",
"s233571872"
] |
u276032781 | p03160 | python | s591587595 | s807793533 | 270 | 222 | 96,656 | 96,676 | Accepted | Accepted | 17.78 | import sys
sys.setrecursionlimit(500000)
def get_cost(arr, n, dp):
if dp[n] != float('inf'):
return dp[n]
if n == 1:
dp[1] = abs(arr[1] - arr[0])
return dp[1]
elif n == 0:
dp[0] = 0
return dp[0]
else:
dp[n] = min(
abs(arr[n] - arr[n-1]) + get_cost(arr, n-1, dp),
... | import sys
sys.setrecursionlimit(500000)
def get_cost(arr, n, dp):
if dp[n] != -1:
return dp[n]
if n == 1:
dp[1] = abs(arr[1] - arr[0])
return dp[1]
elif n == 0:
dp[0] = 0
return dp[0]
else:
dp[n] = min(
abs(arr[n] - arr[n-1]) + get_cost(arr, n-1, dp),
abs(arr... | 24 | 24 | 525 | 505 | import sys
sys.setrecursionlimit(500000)
def get_cost(arr, n, dp):
if dp[n] != float("inf"):
return dp[n]
if n == 1:
dp[1] = abs(arr[1] - arr[0])
return dp[1]
elif n == 0:
dp[0] = 0
return dp[0]
else:
dp[n] = min(
abs(arr[n] - arr[n - 1]) + ... | import sys
sys.setrecursionlimit(500000)
def get_cost(arr, n, dp):
if dp[n] != -1:
return dp[n]
if n == 1:
dp[1] = abs(arr[1] - arr[0])
return dp[1]
elif n == 0:
dp[0] = 0
return dp[0]
else:
dp[n] = min(
abs(arr[n] - arr[n - 1]) + get_cost(a... | false | 0 | [
"- if dp[n] != float(\"inf\"):",
"+ if dp[n] != -1:",
"-dp_arr = [float(\"inf\")] * N",
"+dp_arr = [-1] * N"
] | false | 0.047043 | 0.047642 | 0.987436 | [
"s591587595",
"s807793533"
] |
u844789719 | p02556 | python | s960147919 | s678249513 | 738 | 519 | 58,780 | 58,112 | Accepted | Accepted | 29.67 | N = int(eval(input()))
XY = [[int(_) for _ in input().split()] for _ in range(N)]
ans = -1
for dx, dy in ((1, 1), (-1, 1), (-1, -1), (1, -1)):
xy2 = sorted(x * dx + y * dy for x, y in XY)
ans = max(ans, max(xy2) - min(xy2))
print(ans)
| N = int(eval(input()))
XY = [[int(_) for _ in input().split()] for _ in range(N)]
ans = -1
for dx, dy in ((1, 1), (-1, 1), (-1, -1), (1, -1)):
xy2 = [x * dx + y * dy for x, y in XY]
ans = max(ans, max(xy2) - min(xy2))
print(ans)
| 7 | 7 | 243 | 237 | N = int(eval(input()))
XY = [[int(_) for _ in input().split()] for _ in range(N)]
ans = -1
for dx, dy in ((1, 1), (-1, 1), (-1, -1), (1, -1)):
xy2 = sorted(x * dx + y * dy for x, y in XY)
ans = max(ans, max(xy2) - min(xy2))
print(ans)
| N = int(eval(input()))
XY = [[int(_) for _ in input().split()] for _ in range(N)]
ans = -1
for dx, dy in ((1, 1), (-1, 1), (-1, -1), (1, -1)):
xy2 = [x * dx + y * dy for x, y in XY]
ans = max(ans, max(xy2) - min(xy2))
print(ans)
| false | 0 | [
"- xy2 = sorted(x * dx + y * dy for x, y in XY)",
"+ xy2 = [x * dx + y * dy for x, y in XY]"
] | false | 0.107133 | 0.037756 | 2.837467 | [
"s960147919",
"s678249513"
] |
u598229387 | p03409 | python | s285800923 | s395998249 | 22 | 18 | 3,316 | 3,188 | Accepted | Accepted | 18.18 | from collections import defaultdict
n=int(eval(input()))
ab=[[int(i) for i in input().split()] for j in range(n)]
cd=[[int(i) for i in input().split()] for j in range(n)]
ab.sort()
cd.sort()
ans=0
for i in cd:
check=-1
pair=[-1,-1]
for j in ab:
if j[0]>i[0]:
... | import bisect
n=int(eval(input()))
ab=[[int(i) for i in input().split()] for j in range(n)]
cd=[[int(i) for i in input().split()] for j in range(n)]
ab.sort()
cd.sort()
ans=0
for c,d in cd:
now_y=-1
check=False
for a,b in ab:
if a>=c:
break
if b<d and b>now_y:
... | 25 | 26 | 479 | 499 | from collections import defaultdict
n = int(eval(input()))
ab = [[int(i) for i in input().split()] for j in range(n)]
cd = [[int(i) for i in input().split()] for j in range(n)]
ab.sort()
cd.sort()
ans = 0
for i in cd:
check = -1
pair = [-1, -1]
for j in ab:
if j[0] > i[0]:
break
... | import bisect
n = int(eval(input()))
ab = [[int(i) for i in input().split()] for j in range(n)]
cd = [[int(i) for i in input().split()] for j in range(n)]
ab.sort()
cd.sort()
ans = 0
for c, d in cd:
now_y = -1
check = False
for a, b in ab:
if a >= c:
break
if b < d and b > now_y... | false | 3.846154 | [
"-from collections import defaultdict",
"+import bisect",
"-for i in cd:",
"- check = -1",
"- pair = [-1, -1]",
"- for j in ab:",
"- if j[0] > i[0]:",
"+for c, d in cd:",
"+ now_y = -1",
"+ check = False",
"+ for a, b in ab:",
"+ if a >= c:",
"- if chec... | false | 0.047735 | 0.036723 | 1.299868 | [
"s285800923",
"s395998249"
] |
u158380546 | p02659 | python | s961624697 | s508527877 | 24 | 21 | 9,044 | 9,172 | Accepted | Accepted | 12.5 | a, b = list(map(float, input().split()));
c = int(1000*b);
d = int(a);
e = int(c * d // 1000 );
print(e); | a, b = list(map(str, input().split()));
c = int(b[0]+b[2:]);
d = int(a);
e = int(c * d // 100 );
print(e); | 5 | 5 | 103 | 104 | a, b = list(map(float, input().split()))
c = int(1000 * b)
d = int(a)
e = int(c * d // 1000)
print(e)
| a, b = list(map(str, input().split()))
c = int(b[0] + b[2:])
d = int(a)
e = int(c * d // 100)
print(e)
| false | 0 | [
"-a, b = list(map(float, input().split()))",
"-c = int(1000 * b)",
"+a, b = list(map(str, input().split()))",
"+c = int(b[0] + b[2:])",
"-e = int(c * d // 1000)",
"+e = int(c * d // 100)"
] | false | 0.035346 | 0.036753 | 0.961729 | [
"s961624697",
"s508527877"
] |
u512212329 | p03449 | python | s035005211 | s377215720 | 166 | 18 | 38,512 | 2,940 | Accepted | Accepted | 89.16 | def main():
n = int(eval(input()))
matrix = []
matrix.append([int(num) for num in input().split()])
matrix.append([int(num) for num in input().split()])
# RE: matrix = [int(num) for num in (input().split() for i in range(2))]
candies = [sum(matrix[0][:d+1]) + sum(matrix[1][d:]) for d in... | def main():
n = int(eval(input()))
matrix = [[int(num) for num in input().split()] for _ in range(2)]
candies = [sum(matrix[0][:d+1]) + sum(matrix[1][d:]) for d in range(n)]
print((max(candies)))
if __name__ == '__main__':
main()
| 13 | 10 | 394 | 254 | def main():
n = int(eval(input()))
matrix = []
matrix.append([int(num) for num in input().split()])
matrix.append([int(num) for num in input().split()])
# RE: matrix = [int(num) for num in (input().split() for i in range(2))]
candies = [sum(matrix[0][: d + 1]) + sum(matrix[1][d:]) for d in rang... | def main():
n = int(eval(input()))
matrix = [[int(num) for num in input().split()] for _ in range(2)]
candies = [sum(matrix[0][: d + 1]) + sum(matrix[1][d:]) for d in range(n)]
print((max(candies)))
if __name__ == "__main__":
main()
| false | 23.076923 | [
"- matrix = []",
"- matrix.append([int(num) for num in input().split()])",
"- matrix.append([int(num) for num in input().split()])",
"- # RE: matrix = [int(num) for num in (input().split() for i in range(2))]",
"+ matrix = [[int(num) for num in input().split()] for _ in range(2)]"
] | false | 0.035008 | 0.035717 | 0.980155 | [
"s035005211",
"s377215720"
] |
u863442865 | p02756 | python | s180672586 | s692814456 | 988 | 116 | 4,744 | 10,248 | Accepted | Accepted | 88.26 | def main():
from sys import stdin
#input = sys.stdin.readline
#sys.setrecursionlimit(10000000)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations
#from itertools import accumulate, product
from bisect impor... | #AC出てから!ファイル整理!
#コンテストはatcoder.pyで!
#A:
#B:
#C:
#D:
#DP
#ナップザックの残り
#56と復習
import sys
#input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations
#from itertools import accumulate... | 40 | 63 | 1,055 | 1,553 | def main():
from sys import stdin
# input = sys.stdin.readline
# sys.setrecursionlimit(10000000)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations
# from itertools import accumulate, product
from bisect import... | # AC出てから!ファイル整理!
# コンテストはatcoder.pyで!
# A:
# B:
# C:
# D:
# DP
# ナップザックの残り
# 56と復習
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, permutations
# from itertools import accumulate, ... | false | 36.507937 | [
"+# AC出てから!ファイル整理!",
"+# コンテストはatcoder.pyで!",
"+# A:",
"+# B:",
"+# C:",
"+# D:",
"+# DP",
"+# ナップザックの残り",
"+# 56と復習",
"+import sys",
"+",
"+# input = sys.stdin.readline",
"+sys.setrecursionlimit(10000000)",
"+from collections import Counter, deque",
"+",
"+# from collections import de... | false | 0.089086 | 0.038632 | 2.306036 | [
"s180672586",
"s692814456"
] |
u274005011 | p02622 | python | s062177865 | s166125808 | 53 | 46 | 12,444 | 9,344 | Accepted | Accepted | 13.21 | S = list(eval(input()))
T = list(eval(input()))
def count_diff(a,b):
cnt = 0
for c1,c2 in zip(a, b):
if c1 != c2:
cnt += 1
return cnt
print((count_diff(S, T))) | S = eval(input())
T = eval(input())
def count_diff(a,b):
cnt = 0
for c1,c2 in zip(a, b):
if c1 != c2:
cnt += 1
return cnt
print((count_diff(S, T))) | 13 | 13 | 197 | 185 | S = list(eval(input()))
T = list(eval(input()))
def count_diff(a, b):
cnt = 0
for c1, c2 in zip(a, b):
if c1 != c2:
cnt += 1
return cnt
print((count_diff(S, T)))
| S = eval(input())
T = eval(input())
def count_diff(a, b):
cnt = 0
for c1, c2 in zip(a, b):
if c1 != c2:
cnt += 1
return cnt
print((count_diff(S, T)))
| false | 0 | [
"-S = list(eval(input()))",
"-T = list(eval(input()))",
"+S = eval(input())",
"+T = eval(input())"
] | false | 0.034687 | 0.044303 | 0.78294 | [
"s062177865",
"s166125808"
] |
u408620326 | p03846 | python | s649623392 | s386020275 | 131 | 115 | 17,844 | 17,844 | Accepted | Accepted | 12.21 | N = int(eval(input()))
m = [2 * ((i - 1 + N % 2) // 2) + 1 - N % 2 for i in range(1, N + 1)]
for i, a in enumerate(sorted([int(a) for a in input().split()])):
if m[i] != a:
ret = 0
break
else:
ret = 2 ** (N // 2)
print((ret % (10 ** 9 + 7))) | N = int(eval(input()))
if [2 * ((i - 1 + N % 2) // 2) + 1 - N % 2 for i in range(1, N + 1)] == sorted([int(a) for a in input().split()]):
print(((2 ** (N // 2)) % (10 ** 9 + 7)))
else:
print((0)) | 10 | 5 | 255 | 193 | N = int(eval(input()))
m = [2 * ((i - 1 + N % 2) // 2) + 1 - N % 2 for i in range(1, N + 1)]
for i, a in enumerate(sorted([int(a) for a in input().split()])):
if m[i] != a:
ret = 0
break
else:
ret = 2 ** (N // 2)
print((ret % (10**9 + 7)))
| N = int(eval(input()))
if [2 * ((i - 1 + N % 2) // 2) + 1 - N % 2 for i in range(1, N + 1)] == sorted(
[int(a) for a in input().split()]
):
print(((2 ** (N // 2)) % (10**9 + 7)))
else:
print((0))
| false | 50 | [
"-m = [2 * ((i - 1 + N % 2) // 2) + 1 - N % 2 for i in range(1, N + 1)]",
"-for i, a in enumerate(sorted([int(a) for a in input().split()])):",
"- if m[i] != a:",
"- ret = 0",
"- break",
"+if [2 * ((i - 1 + N % 2) // 2) + 1 - N % 2 for i in range(1, N + 1)] == sorted(",
"+ [int(a) fo... | false | 0.0365 | 0.035696 | 1.022505 | [
"s649623392",
"s386020275"
] |
u077291787 | p03497 | python | s767815828 | s542502708 | 92 | 79 | 33,556 | 35,996 | Accepted | Accepted | 14.13 | # ARC086C - Not so Diverse (ABC081C)
from collections import Counter
def main():
_, k, *a = list(map(int, open(0).read().split()))
print((sum(sorted(list(Counter(a).values()), reverse=True)[k:])))
if __name__ == "__main__":
main() | # ABC081C - Not so Diverse (ARC086C)
from collections import Counter
def main():
n, k = list(map(int, input().rstrip().split()))
A = sorted(list(Counter(input().split()).values()), reverse=True)
print((sum(A[k:])))
if __name__ == "__main__":
main() | 11 | 12 | 242 | 265 | # ARC086C - Not so Diverse (ABC081C)
from collections import Counter
def main():
_, k, *a = list(map(int, open(0).read().split()))
print((sum(sorted(list(Counter(a).values()), reverse=True)[k:])))
if __name__ == "__main__":
main()
| # ABC081C - Not so Diverse (ARC086C)
from collections import Counter
def main():
n, k = list(map(int, input().rstrip().split()))
A = sorted(list(Counter(input().split()).values()), reverse=True)
print((sum(A[k:])))
if __name__ == "__main__":
main()
| false | 8.333333 | [
"-# ARC086C - Not so Diverse (ABC081C)",
"+# ABC081C - Not so Diverse (ARC086C)",
"- _, k, *a = list(map(int, open(0).read().split()))",
"- print((sum(sorted(list(Counter(a).values()), reverse=True)[k:])))",
"+ n, k = list(map(int, input().rstrip().split()))",
"+ A = sorted(list(Counter(input(... | false | 0.128262 | 0.071008 | 1.806318 | [
"s767815828",
"s542502708"
] |
u553623615 | p03033 | python | s690402488 | s772517158 | 1,981 | 1,792 | 111,404 | 111,376 | Accepted | Accepted | 9.54 | from ctypes import *
import subprocess as sp
from operator import itemgetter
import sys
import os.path
set_code = r"""
#include <set>
std::set<int> s;
void add(int x) {
s.insert(x);
}
bool find(int x) {
return s.find(x) != s.end();
}
void remove(int x) {
s.erase(x);
}
bool empty... | from ctypes import *
import subprocess as sp
from operator import itemgetter
import sys
import os.path
set_code = r"""
#include <set>
std::set<int> s;
void add(int x) {
s.insert(x);
}
bool find(int x) {
return s.find(x) != s.end();
}
void remove(int x) {
s.erase(x);
}
bool empty... | 91 | 90 | 1,767 | 1,726 | from ctypes import *
import subprocess as sp
from operator import itemgetter
import sys
import os.path
set_code = r"""
#include <set>
std::set<int> s;
void add(int x) {
s.insert(x);
}
bool find(int x) {
return s.find(x) != s.end();
}
void remove(int x) {
s.erase(x);
}
bool empty() {
return s.empty();
}
in... | from ctypes import *
import subprocess as sp
from operator import itemgetter
import sys
import os.path
set_code = r"""
#include <set>
std::set<int> s;
void add(int x) {
s.insert(x);
}
bool find(int x) {
return s.find(x) != s.end();
}
void remove(int x) {
s.erase(x);
}
bool empty() {
return s.empty();
}
in... | false | 1.098901 | [
"- if not os.path.exists(lib_name):",
"- code_file_name = \"tmp.cpp\"",
"- with open(code_file_name, \"w\") as f:",
"- f.write(set_code)",
"- CppSet.counter += 1",
"- sp.Popen(",
"- [",
"- \"g++\",",
... | false | 0.131844 | 0.81472 | 0.161827 | [
"s690402488",
"s772517158"
] |
u035445296 | p02952 | python | s798225669 | s583029465 | 76 | 62 | 2,940 | 6,764 | Accepted | Accepted | 18.42 | from math import log10
n = int(eval(input()))
cnt = 0
for i in range(1,n+1):
if int(log10(i)+1) % 2 != 0 and i <= n:
cnt += 1
print(cnt) | from math import log10
n =int(eval(input()))
print((len([i for i in range(1, n+1) if int(log10(i)+1) % 2 != 0 and i <= n]))) | 7 | 3 | 142 | 118 | from math import log10
n = int(eval(input()))
cnt = 0
for i in range(1, n + 1):
if int(log10(i) + 1) % 2 != 0 and i <= n:
cnt += 1
print(cnt)
| from math import log10
n = int(eval(input()))
print((len([i for i in range(1, n + 1) if int(log10(i) + 1) % 2 != 0 and i <= n])))
| false | 57.142857 | [
"-cnt = 0",
"-for i in range(1, n + 1):",
"- if int(log10(i) + 1) % 2 != 0 and i <= n:",
"- cnt += 1",
"-print(cnt)",
"+print((len([i for i in range(1, n + 1) if int(log10(i) + 1) % 2 != 0 and i <= n])))"
] | false | 0.070854 | 0.099422 | 0.712654 | [
"s798225669",
"s583029465"
] |
u630511239 | p03633 | python | s129373813 | s253707180 | 36 | 28 | 5,048 | 9,148 | Accepted | Accepted | 22.22 | N = int(eval(input()))
ans = int(eval(input()))
import fractions
for i in range(N-1):
a = int(eval(input()))
ans = (a*ans)//fractions.gcd(ans, a)
print(ans) | N = int(eval(input()))
import math
ans = int(eval(input()))
for i in range(N - 1):
a = int(eval(input()))
ans = a * ans // math.gcd(a, ans)
print(ans) | 7 | 7 | 148 | 146 | N = int(eval(input()))
ans = int(eval(input()))
import fractions
for i in range(N - 1):
a = int(eval(input()))
ans = (a * ans) // fractions.gcd(ans, a)
print(ans)
| N = int(eval(input()))
import math
ans = int(eval(input()))
for i in range(N - 1):
a = int(eval(input()))
ans = a * ans // math.gcd(a, ans)
print(ans)
| false | 0 | [
"+import math",
"+",
"-import fractions",
"-",
"- ans = (a * ans) // fractions.gcd(ans, a)",
"+ ans = a * ans // math.gcd(a, ans)"
] | false | 0.11079 | 0.038325 | 2.890832 | [
"s129373813",
"s253707180"
] |
u123756661 | p02861 | python | s485703764 | s103666355 | 211 | 107 | 45,168 | 80,732 | Accepted | Accepted | 49.29 | import itertools
def sol():
n=int(eval(input()))
d=list(itertools.permutations([i for i in range(n)]))
w=[]
for i in range(n):
x,y=list(map(int,input().split()))
w.append((x,y))
ans=chk=0
for i in d:
for j in range(len(i)-1):
ans+=((w[i[j]][0]-w[i[j... | import itertools
n=int(eval(input()))
l=[int(i) for i in range(n)]
ans=chk=p=0
w=[]
for i in range(n):
x,y=list(map(int,input().split()))
w.append((x,y))
for i in list(itertools.permutations(l,n)):
chk=0
for j in range(n-1):
chk+=((w[i[j]][0]-w[i[j+1]][0])**2+(w[i[j]][1]-w[i[j+1]][1... | 16 | 17 | 417 | 359 | import itertools
def sol():
n = int(eval(input()))
d = list(itertools.permutations([i for i in range(n)]))
w = []
for i in range(n):
x, y = list(map(int, input().split()))
w.append((x, y))
ans = chk = 0
for i in d:
for j in range(len(i) - 1):
ans += (
... | import itertools
n = int(eval(input()))
l = [int(i) for i in range(n)]
ans = chk = p = 0
w = []
for i in range(n):
x, y = list(map(int, input().split()))
w.append((x, y))
for i in list(itertools.permutations(l, n)):
chk = 0
for j in range(n - 1):
chk += (
(w[i[j]][0] - w[i[j + 1]][0... | false | 5.882353 | [
"-",
"-def sol():",
"- n = int(eval(input()))",
"- d = list(itertools.permutations([i for i in range(n)]))",
"- w = []",
"- for i in range(n):",
"- x, y = list(map(int, input().split()))",
"- w.append((x, y))",
"- ans = chk = 0",
"- for i in d:",
"- for j i... | false | 0.091227 | 0.042399 | 2.15165 | [
"s485703764",
"s103666355"
] |
u348805958 | p02624 | python | s032896654 | s560660754 | 182 | 118 | 62,892 | 63,040 | Accepted | Accepted | 35.16 | #!python3
import sys
iim = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
def resolve():
N = int(eval(input()))
ans = 0
for i in range(1, N+1):
j = N // i
ans += i * j * (1+ j) // 2
print(ans)
if __name__ == "__main__":
resolve()
| #!python3
import sys
iim = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
def resolve():
N = int(eval(input()))
ans = 0
N2 = N//2
for i in range(1, N2+1):
j = N // i
ans += i * j * (1+ j) // 2
ans += (N2+1 + N) * (N-N2) // 2
print(ans)
if __nam... | 16 | 18 | 289 | 342 | #!python3
import sys
iim = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
def resolve():
N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
j = N // i
ans += i * j * (1 + j) // 2
print(ans)
if __name__ == "__main__":
resolve()
| #!python3
import sys
iim = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
def resolve():
N = int(eval(input()))
ans = 0
N2 = N // 2
for i in range(1, N2 + 1):
j = N // i
ans += i * j * (1 + j) // 2
ans += (N2 + 1 + N) * (N - N2) // 2
print(ans)
if __name__ == ... | false | 11.111111 | [
"- for i in range(1, N + 1):",
"+ N2 = N // 2",
"+ for i in range(1, N2 + 1):",
"+ ans += (N2 + 1 + N) * (N - N2) // 2"
] | false | 0.627832 | 0.554516 | 1.132217 | [
"s032896654",
"s560660754"
] |
u305366205 | p03221 | python | s776986152 | s713704577 | 865 | 783 | 47,272 | 47,256 | Accepted | Accepted | 9.48 | from collections import defaultdict
dd = defaultdict(str)
n, m = list(map(int, input().split()))
keys = []
atcoder = [[] for _ in range(n)]
for i in range(m):
p, y = list(map(int, input().split()))
key_p = str(p).zfill(6)
key_y = str(y).zfill(10)
keys.append(key_p + key_y)
p -= 1
at... | def main():
from collections import defaultdict
dd = defaultdict(str)
n, m = list(map(int, input().split()))
keys = []
atcoder = [[] for _ in range(n)]
for i in range(m):
p, y = list(map(int, input().split()))
key_p = str(p).zfill(6)
key_y = str(y).zfill(10)
... | 22 | 27 | 606 | 747 | from collections import defaultdict
dd = defaultdict(str)
n, m = list(map(int, input().split()))
keys = []
atcoder = [[] for _ in range(n)]
for i in range(m):
p, y = list(map(int, input().split()))
key_p = str(p).zfill(6)
key_y = str(y).zfill(10)
keys.append(key_p + key_y)
p -= 1
atcoder[p].app... | def main():
from collections import defaultdict
dd = defaultdict(str)
n, m = list(map(int, input().split()))
keys = []
atcoder = [[] for _ in range(n)]
for i in range(m):
p, y = list(map(int, input().split()))
key_p = str(p).zfill(6)
key_y = str(y).zfill(10)
keys... | false | 18.518519 | [
"-from collections import defaultdict",
"+def main():",
"+ from collections import defaultdict",
"-dd = defaultdict(str)",
"-n, m = list(map(int, input().split()))",
"-keys = []",
"-atcoder = [[] for _ in range(n)]",
"-for i in range(m):",
"- p, y = list(map(int, input().split()))",
"- ke... | false | 0.041231 | 0.047708 | 0.864244 | [
"s776986152",
"s713704577"
] |
u379959788 | p03220 | python | s702492969 | s011475092 | 165 | 18 | 12,960 | 3,064 | Accepted | Accepted | 89.09 | import numpy as np
N = int(eval(input()))
T, A = list(map(int, input().split()))
height = list(map(int, input().split()))
temp = list([T - x*0.006 for x in height])
def getNearesValue(list, num):
idx = np.abs(np.asarray(list) - num).argmin()
return list[idx]
print((temp.index(getNearesValue(temp... | # -*-coding: utf-8 -*-
N = int(eval(input()))
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
best_near = 100000000
ans = 0
for i in range(N):
temp = T - H[i]*0.006
if best_near > abs(A - temp):
best_near = abs(A - temp)
ans = i+1
print(ans) | 13 | 14 | 323 | 295 | import numpy as np
N = int(eval(input()))
T, A = list(map(int, input().split()))
height = list(map(int, input().split()))
temp = list([T - x * 0.006 for x in height])
def getNearesValue(list, num):
idx = np.abs(np.asarray(list) - num).argmin()
return list[idx]
print((temp.index(getNearesValue(temp, A)) + 1... | # -*-coding: utf-8 -*-
N = int(eval(input()))
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
best_near = 100000000
ans = 0
for i in range(N):
temp = T - H[i] * 0.006
if best_near > abs(A - temp):
best_near = abs(A - temp)
ans = i + 1
print(ans)
| false | 7.142857 | [
"-import numpy as np",
"-",
"+# -*-coding: utf-8 -*-",
"-height = list(map(int, input().split()))",
"-temp = list([T - x * 0.006 for x in height])",
"-",
"-",
"-def getNearesValue(list, num):",
"- idx = np.abs(np.asarray(list) - num).argmin()",
"- return list[idx]",
"-",
"-",
"-print((... | false | 0.207783 | 0.040241 | 5.163459 | [
"s702492969",
"s011475092"
] |
u480887263 | p02996 | python | s292388621 | s043348657 | 973 | 793 | 55,256 | 33,364 | Accepted | Accepted | 18.5 | N=int(eval(input()))
d=[]
for n in range(N):
d.append(list(map(int,input().split())))
d_1=sorted(d,key=lambda d:d[1])
t=0
for n in range(N):
t+=d_1[n][0]
if t>d_1[n][1]:
print("No")
exit(0)
print("Yes") | N=int(eval(input()))
lst=[tuple(map(int,input().split())) for _ in range(N)]
lst_=sorted(lst,key=lambda x:x[1])
t=0
for n in range(N):
t+=lst_[n][0]
if t>lst_[n][1]:
print("No")
exit(0)
print("Yes") | 12 | 10 | 235 | 225 | N = int(eval(input()))
d = []
for n in range(N):
d.append(list(map(int, input().split())))
d_1 = sorted(d, key=lambda d: d[1])
t = 0
for n in range(N):
t += d_1[n][0]
if t > d_1[n][1]:
print("No")
exit(0)
print("Yes")
| N = int(eval(input()))
lst = [tuple(map(int, input().split())) for _ in range(N)]
lst_ = sorted(lst, key=lambda x: x[1])
t = 0
for n in range(N):
t += lst_[n][0]
if t > lst_[n][1]:
print("No")
exit(0)
print("Yes")
| false | 16.666667 | [
"-d = []",
"-for n in range(N):",
"- d.append(list(map(int, input().split())))",
"-d_1 = sorted(d, key=lambda d: d[1])",
"+lst = [tuple(map(int, input().split())) for _ in range(N)]",
"+lst_ = sorted(lst, key=lambda x: x[1])",
"- t += d_1[n][0]",
"- if t > d_1[n][1]:",
"+ t += lst_[n][0]... | false | 0.044586 | 0.043475 | 1.025549 | [
"s292388621",
"s043348657"
] |
u628335443 | p03200 | python | s514841881 | s690454159 | 68 | 62 | 9,188 | 9,260 | Accepted | Accepted | 8.82 | S = eval(input())
ans = 0
num = 0
for i in range(len(S)):
if S[i] == 'W':
ans += (i - num)
num += 1
print(ans)
| S = eval(input())
ans = 0
b_count = 0
for i in range(len(S)):
if S[i] == 'B':
b_count += 1
else:
ans += b_count
print(ans)
| 9 | 11 | 134 | 153 | S = eval(input())
ans = 0
num = 0
for i in range(len(S)):
if S[i] == "W":
ans += i - num
num += 1
print(ans)
| S = eval(input())
ans = 0
b_count = 0
for i in range(len(S)):
if S[i] == "B":
b_count += 1
else:
ans += b_count
print(ans)
| false | 18.181818 | [
"-num = 0",
"+b_count = 0",
"- if S[i] == \"W\":",
"- ans += i - num",
"- num += 1",
"+ if S[i] == \"B\":",
"+ b_count += 1",
"+ else:",
"+ ans += b_count"
] | false | 0.05561 | 0.036972 | 1.504116 | [
"s514841881",
"s690454159"
] |
u968166680 | p03476 | python | s277351682 | s484134821 | 181 | 158 | 29,012 | 29,012 | Accepted | Accepted | 12.71 | from sys import stdin, setrecursionlimit
from itertools import accumulate
setrecursionlimit(10 ** 9)
INF = 1 << 60
def input():
return stdin.readline().strip()
def prime_numbers(n):
if n < 2:
return []
m = (n + 1) // 2
p = [True] * m
for i in range(1, int((n ** 0.5 - 1... | from sys import stdin, setrecursionlimit
from itertools import accumulate
setrecursionlimit(10 ** 9)
INF = 1 << 60
def input():
return stdin.readline().strip()
def prime_numbers(n):
if n < 2:
return []
m = (n + 1) // 2
p = [True] * m
for i in range(1, int((n ** 0.5 - 1... | 33 | 36 | 759 | 799 | from sys import stdin, setrecursionlimit
from itertools import accumulate
setrecursionlimit(10**9)
INF = 1 << 60
def input():
return stdin.readline().strip()
def prime_numbers(n):
if n < 2:
return []
m = (n + 1) // 2
p = [True] * m
for i in range(1, int((n**0.5 - 1) / 2) + 1):
i... | from sys import stdin, setrecursionlimit
from itertools import accumulate
setrecursionlimit(10**9)
INF = 1 << 60
def input():
return stdin.readline().strip()
def prime_numbers(n):
if n < 2:
return []
m = (n + 1) // 2
p = [True] * m
for i in range(1, int((n**0.5 - 1) / 2) + 1):
i... | false | 8.333333 | [
"-Q, *LR = list(map(int, open(0).read().split()))",
"+ans = []",
"+Q, *LR = map(int, open(0).read().split())",
"- print((a[r] - a[l - 1]))",
"+ ans.append(a[r] - a[l - 1])",
"+print(*ans, sep=\"\\n\")"
] | false | 0.064138 | 0.060246 | 1.06461 | [
"s277351682",
"s484134821"
] |
u980205854 | p02678 | python | s197883423 | s933471367 | 1,687 | 852 | 130,232 | 87,332 | Accepted | Accepted | 49.5 | import numpy as np
import sys
sys.setrecursionlimit(10**7)
N,M = list(map(int,input().split()))
R = [[] for _ in range(N)]
ans = np.zeros(N,dtype=int)
ans[0] = 1
queue = [1]
for _ in range(M):
i,j = list(map(int,input().split()))
R[i-1].append(j)
R[j-1].append(i)
def bfs(que):
if que=... | # D - .. (Double Dots)
from collections import deque
N,M = list(map(int,input().split()))
route = [deque([]) for _ in range(N+1)]
for _ in range(M):
A,B = list(map(int,input().split()))
route[A].append(B)
route[B].append(A)
ans = [0]*2+[-1]*(N-1)
que = deque([1])
while len(que)>0:
k... | 28 | 23 | 545 | 480 | import numpy as np
import sys
sys.setrecursionlimit(10**7)
N, M = list(map(int, input().split()))
R = [[] for _ in range(N)]
ans = np.zeros(N, dtype=int)
ans[0] = 1
queue = [1]
for _ in range(M):
i, j = list(map(int, input().split()))
R[i - 1].append(j)
R[j - 1].append(i)
def bfs(que):
if que == []:
... | # D - .. (Double Dots)
from collections import deque
N, M = list(map(int, input().split()))
route = [deque([]) for _ in range(N + 1)]
for _ in range(M):
A, B = list(map(int, input().split()))
route[A].append(B)
route[B].append(A)
ans = [0] * 2 + [-1] * (N - 1)
que = deque([1])
while len(que) > 0:
k = q... | false | 17.857143 | [
"-import numpy as np",
"-import sys",
"+# D - .. (Double Dots)",
"+from collections import deque",
"-sys.setrecursionlimit(10**7)",
"-R = [[] for _ in range(N)]",
"-ans = np.zeros(N, dtype=int)",
"-ans[0] = 1",
"-queue = [1]",
"+route = [deque([]) for _ in range(N + 1)]",
"- i, j = list(map(i... | false | 0.264362 | 0.041036 | 6.442144 | [
"s197883423",
"s933471367"
] |
u525065967 | p02572 | python | s098705464 | s659502214 | 191 | 139 | 31,516 | 31,404 | Accepted | Accepted | 27.23 | n = int(eval(input()))
A = [*list(map(int, input().split()))]
S = [0] * (n+1)
for i in range(n): S[i+1] = S[i] + A[i]
MOD = (10**9)+7
ans = 0
for i in range(n): ans = (ans + A[i] * (S[-1] - S[i+1])) % MOD
print(((ans + MOD) % MOD))
| n = int(eval(input()))
A = [*list(map(int, input().split()))]
MOD = (10**9)+7
sum_a = sum(A)
ans = 0
for i in range(n-1):
sum_a -= A[i]
ans = (ans + A[i] * sum_a) % MOD
print(((ans + MOD) % MOD))
| 8 | 9 | 225 | 198 | n = int(eval(input()))
A = [*list(map(int, input().split()))]
S = [0] * (n + 1)
for i in range(n):
S[i + 1] = S[i] + A[i]
MOD = (10**9) + 7
ans = 0
for i in range(n):
ans = (ans + A[i] * (S[-1] - S[i + 1])) % MOD
print(((ans + MOD) % MOD))
| n = int(eval(input()))
A = [*list(map(int, input().split()))]
MOD = (10**9) + 7
sum_a = sum(A)
ans = 0
for i in range(n - 1):
sum_a -= A[i]
ans = (ans + A[i] * sum_a) % MOD
print(((ans + MOD) % MOD))
| false | 11.111111 | [
"-S = [0] * (n + 1)",
"-for i in range(n):",
"- S[i + 1] = S[i] + A[i]",
"+sum_a = sum(A)",
"-for i in range(n):",
"- ans = (ans + A[i] * (S[-1] - S[i + 1])) % MOD",
"+for i in range(n - 1):",
"+ sum_a -= A[i]",
"+ ans = (ans + A[i] * sum_a) % MOD"
] | false | 0.03525 | 0.035731 | 0.986513 | [
"s098705464",
"s659502214"
] |
u852690916 | p02861 | python | s776105535 | s944373785 | 207 | 172 | 39,792 | 38,256 | Accepted | Accepted | 16.91 | import sys
from itertools import permutations
def main():
input = sys.stdin.readline
N = int(eval(input()))
xy = [tuple(map(int, input().split())) for _ in range(N)]
def dist(x1,y1,x2,y2): return ((x1-x2)**2 + (y1-y2)**2)**0.5
ans = 0
for route in permutations(list(range(N))):
f... | import sys
def main():
input = sys.stdin.readline
N = int(eval(input()))
xy = [tuple(map(int, input().split())) for _ in range(N)]
def dist(xy1,xy2): return ((xy1[0]-xy2[0])**2 + (xy1[1]-xy2[1])**2)**0.5
ans = 0
for i in range(N):
for j in range(i+1,N):
ans += dist(x... | 17 | 14 | 525 | 387 | import sys
from itertools import permutations
def main():
input = sys.stdin.readline
N = int(eval(input()))
xy = [tuple(map(int, input().split())) for _ in range(N)]
def dist(x1, y1, x2, y2):
return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
ans = 0
for route in permutations(list(range... | import sys
def main():
input = sys.stdin.readline
N = int(eval(input()))
xy = [tuple(map(int, input().split())) for _ in range(N)]
def dist(xy1, xy2):
return ((xy1[0] - xy2[0]) ** 2 + (xy1[1] - xy2[1]) ** 2) ** 0.5
ans = 0
for i in range(N):
for j in range(i + 1, N):
... | false | 17.647059 | [
"-from itertools import permutations",
"- def dist(x1, y1, x2, y2):",
"- return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5",
"+ def dist(xy1, xy2):",
"+ return ((xy1[0] - xy2[0]) ** 2 + (xy1[1] - xy2[1]) ** 2) ** 0.5",
"- for route in permutations(list(range(N))):",
"- for i ... | false | 0.074096 | 0.037867 | 1.956731 | [
"s776105535",
"s944373785"
] |
u849029577 | p04029 | python | s888332947 | s713530869 | 101 | 73 | 61,224 | 61,628 | Accepted | Accepted | 27.72 | print((sum([i for i in range(1, int(eval(input()))+1)]))) | n = int(eval(input()))
print((n*(n+1)//2)) | 1 | 2 | 49 | 35 | print((sum([i for i in range(1, int(eval(input())) + 1)])))
| n = int(eval(input()))
print((n * (n + 1) // 2))
| false | 50 | [
"-print((sum([i for i in range(1, int(eval(input())) + 1)])))",
"+n = int(eval(input()))",
"+print((n * (n + 1) // 2))"
] | false | 0.064777 | 0.093954 | 0.689446 | [
"s888332947",
"s713530869"
] |
u548545174 | p03549 | python | s255968438 | s050528933 | 1,529 | 177 | 3,316 | 3,060 | Accepted | Accepted | 88.42 | N, M = list(map(int, input().split()))
ans = 0
for i in range(1, 10**6):
ans += ((1-(1/2)**M)**(i-1)) * ((1/2)**M) * (1900*M+100*(N-M)) * i
print((int(round(ans, -2)))) | N, M = list(map(int, input().split()))
ans = 0
for i in range(1, 10**5):
ans += ((1-(1/2)**M)**(i-1)) * ((1/2)**M) * (1900*M+100*(N-M)) * i
print((int(round(ans, -2)))) | 7 | 7 | 172 | 172 | N, M = list(map(int, input().split()))
ans = 0
for i in range(1, 10**6):
ans += (
((1 - (1 / 2) ** M) ** (i - 1))
* ((1 / 2) ** M)
* (1900 * M + 100 * (N - M))
* i
)
print((int(round(ans, -2))))
| N, M = list(map(int, input().split()))
ans = 0
for i in range(1, 10**5):
ans += (
((1 - (1 / 2) ** M) ** (i - 1))
* ((1 / 2) ** M)
* (1900 * M + 100 * (N - M))
* i
)
print((int(round(ans, -2))))
| false | 0 | [
"-for i in range(1, 10**6):",
"+for i in range(1, 10**5):"
] | false | 0.006625 | 0.109879 | 0.06029 | [
"s255968438",
"s050528933"
] |
u644907318 | p03645 | python | s588560651 | s867945406 | 1,494 | 754 | 59,368 | 137,220 | Accepted | Accepted | 49.53 | import heapq
INFTY = 1e6
N,M = list(map(int,input().split()))
G = {}
for _ in range(M):
a,b = list(map(int,input().split()))
if a not in G:
G[a] = []
G[a].append(b)
if b not in G:
G[b] = []
G[b].append(a)
d = [INFTY for _ in range(N+1)]
hist = [0 for _ in range(N+1)]
he... | import heapq
INFTY = 10**6
N,M = list(map(int,input().split()))
G = {i:[] for i in range(1,N+1)}
for _ in range(M):
a,b = list(map(int,input().split()))
G[a].append(b)
G[b].append(a)
dist = [INFTY for _ in range(N+1)]
hist = [0 for _ in range(N+1)]
heap = [(0,1)]
dist[1] = 0
hist[1] = 1
while h... | 28 | 25 | 624 | 585 | import heapq
INFTY = 1e6
N, M = list(map(int, input().split()))
G = {}
for _ in range(M):
a, b = list(map(int, input().split()))
if a not in G:
G[a] = []
G[a].append(b)
if b not in G:
G[b] = []
G[b].append(a)
d = [INFTY for _ in range(N + 1)]
hist = [0 for _ in range(N + 1)]
heap = ... | import heapq
INFTY = 10**6
N, M = list(map(int, input().split()))
G = {i: [] for i in range(1, N + 1)}
for _ in range(M):
a, b = list(map(int, input().split()))
G[a].append(b)
G[b].append(a)
dist = [INFTY for _ in range(N + 1)]
hist = [0 for _ in range(N + 1)]
heap = [(0, 1)]
dist[1] = 0
hist[1] = 1
while ... | false | 10.714286 | [
"-INFTY = 1e6",
"+INFTY = 10**6",
"-G = {}",
"+G = {i: [] for i in range(1, N + 1)}",
"- if a not in G:",
"- G[a] = []",
"- if b not in G:",
"- G[b] = []",
"-d = [INFTY for _ in range(N + 1)]",
"+dist = [INFTY for _ in range(N + 1)]",
"-d[1] = 0",
"+dist[1] = 0",
"+hist[1... | false | 0.036861 | 0.075102 | 0.490813 | [
"s588560651",
"s867945406"
] |
u489959379 | p03090 | python | s028781288 | s909246618 | 36 | 30 | 9,704 | 9,608 | Accepted | Accepted | 16.67 | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
res = []
remove = n
if n % 2 != 0:
remove -= 1
for i in range(n):
for j in range(i + 1, n):
if j + 1 == remove:
co... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
cnt = n
if n % 2:
cnt -= 1
edge = []
for i in range(n):
for j in range(i + 1, n):
if j + 1 == cnt:
... | 29 | 30 | 490 | 509 | import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
res = []
remove = n
if n % 2 != 0:
remove -= 1
for i in range(n):
for j in range(i + 1, n):
if j + 1 == remove:
continue
res.a... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
cnt = n
if n % 2:
cnt -= 1
edge = []
for i in range(n):
for j in range(i + 1, n):
if j + 1 == cnt:
continue
... | false | 3.333333 | [
"+input = sys.stdin.readline",
"- res = []",
"- remove = n",
"- if n % 2 != 0:",
"- remove -= 1",
"+ cnt = n",
"+ if n % 2:",
"+ cnt -= 1",
"+ edge = []",
"- if j + 1 == remove:",
"+ if j + 1 == cnt:",
"- res.append([i + 1, j + 1... | false | 0.033616 | 0.077477 | 0.433887 | [
"s028781288",
"s909246618"
] |
u622570247 | p02767 | python | s219470051 | s440636135 | 19 | 17 | 3,064 | 3,064 | Accepted | Accepted | 10.53 | import math
n = int(eval(input()))
x = list(map(int, input().split()))
p = sum(x) / len(x)
a1 = sum([(a - math.floor(p)) * (a - math.floor(p)) for a in x])
a2 = sum([(a - math.ceil(p)) * (a - math.ceil(p)) for a in x])
print((min(a1, a2))) | import math
n = int(eval(input()))
xs = list(map(int, input().split()))
p = sum(xs) / len(xs)
x1 = sum([(x - math.floor(p)) ** 2 for x in xs])
x2 = sum([(x - math.ceil(p)) ** 2 for x in xs])
print((min(x1, x2))) | 9 | 8 | 241 | 212 | import math
n = int(eval(input()))
x = list(map(int, input().split()))
p = sum(x) / len(x)
a1 = sum([(a - math.floor(p)) * (a - math.floor(p)) for a in x])
a2 = sum([(a - math.ceil(p)) * (a - math.ceil(p)) for a in x])
print((min(a1, a2)))
| import math
n = int(eval(input()))
xs = list(map(int, input().split()))
p = sum(xs) / len(xs)
x1 = sum([(x - math.floor(p)) ** 2 for x in xs])
x2 = sum([(x - math.ceil(p)) ** 2 for x in xs])
print((min(x1, x2)))
| false | 11.111111 | [
"-x = list(map(int, input().split()))",
"-p = sum(x) / len(x)",
"-a1 = sum([(a - math.floor(p)) * (a - math.floor(p)) for a in x])",
"-a2 = sum([(a - math.ceil(p)) * (a - math.ceil(p)) for a in x])",
"-print((min(a1, a2)))",
"+xs = list(map(int, input().split()))",
"+p = sum(xs) / len(xs)",
"+x1 = sum... | false | 0.0614 | 0.121624 | 0.504832 | [
"s219470051",
"s440636135"
] |
u506689504 | p03221 | python | s729317781 | s662350373 | 1,005 | 677 | 62,228 | 29,376 | Accepted | Accepted | 32.64 | import numpy as np
N, M = list(map(int, input().split()))
cities = {}
P = {}
Y = {}
for i in range(M):
p,y = list(map(int, input().split()))
cities[i] = p
Y[i] = y
ans = {}
sorted_Y = sorted(list(Y.items()), key=lambda x:x[1])
P_i = np.zeros(N)
for i,y in sorted_Y:
p = cities[i]
P_i[... | """
import numpy as np
N, M = map(int, input().split())
cities = {}
Y = {}
for i in range(M):
p,y = map(int, input().split())
cities[i] = p
Y[i] = y
ans = {}
sorted_Y = sorted(Y.items(), key=lambda x:x[1])
P_i = np.zeros(N)
for i,y in sorted_Y:
p = cities[i]
P_i[p-1] += 1
ans[i]... | 20 | 43 | 423 | 817 | import numpy as np
N, M = list(map(int, input().split()))
cities = {}
P = {}
Y = {}
for i in range(M):
p, y = list(map(int, input().split()))
cities[i] = p
Y[i] = y
ans = {}
sorted_Y = sorted(list(Y.items()), key=lambda x: x[1])
P_i = np.zeros(N)
for i, y in sorted_Y:
p = cities[i]
P_i[p - 1] += 1
... | """
import numpy as np
N, M = map(int, input().split())
cities = {}
Y = {}
for i in range(M):
p,y = map(int, input().split())
cities[i] = p
Y[i] = y
ans = {}
sorted_Y = sorted(Y.items(), key=lambda x:x[1])
P_i = np.zeros(N)
for i,y in sorted_Y:
p = cities[i]
P_i[p-1] += 1
ans[i] = (p, int(P_i[p-... | false | 53.488372 | [
"+\"\"\"",
"-",
"-N, M = list(map(int, input().split()))",
"+N, M = map(int, input().split())",
"-P = {}",
"- p, y = list(map(int, input().split()))",
"+ p,y = map(int, input().split())",
"-sorted_Y = sorted(list(Y.items()), key=lambda x: x[1])",
"+sorted_Y = sorted(Y.items(), key=lambda x:x[1... | false | 0.265403 | 0.03409 | 7.785319 | [
"s729317781",
"s662350373"
] |
u838644735 | p03821 | python | s414634807 | s839032841 | 140 | 114 | 25,124 | 25,124 | Accepted | Accepted | 18.57 | N, *AB = list(map(int, open(0).read().split()))
ans = 0
for i in range(N):
index = N - 1 - i
a = AB[index * 2 + 0] + ans
b = AB[index * 2 + 1]
remainder = a % b
ans += (b - remainder) % b
print(ans)
| def main():
N, *AB = list(map(int, open(0).read().split()))
ans = 0
for i in range(N):
index = N - 1 - i
a = AB[index * 2 + 0] + ans
b = AB[index * 2 + 1]
remainder = a % b
ans += (b - remainder) % b
print(ans)
if __name__ == "__main__":
main()
| 9 | 13 | 221 | 312 | N, *AB = list(map(int, open(0).read().split()))
ans = 0
for i in range(N):
index = N - 1 - i
a = AB[index * 2 + 0] + ans
b = AB[index * 2 + 1]
remainder = a % b
ans += (b - remainder) % b
print(ans)
| def main():
N, *AB = list(map(int, open(0).read().split()))
ans = 0
for i in range(N):
index = N - 1 - i
a = AB[index * 2 + 0] + ans
b = AB[index * 2 + 1]
remainder = a % b
ans += (b - remainder) % b
print(ans)
if __name__ == "__main__":
main()
| false | 30.769231 | [
"-N, *AB = list(map(int, open(0).read().split()))",
"-ans = 0",
"-for i in range(N):",
"- index = N - 1 - i",
"- a = AB[index * 2 + 0] + ans",
"- b = AB[index * 2 + 1]",
"- remainder = a % b",
"- ans += (b - remainder) % b",
"-print(ans)",
"+def main():",
"+ N, *AB = list(map(i... | false | 0.039912 | 0.040326 | 0.989733 | [
"s414634807",
"s839032841"
] |
u175590965 | p03000 | python | s401836788 | s603658026 | 19 | 17 | 3,060 | 3,064 | Accepted | Accepted | 10.53 | N,X = list(map(int,input().split()))
L = list(map(int,input().split()))
D = 0
count = 1
for i in range(N):
D = D + L[i]
if D <= X:
count += 1
print(count) | n,x = list(map(int,input().split()))
l = list(map(int,input().split()))
ans = 1
a = 0
for i in range(n):
a = a+l[i]
if a <= x:
ans +=1
print(ans) | 9 | 9 | 172 | 164 | N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
D = 0
count = 1
for i in range(N):
D = D + L[i]
if D <= X:
count += 1
print(count)
| n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
ans = 1
a = 0
for i in range(n):
a = a + l[i]
if a <= x:
ans += 1
print(ans)
| false | 0 | [
"-N, X = list(map(int, input().split()))",
"-L = list(map(int, input().split()))",
"-D = 0",
"-count = 1",
"-for i in range(N):",
"- D = D + L[i]",
"- if D <= X:",
"- count += 1",
"-print(count)",
"+n, x = list(map(int, input().split()))",
"+l = list(map(int, input().split()))",
"... | false | 0.042456 | 0.040389 | 1.05116 | [
"s401836788",
"s603658026"
] |
u330039499 | p03403 | python | s781075697 | s770438054 | 283 | 170 | 17,120 | 13,544 | Accepted | Accepted | 39.93 | N = eval(input())
A = list(map(int, input().split()))
A = [0] + A + [0]
cost = sum([abs(A[i] - A[i + 1]) for i in range(N + 1)])
for i in range(N):
a, b, c = A[i:i + 3]
if max(a, b, c) == b or min(a, b, c) == b:
diff = - abs(a - b) - abs(b - c) + abs(a - c)
else:
diff = 0
print... | N = eval(input())
A = [0] + list(map(int, input().split())) + [0]
cost = sum([abs(A[i] - A[i + 1]) for i in range(N + 1)])
for i in range(N):
a, b, c = A[i:i + 3]
print(cost - abs(a - b) - abs(b - c) + abs(a - c))
| 11 | 6 | 325 | 218 | N = eval(input())
A = list(map(int, input().split()))
A = [0] + A + [0]
cost = sum([abs(A[i] - A[i + 1]) for i in range(N + 1)])
for i in range(N):
a, b, c = A[i : i + 3]
if max(a, b, c) == b or min(a, b, c) == b:
diff = -abs(a - b) - abs(b - c) + abs(a - c)
else:
diff = 0
print(cost + d... | N = eval(input())
A = [0] + list(map(int, input().split())) + [0]
cost = sum([abs(A[i] - A[i + 1]) for i in range(N + 1)])
for i in range(N):
a, b, c = A[i : i + 3]
print(cost - abs(a - b) - abs(b - c) + abs(a - c))
| false | 45.454545 | [
"-A = list(map(int, input().split()))",
"-A = [0] + A + [0]",
"+A = [0] + list(map(int, input().split())) + [0]",
"- if max(a, b, c) == b or min(a, b, c) == b:",
"- diff = -abs(a - b) - abs(b - c) + abs(a - c)",
"- else:",
"- diff = 0",
"- print(cost + diff)",
"+ print(cost... | false | 0.085483 | 0.093818 | 0.911164 | [
"s781075697",
"s770438054"
] |
u687053495 | p03828 | python | s903782657 | s070043753 | 35 | 30 | 3,692 | 3,692 | Accepted | Accepted | 14.29 | # 素因数分解問題
import math
from collections import Counter
N = int(eval(input()))
mod = 10**9+7
def prime_factorize(n):
c = Counter()
for i in range(2, int(math.sqrt(n))+2):
while n % i == 0:
c[i] += 1
n //= i
if n > 1:
c[n] += 1
return c
counters = []
f... | import math
from collections import Counter
N = int(eval(input()))
def factorize(n):
cnt = Counter()
for i in range(2, int(math.sqrt(n)) + 2):
while n % i == 0:
cnt[i] += 1
n //= i
if n > 1:
cnt[n] += 1
return cnt
cnts = []
for i in range(1, N+1):
cnts.append(factor... | 33 | 32 | 565 | 522 | # 素因数分解問題
import math
from collections import Counter
N = int(eval(input()))
mod = 10**9 + 7
def prime_factorize(n):
c = Counter()
for i in range(2, int(math.sqrt(n)) + 2):
while n % i == 0:
c[i] += 1
n //= i
if n > 1:
c[n] += 1
return c
counters = []
for n i... | import math
from collections import Counter
N = int(eval(input()))
def factorize(n):
cnt = Counter()
for i in range(2, int(math.sqrt(n)) + 2):
while n % i == 0:
cnt[i] += 1
n //= i
if n > 1:
cnt[n] += 1
return cnt
cnts = []
for i in range(1, N + 1):
cnts.... | false | 3.030303 | [
"-# 素因数分解問題",
"-mod = 10**9 + 7",
"-def prime_factorize(n):",
"- c = Counter()",
"+def factorize(n):",
"+ cnt = Counter()",
"- c[i] += 1",
"+ cnt[i] += 1",
"- c[n] += 1",
"- return c",
"+ cnt[n] += 1",
"+ return cnt",
"-counters = []",
"-for ... | false | 0.042781 | 0.043215 | 0.989954 | [
"s903782657",
"s070043753"
] |
u667024514 | p03695 | python | s029149799 | s276795938 | 20 | 17 | 3,064 | 3,064 | Accepted | Accepted | 15 | import math
n = int(eval(input()))
lis = []
cou = 0
li = list(map(int,input().split()))
for i in range(n):
if li[i] >= 3200:
cou += 1
else:
if math.floor(li[i] // 400) not in lis:
lis.append(li[i] // 400)
if len(lis) == 0:
print((1,min(len(lis) + cou,8)))
else:
... | n = int(eval(input()))
lis = [0,0,0,0,0,0,0,0]
pro = 0
li = list(map(int,input().split()))
for i in range(n):
if li[i] >= 3200:
pro += 1
else:
lis[(li[i])//400] = 1
su = lis.count(1)
print((max(su,1),min(su+pro,n))) | 15 | 11 | 350 | 223 | import math
n = int(eval(input()))
lis = []
cou = 0
li = list(map(int, input().split()))
for i in range(n):
if li[i] >= 3200:
cou += 1
else:
if math.floor(li[i] // 400) not in lis:
lis.append(li[i] // 400)
if len(lis) == 0:
print((1, min(len(lis) + cou, 8)))
else:
print((len... | n = int(eval(input()))
lis = [0, 0, 0, 0, 0, 0, 0, 0]
pro = 0
li = list(map(int, input().split()))
for i in range(n):
if li[i] >= 3200:
pro += 1
else:
lis[(li[i]) // 400] = 1
su = lis.count(1)
print((max(su, 1), min(su + pro, n)))
| false | 26.666667 | [
"-import math",
"-",
"-lis = []",
"-cou = 0",
"+lis = [0, 0, 0, 0, 0, 0, 0, 0]",
"+pro = 0",
"- cou += 1",
"+ pro += 1",
"- if math.floor(li[i] // 400) not in lis:",
"- lis.append(li[i] // 400)",
"-if len(lis) == 0:",
"- print((1, min(len(lis) + cou, 8)))",
... | false | 0.123762 | 0.089998 | 1.375157 | [
"s029149799",
"s276795938"
] |
u939702463 | p03416 | python | s340627805 | s452360328 | 65 | 52 | 2,940 | 2,940 | Accepted | Accepted | 20 | a, b = list(map(int, input().split()))
ans = 0
for i in range(a, b + 1):
if str(i) == str(i)[::-1]:
ans += 1
print(ans)
| a, b = list(map(int, input().split()))
ans = 0
for i in range(a, b + 1):
str_i = str(i)
if str_i == str_i[::-1]:
ans += 1
print(ans) | 7 | 8 | 133 | 142 | a, b = list(map(int, input().split()))
ans = 0
for i in range(a, b + 1):
if str(i) == str(i)[::-1]:
ans += 1
print(ans)
| a, b = list(map(int, input().split()))
ans = 0
for i in range(a, b + 1):
str_i = str(i)
if str_i == str_i[::-1]:
ans += 1
print(ans)
| false | 12.5 | [
"- if str(i) == str(i)[::-1]:",
"+ str_i = str(i)",
"+ if str_i == str_i[::-1]:"
] | false | 0.052226 | 0.051464 | 1.014808 | [
"s340627805",
"s452360328"
] |
u562935282 | p02954 | python | s030577530 | s870316843 | 148 | 111 | 8,312 | 6,400 | Accepted | Accepted | 25 | from bisect import bisect_left
s = eval(input())
n = len(s)
ans = [0] * n
p = []
for i in range(n - 1):
if s[i] == 'R' and s[i + 1] == 'L':
p.append(i)
ans[i] += 1
ans[i + 1] += 1
for i, c in enumerate(s):
if ans[i] > 0:
continue
if c == 'L':
to = ... | # https://atcoder.jp/contests/abc136/submissions/6696720
# ほぼ写経、コメントをつけた
s = eval(input())
n = len(s)
ans = [0] * n
cnt_l = 0 # RLのR上に来るまでに出会ったLの個数(直前のRLのLを含む)
cnt_r = 0 # RLのL上に来るまでに出会ったRの個数(直前のRLのRを含む,最初を除く)
curr = 'R' # これが連続している間は、ansに計上しない
last_idx = 0 # RR[RL]LLLLLL <- このL列が集まるのは直前のRL, 直前のRLのLのidx... | 28 | 43 | 567 | 1,376 | from bisect import bisect_left
s = eval(input())
n = len(s)
ans = [0] * n
p = []
for i in range(n - 1):
if s[i] == "R" and s[i + 1] == "L":
p.append(i)
ans[i] += 1
ans[i + 1] += 1
for i, c in enumerate(s):
if ans[i] > 0:
continue
if c == "L":
to = bisect_left(p, i) -... | # https://atcoder.jp/contests/abc136/submissions/6696720
# ほぼ写経、コメントをつけた
s = eval(input())
n = len(s)
ans = [0] * n
cnt_l = 0 # RLのR上に来るまでに出会ったLの個数(直前のRLのLを含む)
cnt_r = 0 # RLのL上に来るまでに出会ったRの個数(直前のRLのRを含む,最初を除く)
curr = "R" # これが連続している間は、ansに計上しない
last_idx = 0 # RR[RL]LLLLLL <- このL列が集まるのは直前のRL, 直前のRLのLのidx
for idx, ch... | false | 34.883721 | [
"-from bisect import bisect_left",
"-",
"+# https://atcoder.jp/contests/abc136/submissions/6696720",
"+# ほぼ写経、コメントをつけた",
"-p = []",
"-for i in range(n - 1):",
"- if s[i] == \"R\" and s[i + 1] == \"L\":",
"- p.append(i)",
"- ans[i] += 1",
"- ans[i + 1] += 1",
"-for i, c in... | false | 0.042449 | 0.041949 | 1.011905 | [
"s030577530",
"s870316843"
] |
u985827933 | p02811 | python | s328930571 | s296095528 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | K,X=list(map(int,input().split()))
if 500*K >= X:
print("Yes")
else:
print("No") | K, X = list(map(int, input().split()))
if X<=500*K:
print('Yes')
else:
print("No") | 5 | 5 | 86 | 88 | K, X = list(map(int, input().split()))
if 500 * K >= X:
print("Yes")
else:
print("No")
| K, X = list(map(int, input().split()))
if X <= 500 * K:
print("Yes")
else:
print("No")
| false | 0 | [
"-if 500 * K >= X:",
"+if X <= 500 * K:"
] | false | 0.065529 | 0.051363 | 1.275794 | [
"s328930571",
"s296095528"
] |
u726615467 | p02873 | python | s186798476 | s149615136 | 437 | 396 | 35,760 | 31,908 | Accepted | Accepted | 9.38 | S = list(eval(input()))
N = len(S) + 1
ans_l = [-1] * N
ans_l[0] = 0
combo = 0
for i in range(N - 1):
if S[i] == '<':
combo += 1
else:
combo = 0
ans_l[i + 1] = combo
ans_r = [-1] * N
ans_r[-1] = 0
combo = 0
for j in range(N - 1):
i = N - 2 - j
if S[i] == '>':
... | S = eval(input())
N = len(S) + 1
a_left = [0] * N
a_tmp = 0
for i in range(N - 1):
if S[i] == '<':
a_tmp += 1
else:
a_tmp = 0
#
a_left[i + 1] = a_tmp
a_right = [0] * N
a_tmp = 0
for i in range(N - 1):
if S[-1 - i] == '>':
a_tmp += 1
else:
a_tm... | 29 | 26 | 509 | 444 | S = list(eval(input()))
N = len(S) + 1
ans_l = [-1] * N
ans_l[0] = 0
combo = 0
for i in range(N - 1):
if S[i] == "<":
combo += 1
else:
combo = 0
ans_l[i + 1] = combo
ans_r = [-1] * N
ans_r[-1] = 0
combo = 0
for j in range(N - 1):
i = N - 2 - j
if S[i] == ">":
combo += 1
e... | S = eval(input())
N = len(S) + 1
a_left = [0] * N
a_tmp = 0
for i in range(N - 1):
if S[i] == "<":
a_tmp += 1
else:
a_tmp = 0
#
a_left[i + 1] = a_tmp
a_right = [0] * N
a_tmp = 0
for i in range(N - 1):
if S[-1 - i] == ">":
a_tmp += 1
else:
a_tmp = 0
#
a_rig... | false | 10.344828 | [
"-S = list(eval(input()))",
"+S = eval(input())",
"-ans_l = [-1] * N",
"-ans_l[0] = 0",
"-combo = 0",
"+a_left = [0] * N",
"+a_tmp = 0",
"- combo += 1",
"+ a_tmp += 1",
"- combo = 0",
"- ans_l[i + 1] = combo",
"-ans_r = [-1] * N",
"-ans_r[-1] = 0",
"-combo = 0",
"... | false | 0.043663 | 0.049025 | 0.890626 | [
"s186798476",
"s149615136"
] |
u562935282 | p02901 | python | s666121693 | s349580277 | 350 | 237 | 49,244 | 41,840 | Accepted | Accepted | 32.29 | inf = float('inf')
n, m = list(map(int, input().split()))
dp = [inf] * (1 << n)
dp[0] = 0
for _ in range(m):
cost, _ = list(map(int, input().split()))
c = (int(x) - 1 for x in input().split())
mask = 0
for k in c:
mask |= 1 << k
for b in range((1 << n) - 1):
nb =... | def main():
import sys
input = sys.stdin.readline
inf = (10 ** 5) * (10 ** 3)
n, m = list(map(int, input().split()))
dp = [inf] * (1 << n)
dp[0] = 0
for _ in range(m):
cost, _ = list(map(int, input().split()))
c = (int(x) - 1 for x in input().split())
... | 21 | 32 | 422 | 656 | inf = float("inf")
n, m = list(map(int, input().split()))
dp = [inf] * (1 << n)
dp[0] = 0
for _ in range(m):
cost, _ = list(map(int, input().split()))
c = (int(x) - 1 for x in input().split())
mask = 0
for k in c:
mask |= 1 << k
for b in range((1 << n) - 1):
nb = b | mask
dp[... | def main():
import sys
input = sys.stdin.readline
inf = (10**5) * (10**3)
n, m = list(map(int, input().split()))
dp = [inf] * (1 << n)
dp[0] = 0
for _ in range(m):
cost, _ = list(map(int, input().split()))
c = (int(x) - 1 for x in input().split())
mask = 0
fo... | false | 34.375 | [
"-inf = float(\"inf\")",
"-n, m = list(map(int, input().split()))",
"-dp = [inf] * (1 << n)",
"-dp[0] = 0",
"-for _ in range(m):",
"- cost, _ = list(map(int, input().split()))",
"- c = (int(x) - 1 for x in input().split())",
"- mask = 0",
"- for k in c:",
"- mask |= 1 << k",
"... | false | 0.041996 | 0.065081 | 0.645289 | [
"s666121693",
"s349580277"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.