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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u094191970 | p02946 | python | s041301693 | s922649949 | 165 | 25 | 38,256 | 3,060 | Accepted | Accepted | 84.85 | k,x = list(map(int, input().split()))
l = [str(i) for i in range(x-k+1, x+k)]
print((' '.join(l))) | k,x=list(map(int,input().split()))
l=[i for i in range(x-k+1, x+k)]
print((*l)) | 3 | 3 | 92 | 73 | k, x = list(map(int, input().split()))
l = [str(i) for i in range(x - k + 1, x + k)]
print((" ".join(l)))
| k, x = list(map(int, input().split()))
l = [i for i in range(x - k + 1, x + k)]
print((*l))
| false | 0 | [
"-l = [str(i) for i in range(x - k + 1, x + k)]",
"-print((\" \".join(l)))",
"+l = [i for i in range(x - k + 1, x + k)]",
"+print((*l))"
] | false | 0.035176 | 0.052874 | 0.665279 | [
"s041301693",
"s922649949"
] |
u989345508 | p03611 | python | s483082195 | s338402130 | 207 | 107 | 13,964 | 13,964 | Accepted | Accepted | 48.31 | import bisect
n=int(eval(input()))
a=sorted([int(i) for i in input().split()])
ma=0
for i in range(10**5):
ma=max(bisect.bisect_right(a,i+1)-bisect.bisect_left(a,i-1),ma)
print(ma)
| import bisect
n=int(eval(input()))
a=[int(i) for i in input().split()]
b=[0]*(10**5)
for i in range(n):
b[a[i]]+=1
ma=0
for i in range(1,10**5-1):
ma=max(b[i-1]+b[i]+b[i+1],ma)
print(ma)
#累積和でやると早い
| 8 | 11 | 187 | 210 | import bisect
n = int(eval(input()))
a = sorted([int(i) for i in input().split()])
ma = 0
for i in range(10**5):
ma = max(bisect.bisect_right(a, i + 1) - bisect.bisect_left(a, i - 1), ma)
print(ma)
| import bisect
n = int(eval(input()))
a = [int(i) for i in input().split()]
b = [0] * (10**5)
for i in range(n):
b[a[i]] += 1
ma = 0
for i in range(1, 10**5 - 1):
ma = max(b[i - 1] + b[i] + b[i + 1], ma)
print(ma)
# 累積和でやると早い
| false | 27.272727 | [
"-a = sorted([int(i) for i in input().split()])",
"+a = [int(i) for i in input().split()]",
"+b = [0] * (10**5)",
"+for i in range(n):",
"+ b[a[i]] += 1",
"-for i in range(10**5):",
"- ma = max(bisect.bisect_right(a, i + 1) - bisect.bisect_left(a, i - 1), ma)",
"+for i in range(1, 10**5 - 1):",
... | false | 0.171333 | 0.12362 | 1.385969 | [
"s483082195",
"s338402130"
] |
u652656291 | p02862 | python | s391370716 | s044347308 | 215 | 162 | 29,460 | 9,068 | Accepted | Accepted | 24.65 | X,Y=list(map(int,input().split()))
mod=10**9+7
if (X+Y)%3!=0:
print((0));exit()
if X*2<Y or Y*2<X:
print((0));exit()
t=(X+Y)//3
f=[1]
for i in range(1,t+100):
f.append(f[-1]*i%mod)
def comb(a,b,m):
return f[a]*pow(f[b],m-2,m)*pow(f[a-b],m-2,m)%m
print((comb(t,X-t,mod)))
| M=10**9+7
x,y=list(map(int,input().split()))
ans=0
if (x+y)%3==0:
a=(2*y-x)//3
b=(2*x-y)//3
if a>=0 and b>=0:
f1,f2=1,1
for i in range(a+1,a+b+1):
f1*=i
f1%=M
for i in range(1,b+1):
f2*=i
f2%=M
ans=f1*pow(f2,M-2,M)
print((ans%M))
| 13 | 17 | 287 | 285 | X, Y = list(map(int, input().split()))
mod = 10**9 + 7
if (X + Y) % 3 != 0:
print((0))
exit()
if X * 2 < Y or Y * 2 < X:
print((0))
exit()
t = (X + Y) // 3
f = [1]
for i in range(1, t + 100):
f.append(f[-1] * i % mod)
def comb(a, b, m):
return f[a] * pow(f[b], m - 2, m) * pow(f[a - b], m - 2, ... | M = 10**9 + 7
x, y = list(map(int, input().split()))
ans = 0
if (x + y) % 3 == 0:
a = (2 * y - x) // 3
b = (2 * x - y) // 3
if a >= 0 and b >= 0:
f1, f2 = 1, 1
for i in range(a + 1, a + b + 1):
f1 *= i
f1 %= M
for i in range(1, b + 1):
f2 *= i
... | false | 23.529412 | [
"-X, Y = list(map(int, input().split()))",
"-mod = 10**9 + 7",
"-if (X + Y) % 3 != 0:",
"- print((0))",
"- exit()",
"-if X * 2 < Y or Y * 2 < X:",
"- print((0))",
"- exit()",
"-t = (X + Y) // 3",
"-f = [1]",
"-for i in range(1, t + 100):",
"- f.append(f[-1] * i % mod)",
"-",
... | false | 0.183805 | 0.169882 | 1.081956 | [
"s391370716",
"s044347308"
] |
u281610856 | p03163 | python | s131487889 | s518811327 | 708 | 544 | 171,656 | 121,224 | Accepted | Accepted | 23.16 | N, W = list(map(int, input().split()))
w = [0 for _ in range(N)]
v = [0 for _ in range(N)]
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
# print(w)
# print(v)
dp = [[0 for _ in range(W+1)] for _ in range(N+1)]
# print(dp)
# dp loop
for i in range(N):
for sum_w in range(W+1):
... | MAX_N = 110
N, W = list(map(int, input().split()))
weight = [0] * MAX_N
value = [0] * MAX_N
for i in range(N):
weight[i], value[i] = list(map(int, input().split()))
dp = [[0] * (W + 1) for _ in range(MAX_N)]
for i in range(N):
for sum_w in range(W + 1):
if sum_w - weight[i] >= 0:
d... | 17 | 15 | 503 | 497 | N, W = list(map(int, input().split()))
w = [0 for _ in range(N)]
v = [0 for _ in range(N)]
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
# print(w)
# print(v)
dp = [[0 for _ in range(W + 1)] for _ in range(N + 1)]
# print(dp)
# dp loop
for i in range(N):
for sum_w in range(W + 1):
if s... | MAX_N = 110
N, W = list(map(int, input().split()))
weight = [0] * MAX_N
value = [0] * MAX_N
for i in range(N):
weight[i], value[i] = list(map(int, input().split()))
dp = [[0] * (W + 1) for _ in range(MAX_N)]
for i in range(N):
for sum_w in range(W + 1):
if sum_w - weight[i] >= 0:
dp[i + 1][s... | false | 11.764706 | [
"+MAX_N = 110",
"-w = [0 for _ in range(N)]",
"-v = [0 for _ in range(N)]",
"+weight = [0] * MAX_N",
"+value = [0] * MAX_N",
"- w[i], v[i] = list(map(int, input().split()))",
"-# print(w)",
"-# print(v)",
"-dp = [[0 for _ in range(W + 1)] for _ in range(N + 1)]",
"-# print(dp)",
"-# dp loop",... | false | 0.043301 | 0.042359 | 1.022235 | [
"s131487889",
"s518811327"
] |
u708255304 | p03086 | python | s417327830 | s723535688 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | # 入力
S = str(eval(input()))
T = 'ATCG'
ans = 0
now = 0
for i in range(len(S)):
isATCG = False
for j in range(len(T)):
if S[i] == T[j]: # 対象の文字列がATCGのいずれかであるかどうか判定
isATCG = True
# 対象の文字列がATCGであればisATCGの値はTrueになっている
if not isATCG:
# 違う場合はnowを0にする
now =... | S = str(eval(input()))
targets = ['A', 'C', 'G', 'T']
ans = 0
for i in range(len(S)):
cnt = 0
if S[i] in targets:
for j in range(i, len(S)):
if S[j] in targets:
cnt += 1
else:
break
ans = max(ans, cnt)
print(ans)
| 22 | 16 | 432 | 305 | # 入力
S = str(eval(input()))
T = "ATCG"
ans = 0
now = 0
for i in range(len(S)):
isATCG = False
for j in range(len(T)):
if S[i] == T[j]: # 対象の文字列がATCGのいずれかであるかどうか判定
isATCG = True
# 対象の文字列がATCGであればisATCGの値はTrueになっている
if not isATCG:
# 違う場合はnowを0にする
now = 0
else:
... | S = str(eval(input()))
targets = ["A", "C", "G", "T"]
ans = 0
for i in range(len(S)):
cnt = 0
if S[i] in targets:
for j in range(i, len(S)):
if S[j] in targets:
cnt += 1
else:
break
ans = max(ans, cnt)
print(ans)
| false | 27.272727 | [
"-# 入力",
"-T = \"ATCG\"",
"+targets = [\"A\", \"C\", \"G\", \"T\"]",
"-now = 0",
"- isATCG = False",
"- for j in range(len(T)):",
"- if S[i] == T[j]: # 対象の文字列がATCGのいずれかであるかどうか判定",
"- isATCG = True",
"- # 対象の文字列がATCGであればisATCGの値はTrueになっている",
"- if not isATCG:",
"- ... | false | 0.048351 | 0.048963 | 0.98751 | [
"s417327830",
"s723535688"
] |
u321035578 | p03163 | python | s529896019 | s871269662 | 682 | 442 | 171,724 | 118,512 | Accepted | Accepted | 35.19 | def main():
n,w=list(map(int,input().split()))
wv=[]
for _ in range(n):
wv.append(list(map(int,input().split())))
dp=[]
temp=[]
for i in range(0,w+1):
if i < wv[0][0]:
temp.append(0)
else:
temp.append(wv[0][1])
# print(temp)
dp... | def main():
n,lim_w=list(map(int,input().split()))
wv = []
for _ in range(n):
tmp = list(map(int,input().split()))
wv.append(tmp)
dp = [[0] * (lim_w+1) for i in range(n+1)]
for i in range(0, n):
for w in range(0,lim_w+1):
if w >= wv[i][0]:
... | 35 | 18 | 877 | 498 | def main():
n, w = list(map(int, input().split()))
wv = []
for _ in range(n):
wv.append(list(map(int, input().split())))
dp = []
temp = []
for i in range(0, w + 1):
if i < wv[0][0]:
temp.append(0)
else:
temp.append(wv[0][1])
# print(temp)
d... | def main():
n, lim_w = list(map(int, input().split()))
wv = []
for _ in range(n):
tmp = list(map(int, input().split()))
wv.append(tmp)
dp = [[0] * (lim_w + 1) for i in range(n + 1)]
for i in range(0, n):
for w in range(0, lim_w + 1):
if w >= wv[i][0]:
... | false | 48.571429 | [
"- n, w = list(map(int, input().split()))",
"+ n, lim_w = list(map(int, input().split()))",
"- wv.append(list(map(int, input().split())))",
"- dp = []",
"- temp = []",
"- for i in range(0, w + 1):",
"- if i < wv[0][0]:",
"- temp.append(0)",
"- else:",
... | false | 0.043992 | 0.043233 | 1.017548 | [
"s529896019",
"s871269662"
] |
u581187895 | p03061 | python | s399032575 | s883840910 | 220 | 142 | 16,156 | 16,056 | Accepted | Accepted | 35.45 | """
配列の値を書き換える==削除すると同義
削除する値を一つ決め、それを区切りに右と左の配列に分け、GCDを求める
更に左右のGCDをマージしGCDを求め、最大値が答え
"""
import functools, fractions
N = int(eval(input()))
A = list(map(int, input().split()))
L = [0]*(N+1)
R = [0]*(N+1)
for i in range(N):
L[i+1] = fractions.gcd(L[i], A[i])
for i in range(N-1, 0, -1):
R[i] = fr... | from itertools import *
import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
L = list(accumulate([0]+A, fractions.gcd))
R = list(accumulate([0]+A[::-1], fractions.gcd))
print((max(fractions.gcd(s, t) for s, t in zip(L, R[::-1][1:])))) | 24 | 10 | 451 | 264 | """
配列の値を書き換える==削除すると同義
削除する値を一つ決め、それを区切りに右と左の配列に分け、GCDを求める
更に左右のGCDをマージしGCDを求め、最大値が答え
"""
import functools, fractions
N = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * (N + 1)
R = [0] * (N + 1)
for i in range(N):
L[i + 1] = fractions.gcd(L[i], A[i])
for i in range(N - 1, 0, -1):
R[i] = frac... | from itertools import *
import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
L = list(accumulate([0] + A, fractions.gcd))
R = list(accumulate([0] + A[::-1], fractions.gcd))
print((max(fractions.gcd(s, t) for s, t in zip(L, R[::-1][1:]))))
| false | 58.333333 | [
"-\"\"\"",
"-配列の値を書き換える==削除すると同義",
"-削除する値を一つ決め、それを区切りに右と左の配列に分け、GCDを求める",
"-更に左右のGCDをマージしGCDを求め、最大値が答え",
"-\"\"\"",
"-import functools, fractions",
"+from itertools import *",
"+import fractions",
"-L = [0] * (N + 1)",
"-R = [0] * (N + 1)",
"-for i in range(N):",
"- L[i + 1] = fractions.gc... | false | 0.134525 | 0.08443 | 1.593337 | [
"s399032575",
"s883840910"
] |
u567225946 | p02646 | python | s594042191 | s460694348 | 64 | 56 | 61,852 | 61,788 | Accepted | Accepted | 12.5 | a,v=list(map(int,input().split()))
b,w=list(map(int,input().split()))
t=int(eval(input()))
if a<b and v<=w:
print("NO")
else:
if abs(b-a)<=t*(v-w):
print("YES")
else:
print("NO")
| a,v=list(map(int,input().split()))
b,w=list(map(int,input().split()))
t=int(eval(input()))
if a<b and v<=w:
print("NO")
elif w>v:
print("NO")
else:
if abs(b-a)<=t*abs(v-w):
print("YES")
else:
print("NO")
| 10 | 12 | 198 | 229 | a, v = list(map(int, input().split()))
b, w = list(map(int, input().split()))
t = int(eval(input()))
if a < b and v <= w:
print("NO")
else:
if abs(b - a) <= t * (v - w):
print("YES")
else:
print("NO")
| a, v = list(map(int, input().split()))
b, w = list(map(int, input().split()))
t = int(eval(input()))
if a < b and v <= w:
print("NO")
elif w > v:
print("NO")
else:
if abs(b - a) <= t * abs(v - w):
print("YES")
else:
print("NO")
| false | 16.666667 | [
"+elif w > v:",
"+ print(\"NO\")",
"- if abs(b - a) <= t * (v - w):",
"+ if abs(b - a) <= t * abs(v - w):"
] | false | 0.038398 | 0.038168 | 1.006038 | [
"s594042191",
"s460694348"
] |
u075739430 | p02852 | python | s819510195 | s900698389 | 212 | 181 | 4,848 | 4,848 | Accepted | Accepted | 14.62 | n, m = map(int, input().split())
s = input()
ans = True
res = []
now = n + 1
for i in range(n, 0, -1):
flag = 0
if i > now:
continue
for j in range(max(0, i - m), i):
if s[j] == '0':
flag = 1
res.append(i - j)
now = j
break
i... | n, m = list(map(int, input().split()))
s = eval(input())
ans = True
res = []
now = n + 1
for i in range(n, 0, -1):
flag = 0
if i > now:
continue
for j in range(max(0, i - m), i):
if s[j] == '0':
flag = 1
res.append(i - j)
now = j
... | 23 | 23 | 483 | 474 | n, m = map(int, input().split())
s = input()
ans = True
res = []
now = n + 1
for i in range(n, 0, -1):
flag = 0
if i > now:
continue
for j in range(max(0, i - m), i):
if s[j] == "0":
flag = 1
res.append(i - j)
now = j
break
if flag == 0:
... | n, m = list(map(int, input().split()))
s = eval(input())
ans = True
res = []
now = n + 1
for i in range(n, 0, -1):
flag = 0
if i > now:
continue
for j in range(max(0, i - m), i):
if s[j] == "0":
flag = 1
res.append(i - j)
now = j
break
if f... | false | 0 | [
"-n, m = map(int, input().split())",
"-s = input()",
"+n, m = list(map(int, input().split()))",
"+s = eval(input())",
"- print(-1)",
"+ print((-1))",
"- print(res[i], end=\" \")",
"+ print((res[i]))"
] | false | 0.043377 | 0.044476 | 0.97529 | [
"s819510195",
"s900698389"
] |
u416011173 | p02844 | python | s476792668 | s179110872 | 738 | 507 | 9,304 | 9,336 | Accepted | Accepted | 31.3 | # -*- coding: utf-8 -*-
# 標準入力を取得
N = int(eval(input()))
S = eval(input())
# 求解処理
ans = 0
x_bit = [False for n in range(10)]
for x in range(N):
S_x = int(S[x])
if x_bit[S_x]:
continue
x_bit[S_x] = True
y_bit = [False for n in range(10)]
for y in range(x + 1, N):
S_y =... | # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
N = int(eval(input()))
S = eval(input())
return N, S
def main(N: int, S: str) -> None:
"""
メイン処理.
Args:\n
N (int): 桁数
S (str): ラッキーナンバー
... | 29 | 55 | 629 | 1,071 | # -*- coding: utf-8 -*-
# 標準入力を取得
N = int(eval(input()))
S = eval(input())
# 求解処理
ans = 0
x_bit = [False for n in range(10)]
for x in range(N):
S_x = int(S[x])
if x_bit[S_x]:
continue
x_bit[S_x] = True
y_bit = [False for n in range(10)]
for y in range(x + 1, N):
S_y = int(S[y])
... | # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
N = int(eval(input()))
S = eval(input())
return N, S
def main(N: int, S: str) -> None:
"""
メイン処理.
Args:\n
N (int): 桁数
S (str): ラッキーナンバー
"""
# 求解処理
ans... | false | 47.272727 | [
"-# 標準入力を取得",
"-N = int(eval(input()))",
"-S = eval(input())",
"-# 求解処理",
"-ans = 0",
"-x_bit = [False for n in range(10)]",
"-for x in range(N):",
"- S_x = int(S[x])",
"- if x_bit[S_x]:",
"- continue",
"- x_bit[S_x] = True",
"- y_bit = [False for n in range(10)]",
"- f... | false | 0.037757 | 0.036396 | 1.037418 | [
"s476792668",
"s179110872"
] |
u075012704 | p03061 | python | s843653444 | s606668266 | 1,484 | 188 | 123,116 | 16,700 | Accepted | Accepted | 87.33 | import copy
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
def gcd(a, b):
while b:
a, b = b, a % b
return a
def calc(B):
lo, hi = 1, 10 ** 9 + 1
while abs(hi - lo) > 1:
X = copy.deepcopy(B)
m = (hi + lo) // 2
skipped = False
... | from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
front, back = [0], [0]
for a in A:
front.append(gcd(front[-1], a))
front.append(0)
for a in A[::-1]:
back.append(gcd(back[-1], a))
back = [0] + back[::-1]
ans = 0
for i in range(1, N + 1):
ans = max(ans, g... | 43 | 17 | 863 | 357 | import copy
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
def gcd(a, b):
while b:
a, b = b, a % b
return a
def calc(B):
lo, hi = 1, 10**9 + 1
while abs(hi - lo) > 1:
X = copy.deepcopy(B)
m = (hi + lo) // 2
skipped = False
while len(X) > 1... | from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
front, back = [0], [0]
for a in A:
front.append(gcd(front[-1], a))
front.append(0)
for a in A[::-1]:
back.append(gcd(back[-1], a))
back = [0] + back[::-1]
ans = 0
for i in range(1, N + 1):
ans = max(ans, gcd(front[i - 1], ... | false | 60.465116 | [
"-import copy",
"+from fractions import gcd",
"-A = sorted(list(map(int, input().split())))",
"-",
"-",
"-def gcd(a, b):",
"- while b:",
"- a, b = b, a % b",
"- return a",
"-",
"-",
"-def calc(B):",
"- lo, hi = 1, 10**9 + 1",
"- while abs(hi - lo) > 1:",
"- X = ... | false | 0.084539 | 0.046105 | 1.833618 | [
"s843653444",
"s606668266"
] |
u259752752 | p03478 | python | s221146928 | s797305225 | 41 | 27 | 3,060 | 3,060 | Accepted | Accepted | 34.15 | N, A, B = [int(x) for x in input().split()]
ans = 0
for n in range(1, N+1):
nl = list(map(int, list(str(n))))
s = 0
for i in nl:
s += i
if s >= A and s <= B:
ans += n
print(ans)
| N, A, B = [int(x) for x in input().split()]
def sumEachOrder(n):
s = 0
while n > 0:
a = n % 10
s += a
n //= 10
return s
ans=0
for n in range(1, N+1):
s = sumEachOrder(n)
if s >= A and s <= B:
ans += n
print(ans)
| 11 | 16 | 221 | 281 | N, A, B = [int(x) for x in input().split()]
ans = 0
for n in range(1, N + 1):
nl = list(map(int, list(str(n))))
s = 0
for i in nl:
s += i
if s >= A and s <= B:
ans += n
print(ans)
| N, A, B = [int(x) for x in input().split()]
def sumEachOrder(n):
s = 0
while n > 0:
a = n % 10
s += a
n //= 10
return s
ans = 0
for n in range(1, N + 1):
s = sumEachOrder(n)
if s >= A and s <= B:
ans += n
print(ans)
| false | 31.25 | [
"+",
"+",
"+def sumEachOrder(n):",
"+ s = 0",
"+ while n > 0:",
"+ a = n % 10",
"+ s += a",
"+ n //= 10",
"+ return s",
"+",
"+",
"- nl = list(map(int, list(str(n))))",
"- s = 0",
"- for i in nl:",
"- s += i",
"+ s = sumEachOrder(n)"
] | false | 0.044653 | 0.045514 | 0.981074 | [
"s221146928",
"s797305225"
] |
u653485478 | p03331 | python | s089201499 | s617977452 | 33 | 17 | 2,940 | 2,940 | Accepted | Accepted | 48.48 | n = int(eval(input()))
m = n
sum = 0
for i in range(n):
sum = m % 10 + sum
m = m//10
if sum == 1:
print((10))
else:
print(sum) | n = int(eval(input()))
sum = 0
for i in str(n):
sum += int(i)
if sum == 1:
sum += 9
print(sum) | 13 | 8 | 149 | 104 | n = int(eval(input()))
m = n
sum = 0
for i in range(n):
sum = m % 10 + sum
m = m // 10
if sum == 1:
print((10))
else:
print(sum)
| n = int(eval(input()))
sum = 0
for i in str(n):
sum += int(i)
if sum == 1:
sum += 9
print(sum)
| false | 38.461538 | [
"-m = n",
"-for i in range(n):",
"- sum = m % 10 + sum",
"- m = m // 10",
"+for i in str(n):",
"+ sum += int(i)",
"- print((10))",
"-else:",
"- print(sum)",
"+ sum += 9",
"+print(sum)"
] | false | 0.069399 | 0.063618 | 1.090857 | [
"s089201499",
"s617977452"
] |
u252828980 | p02881 | python | s253300398 | s646006556 | 302 | 161 | 3,060 | 3,060 | Accepted | Accepted | 46.69 | n = int(eval(input()))
min1 = 10**20
for i in range(1,int(n**0.5)+1):
if n/i %1 == 0:
j = n//i
min1 = min(min1,i+j)
print((min1-2)) | n = int(eval(input()))
ans = 10**13
for i in range(1,int(n**0.5//1)+1):
if n%i == 0:
ans = min(ans,i+n//i-2)
print(ans) | 7 | 6 | 139 | 130 | n = int(eval(input()))
min1 = 10**20
for i in range(1, int(n**0.5) + 1):
if n / i % 1 == 0:
j = n // i
min1 = min(min1, i + j)
print((min1 - 2))
| n = int(eval(input()))
ans = 10**13
for i in range(1, int(n**0.5 // 1) + 1):
if n % i == 0:
ans = min(ans, i + n // i - 2)
print(ans)
| false | 14.285714 | [
"-min1 = 10**20",
"-for i in range(1, int(n**0.5) + 1):",
"- if n / i % 1 == 0:",
"- j = n // i",
"- min1 = min(min1, i + j)",
"-print((min1 - 2))",
"+ans = 10**13",
"+for i in range(1, int(n**0.5 // 1) + 1):",
"+ if n % i == 0:",
"+ ans = min(ans, i + n // i - 2)",
"+... | false | 0.048601 | 0.044486 | 1.092484 | [
"s253300398",
"s646006556"
] |
u581187895 | p03244 | python | s787181551 | s295365577 | 85 | 66 | 20,700 | 23,140 | Accepted | Accepted | 22.35 | from collections import Counter
n = int(eval(input()))
v=list(map(int,input().split()))
a=Counter(v[0::2]).most_common()
b=Counter(v[1::2]).most_common()
a.append([0,0])
b.append([0,0])
if a[0][0]!=b[0][0]:
print((n-(a[0][1]+b[0][1])))
else:
print((min(n-(a[1][1]+b[0][1]),n-(a[0][1]+b[1][1])))) |
from collections import Counter
def resolve():
N = int(eval(input()))
A = list(map(int, input().split()))
O = Counter(A[::2])
E = Counter(A[1::2])
most_O = O.most_common(2)
most_E = E.most_common(2)
# 番兵
most_O.append((0, 0))
most_E.append((0, 0))
cnt = 0
... | 12 | 33 | 305 | 654 | from collections import Counter
n = int(eval(input()))
v = list(map(int, input().split()))
a = Counter(v[0::2]).most_common()
b = Counter(v[1::2]).most_common()
a.append([0, 0])
b.append([0, 0])
if a[0][0] != b[0][0]:
print((n - (a[0][1] + b[0][1])))
else:
print((min(n - (a[1][1] + b[0][1]), n - (a[0][1] + b[1... | from collections import Counter
def resolve():
N = int(eval(input()))
A = list(map(int, input().split()))
O = Counter(A[::2])
E = Counter(A[1::2])
most_O = O.most_common(2)
most_E = E.most_common(2)
# 番兵
most_O.append((0, 0))
most_E.append((0, 0))
cnt = 0
# key comp
if ... | false | 63.636364 | [
"-n = int(eval(input()))",
"-v = list(map(int, input().split()))",
"-a = Counter(v[0::2]).most_common()",
"-b = Counter(v[1::2]).most_common()",
"-a.append([0, 0])",
"-b.append([0, 0])",
"-if a[0][0] != b[0][0]:",
"- print((n - (a[0][1] + b[0][1])))",
"-else:",
"- print((min(n - (a[1][1] + b... | false | 0.036254 | 0.038216 | 0.948653 | [
"s787181551",
"s295365577"
] |
u520276780 | p03583 | python | s647511101 | s852588861 | 1,985 | 932 | 3,064 | 3,064 | Accepted | Accepted | 53.05 | N = int(eval(input()))
for h in range(1,3501):
for n in range(1,3501):
if (4*h*n-N*h-N*n)>0 and (h*n)%(4*h*n-N*h-N*n)==0:
print((h,n,h*n*N//(4*h*n-N*h-N*n)))
exit()
| N = int(eval(input()))
for h in range(1,3501):
for n in range(1,h):
if (4*h*n-N*h-N*n)>0 and (h*n)%(4*h*n-N*h-N*n)==0:
print((h,n,h*n*N//(4*h*n-N*h-N*n)))
exit()
| 6 | 6 | 198 | 195 | N = int(eval(input()))
for h in range(1, 3501):
for n in range(1, 3501):
if (4 * h * n - N * h - N * n) > 0 and (h * n) % (
4 * h * n - N * h - N * n
) == 0:
print((h, n, h * n * N // (4 * h * n - N * h - N * n)))
exit()
| N = int(eval(input()))
for h in range(1, 3501):
for n in range(1, h):
if (4 * h * n - N * h - N * n) > 0 and (h * n) % (
4 * h * n - N * h - N * n
) == 0:
print((h, n, h * n * N // (4 * h * n - N * h - N * n)))
exit()
| false | 0 | [
"- for n in range(1, 3501):",
"+ for n in range(1, h):"
] | false | 0.491466 | 0.229564 | 2.140864 | [
"s647511101",
"s852588861"
] |
u747602774 | p03107 | python | s095278018 | s693784702 | 27 | 20 | 4,340 | 3,188 | Accepted | Accepted | 25.93 | import collections
S = list(eval(input()))
S.append('0')
S.append('1')
S_counter = collections.Counter(S)
print(((S_counter.most_common()[1][1]-1)*2))
| S = eval(input())
r = S.count('0')
ans = min(len(S)-r,r)*2
print(ans)
| 6 | 4 | 148 | 67 | import collections
S = list(eval(input()))
S.append("0")
S.append("1")
S_counter = collections.Counter(S)
print(((S_counter.most_common()[1][1] - 1) * 2))
| S = eval(input())
r = S.count("0")
ans = min(len(S) - r, r) * 2
print(ans)
| false | 33.333333 | [
"-import collections",
"-",
"-S = list(eval(input()))",
"-S.append(\"0\")",
"-S.append(\"1\")",
"-S_counter = collections.Counter(S)",
"-print(((S_counter.most_common()[1][1] - 1) * 2))",
"+S = eval(input())",
"+r = S.count(\"0\")",
"+ans = min(len(S) - r, r) * 2",
"+print(ans)"
] | false | 0.041995 | 0.037836 | 1.109928 | [
"s095278018",
"s693784702"
] |
u579699847 | p02756 | python | s649151688 | s418853772 | 651 | 523 | 39,024 | 42,396 | Accepted | Accepted | 19.66 | from collections import deque
S = input()
Q = int(input())
query = [list(input().split()) for _ in range(Q)]
reversecount = 0
d = deque(S)
for x in query:
if int(x[0]) == 1:
reversecount += 1
else:
if (int(x[1]) == 1 and (reversecount % 2 == 0)) or (int(x[1]) == 2 and (reversecount % 2... | def main2(s,x,q):
res = s
rev = 1 #-1なら反転中
lstA = []
lstB = []
for op in q:
if int(op[0]) == 1:
rev = rev * -1
elif int(op[1])*rev == 1 or int(op[1])*rev == -2:
lstA.append(op[2])
elif int(op[1])*rev == -1 or int(op[1])*rev == 2:
... | 17 | 22 | 466 | 593 | from collections import deque
S = input()
Q = int(input())
query = [list(input().split()) for _ in range(Q)]
reversecount = 0
d = deque(S)
for x in query:
if int(x[0]) == 1:
reversecount += 1
else:
if (int(x[1]) == 1 and (reversecount % 2 == 0)) or (
int(x[1]) == 2 and (reversecount... | def main2(s, x, q):
res = s
rev = 1 # -1なら反転中
lstA = []
lstB = []
for op in q:
if int(op[0]) == 1:
rev = rev * -1
elif int(op[1]) * rev == 1 or int(op[1]) * rev == -2:
lstA.append(op[2])
elif int(op[1]) * rev == -1 or int(op[1]) * rev == 2:
... | false | 22.727273 | [
"-from collections import deque",
"+def main2(s, x, q):",
"+ res = s",
"+ rev = 1 # -1なら反転中",
"+ lstA = []",
"+ lstB = []",
"+ for op in q:",
"+ if int(op[0]) == 1:",
"+ rev = rev * -1",
"+ elif int(op[1]) * rev == 1 or int(op[1]) * rev == -2:",
"+ ... | false | 0.042087 | 0.040891 | 1.029248 | [
"s649151688",
"s418853772"
] |
u949981986 | p02848 | python | s639186468 | s885095120 | 61 | 26 | 3,316 | 3,188 | Accepted | Accepted | 57.38 | N = int(eval(input()))
S = eval(input())
alf = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
out = []
for i in range(len(S)):
for j in range(26):
if S[i] == alf[j]:
k = (j + N) % 26
out.append(alf[k])
print(("".join(out))) | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
S = [x - ord('A') for x in read().rstrip()]
S = [(x + N) % 26 for x in S]
answer = ''.join(chr(x + ord('A')) for x in S)
print(answer) | 12 | 11 | 240 | 283 | N = int(eval(input()))
S = eval(input())
alf = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
out = []
for i in range(len(S)):
for j in range(26):
if S[i] == alf[j]:
k = (j + N) % 26
out.append(alf[k])
print(("".join(out)))
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
S = [x - ord("A") for x in read().rstrip()]
S = [(x + N) % 26 for x in S]
answer = "".join(chr(x + ord("A")) for x in S)
print(answer)
| false | 8.333333 | [
"-N = int(eval(input()))",
"-S = eval(input())",
"-alf = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"",
"-out = []",
"-for i in range(len(S)):",
"- for j in range(26):",
"- if S[i] == alf[j]:",
"- k = (j + N) % 26",
"- out.append(alf[k])",
"-print((\"\".join(out)))",
"+import s... | false | 0.03804 | 0.084824 | 0.448459 | [
"s639186468",
"s885095120"
] |
u683134447 | p03212 | python | s693193353 | s170060255 | 305 | 225 | 52,444 | 43,752 | Accepted | Accepted | 26.23 | from functools import reduce
n = int(eval(input()))
ans = 0
def dfs(numl):
global ans
if 3 in numl and 5 in numl and 7 in numl and n >= reduce( lambda a,b:10*a+b, numl):
ans += 1
if len(str(n)) > len(numl):
for i in [3,5,7]:
dfs(numl+[i])
dfs([])
print(ans) | n = int(eval(input()))
global ans
ans = 0
def dfs(s):
global ans
if s:
if int(s) > n:
return
if s:
if "3" in s and "5" in s and "7" in s:
ans += 1
dfs(s + "3")
dfs(s + "5")
dfs(s + "7")
dfs("")
print(ans) | 14 | 21 | 306 | 287 | from functools import reduce
n = int(eval(input()))
ans = 0
def dfs(numl):
global ans
if (
3 in numl
and 5 in numl
and 7 in numl
and n >= reduce(lambda a, b: 10 * a + b, numl)
):
ans += 1
if len(str(n)) > len(numl):
for i in [3, 5, 7]:
dfs(n... | n = int(eval(input()))
global ans
ans = 0
def dfs(s):
global ans
if s:
if int(s) > n:
return
if s:
if "3" in s and "5" in s and "7" in s:
ans += 1
dfs(s + "3")
dfs(s + "5")
dfs(s + "7")
dfs("")
print(ans)
| false | 33.333333 | [
"-from functools import reduce",
"-",
"+global ans",
"-def dfs(numl):",
"+def dfs(s):",
"- if (",
"- 3 in numl",
"- and 5 in numl",
"- and 7 in numl",
"- and n >= reduce(lambda a, b: 10 * a + b, numl)",
"- ):",
"- ans += 1",
"- if len(str(n)) > len... | false | 0.068808 | 0.043798 | 1.571014 | [
"s693193353",
"s170060255"
] |
u168578024 | p03061 | python | s141178524 | s534027643 | 810 | 682 | 80,032 | 88,160 | Accepted | Accepted | 15.8 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from fractions import gcd
class SegmentTree:
def __init__(self, dat, func, I):
N = len(dat)
self.sz = N
self.func = func
self.I = I
self.seg = [I]*N + dat
def assign(self, k, x):
... | # test
def main():
import sys
from fractions import gcd
input = sys.stdin.readline
def init(init_val):
#set_val
for i in range(n):
seg[i+num-1]=init_val[i]
#built
for i in range(num-2,-1,-1) :
seg[i]=gcd(seg[2*i+1],seg[2*i+2])
... | 53 | 62 | 1,334 | 1,337 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from fractions import gcd
class SegmentTree:
def __init__(self, dat, func, I):
N = len(dat)
self.sz = N
self.func = func
self.I = I
self.seg = [I] * N + dat
def assign(self, k, x):
se... | # test
def main():
import sys
from fractions import gcd
input = sys.stdin.readline
def init(init_val):
# set_val
for i in range(n):
seg[i + num - 1] = init_val[i]
# built
for i in range(num - 2, -1, -1):
seg[i] = gcd(seg[2 * i + 1], seg[2 * i + 2... | false | 14.516129 | [
"-import sys",
"+# test",
"+def main():",
"+ import sys",
"+ from fractions import gcd",
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-from fractions import gcd",
"+ input = sys.stdin.readline",
"+ def init(init_val):",
"+ # set_val",
"+ ... | false | 0.047759 | 0.043847 | 1.089237 | [
"s141178524",
"s534027643"
] |
u636387751 | p04006 | python | s353433030 | s045885148 | 1,631 | 612 | 3,316 | 3,316 | Accepted | Accepted | 62.48 | def main():
N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = float("INF")
b = [float("INF")]*N
for k in range(N):
temp_ans = k*x
for i in range(N):
b[i] = min(b[i],a[i-k])
temp_ans += b[i]
ans = min(ans,temp_an... | def main():
N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = float("INF")
b = [float("INF")]*N
for k in range(N):
temp_ans = k*x
for i in range(N):
t = a[i-k]
if t < b[i]:
b[i] = t
temp_ans... | 15 | 17 | 374 | 413 | def main():
N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = float("INF")
b = [float("INF")] * N
for k in range(N):
temp_ans = k * x
for i in range(N):
b[i] = min(b[i], a[i - k])
temp_ans += b[i]
ans = min(ans, temp_ans)... | def main():
N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = float("INF")
b = [float("INF")] * N
for k in range(N):
temp_ans = k * x
for i in range(N):
t = a[i - k]
if t < b[i]:
b[i] = t
temp_ans += b... | false | 11.764706 | [
"- b[i] = min(b[i], a[i - k])",
"+ t = a[i - k]",
"+ if t < b[i]:",
"+ b[i] = t"
] | false | 0.030898 | 0.05425 | 0.569538 | [
"s353433030",
"s045885148"
] |
u785220618 | p03309 | python | s355895870 | s587952021 | 237 | 217 | 26,128 | 26,020 | Accepted | Accepted | 8.44 | # -*- coding: utf-8 -*-
n = int(eval(input()))
A = list(map(int, input().split()))
A = [A[i]-(i+1) for i in range(n)]
A.sort()
if n == 1:
print((0))
exit()
ans = 10**100
for i in [n//2-1, n//2]:
ans = min(ans, sum([abs(A[j]-A[i]) for j in range(n)]))
print(ans)
| # -*- coding: utf-8 -*-
n = int(eval(input()))
A = list(map(int, input().split()))
A = [A[i-1]-i for i in range(1, n+1)]
A.sort()
ans = 0
for a in A:
ans += abs(a - A[n//2])
print(ans)
| 16 | 10 | 285 | 193 | # -*- coding: utf-8 -*-
n = int(eval(input()))
A = list(map(int, input().split()))
A = [A[i] - (i + 1) for i in range(n)]
A.sort()
if n == 1:
print((0))
exit()
ans = 10**100
for i in [n // 2 - 1, n // 2]:
ans = min(ans, sum([abs(A[j] - A[i]) for j in range(n)]))
print(ans)
| # -*- coding: utf-8 -*-
n = int(eval(input()))
A = list(map(int, input().split()))
A = [A[i - 1] - i for i in range(1, n + 1)]
A.sort()
ans = 0
for a in A:
ans += abs(a - A[n // 2])
print(ans)
| false | 37.5 | [
"-A = [A[i] - (i + 1) for i in range(n)]",
"+A = [A[i - 1] - i for i in range(1, n + 1)]",
"-if n == 1:",
"- print((0))",
"- exit()",
"-ans = 10**100",
"-for i in [n // 2 - 1, n // 2]:",
"- ans = min(ans, sum([abs(A[j] - A[i]) for j in range(n)]))",
"+ans = 0",
"+for a in A:",
"+ ans... | false | 0.035186 | 0.037201 | 0.945817 | [
"s355895870",
"s587952021"
] |
u585482323 | p02822 | python | s312160915 | s679149869 | 1,429 | 1,123 | 98,808 | 98,808 | Accepted | Accepted | 21.41 | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in... | 75 | 72 | 1,769 | 1,715 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(... | false | 4 | [
"- ans = 0",
"- p = pow(2, n - 1, mod)",
"+ ans = n",
"- if len(v[x]) < 2:",
"- continue",
"- s = p - 1",
"+ s = 0",
"- s -= pow(2, t[0] - tx, mod) - 1",
"+ s += pow(2, t[0] - tx, mod) - 1",
"- s -= pow(2, ty, mo... | false | 0.088627 | 0.046042 | 1.92492 | [
"s312160915",
"s679149869"
] |
u724687935 | p02695 | python | s448525309 | s715079505 | 643 | 238 | 9,092 | 77,744 | Accepted | Accepted | 62.99 | import sys
sys.setrecursionlimit(10 ** 6)
def dfs(num):
global N, ans, M
n = len(num)
if n == N:
cnt = 0
for a, b, c, d in con:
a -= 1; b -= 1
if num[b] - num[a] == c:
cnt += d
ans = max(ans, cnt)
else:
e = 1 if n =... | def dfs(i, p, seq):
global N, M
ret = 0
if i == N:
ret = check(seq)
else:
for x in range(p, M + 1):
ret = max(ret, dfs(i + 1, x, tuple(list(seq) + [x])))
return ret
def check(seq):
cnt = 0
for a, b, c, d in query:
if seq[b - 1] - seq[a - 1]... | 27 | 23 | 540 | 497 | import sys
sys.setrecursionlimit(10**6)
def dfs(num):
global N, ans, M
n = len(num)
if n == N:
cnt = 0
for a, b, c, d in con:
a -= 1
b -= 1
if num[b] - num[a] == c:
cnt += d
ans = max(ans, cnt)
else:
e = 1 if n == 0 e... | def dfs(i, p, seq):
global N, M
ret = 0
if i == N:
ret = check(seq)
else:
for x in range(p, M + 1):
ret = max(ret, dfs(i + 1, x, tuple(list(seq) + [x])))
return ret
def check(seq):
cnt = 0
for a, b, c, d in query:
if seq[b - 1] - seq[a - 1] == c:
... | false | 14.814815 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**6)",
"+def dfs(i, p, seq):",
"+ global N, M",
"+ ret = 0",
"+ if i == N:",
"+ ret = check(seq)",
"+ else:",
"+ for x in range(p, M + 1):",
"+ ret = max(ret, dfs(i + 1, x, tuple(list(seq) + [x])))",
"+ retur... | false | 0.051909 | 0.15074 | 0.344361 | [
"s448525309",
"s715079505"
] |
u102242691 | p03845 | python | s821357128 | s515709600 | 23 | 18 | 3,444 | 2,940 | Accepted | Accepted | 21.74 |
import copy
n = int(eval(input()))
t = list(map(int,input().split()))
m = int(eval(input()))
l = []
for i in range(m):
p,x = list(map(int,input().split()))
l = copy.copy(t)
l[p-1] = x
# print(t)
# print(l)
print((sum(l)))
|
n = int(eval(input()))
t = list(map(int,input().split()))
m = int(eval(input()))
for i in range(m):
tmp = t.copy()
p,x = list(map(int,input().split()))
tmp[p-1] = x
print((sum(tmp)))
| 16 | 11 | 243 | 192 | import copy
n = int(eval(input()))
t = list(map(int, input().split()))
m = int(eval(input()))
l = []
for i in range(m):
p, x = list(map(int, input().split()))
l = copy.copy(t)
l[p - 1] = x
# print(t)
# print(l)
print((sum(l)))
| n = int(eval(input()))
t = list(map(int, input().split()))
m = int(eval(input()))
for i in range(m):
tmp = t.copy()
p, x = list(map(int, input().split()))
tmp[p - 1] = x
print((sum(tmp)))
| false | 31.25 | [
"-import copy",
"-",
"-l = []",
"+ tmp = t.copy()",
"- l = copy.copy(t)",
"- l[p - 1] = x",
"- # print(t)",
"- # print(l)",
"- print((sum(l)))",
"+ tmp[p - 1] = x",
"+ print((sum(tmp)))"
] | false | 0.041423 | 0.037633 | 1.10071 | [
"s821357128",
"s515709600"
] |
u489959379 | p04030 | python | s645346296 | s329642020 | 20 | 17 | 3,316 | 3,060 | Accepted | Accepted | 15 | from collections import deque
s = eval(input())
res = deque()
for i in s:
if i == "0":
res.append("0")
elif i == "1":
res.append("1")
else:
if len(res) > 0:
res.pop()
print(("".join(res))) | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
s = eval(input())
res = []
for i in s:
if i == "0":
res.append("0")
elif i == "1":
res.append("1")
else:
if len(res) > 0:
... | 15 | 25 | 245 | 406 | from collections import deque
s = eval(input())
res = deque()
for i in s:
if i == "0":
res.append("0")
elif i == "1":
res.append("1")
else:
if len(res) > 0:
res.pop()
print(("".join(res)))
| import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
s = eval(input())
res = []
for i in s:
if i == "0":
res.append("0")
elif i == "1":
res.append("1")
else:
if len(res) > 0:
res.pop()
p... | false | 40 | [
"-from collections import deque",
"+import sys",
"-s = eval(input())",
"-res = deque()",
"-for i in s:",
"- if i == \"0\":",
"- res.append(\"0\")",
"- elif i == \"1\":",
"- res.append(\"1\")",
"- else:",
"- if len(res) > 0:",
"- res.pop()",
"-print((\... | false | 0.046954 | 0.048814 | 0.961897 | [
"s645346296",
"s329642020"
] |
u533039576 | p03274 | python | s140097060 | s352836175 | 121 | 88 | 14,368 | 14,252 | Accepted | Accepted | 27.27 | from bisect import bisect_left
n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
si = bisect_left(x, 0)
ans = (x[-1] - x[0]) * 2
if si + k - 1 < len(x):
ans = min(ans, x[si + k - 1])
if si - k >= 0:
ans = min(ans, abs(x[si - k]))
for i in range(n):
tmp_ans = 0
... | n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 10**9
for i in range(n - k + 1):
cand = x[i + k - 1] - x[i] + min(abs(x[i + k - 1]), abs(x[i]))
ans = min(ans, cand)
print(ans)
| 23 | 9 | 562 | 221 | from bisect import bisect_left
n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
si = bisect_left(x, 0)
ans = (x[-1] - x[0]) * 2
if si + k - 1 < len(x):
ans = min(ans, x[si + k - 1])
if si - k >= 0:
ans = min(ans, abs(x[si - k]))
for i in range(n):
tmp_ans = 0
if i < si and i +... | n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 10**9
for i in range(n - k + 1):
cand = x[i + k - 1] - x[i] + min(abs(x[i + k - 1]), abs(x[i]))
ans = min(ans, cand)
print(ans)
| false | 60.869565 | [
"-from bisect import bisect_left",
"-",
"-si = bisect_left(x, 0)",
"-ans = (x[-1] - x[0]) * 2",
"-if si + k - 1 < len(x):",
"- ans = min(ans, x[si + k - 1])",
"-if si - k >= 0:",
"- ans = min(ans, abs(x[si - k]))",
"-for i in range(n):",
"- tmp_ans = 0",
"- if i < si and i + k - 1 < ... | false | 0.060911 | 0.039641 | 1.536579 | [
"s140097060",
"s352836175"
] |
u733608212 | p03355 | python | s457629677 | s698741120 | 36 | 33 | 4,552 | 4,568 | Accepted | Accepted | 8.33 | s = eval(input())
K = int(eval(input()))
l = [chr(i) for i in range(97, 97+26)]
selected = []
for i in l:
if i in s:
index = []
for ind, j in enumerate(s):
if i == j:
index.append(ind)
for j in index:
temp = []
for k in range(5):
if j+k == len(s) or len(temp)... | s = eval(input())
K = int(eval(input()))
l = [chr(i) for i in range(97, 97+26)]
selected = []
for i in l:
if i in s:
index = []
for ind, j in enumerate(s):
if i == j:
index.append(ind)
for j in index:
for k in range(K):
if j+k == len(s):
break
se... | 21 | 20 | 489 | 456 | s = eval(input())
K = int(eval(input()))
l = [chr(i) for i in range(97, 97 + 26)]
selected = []
for i in l:
if i in s:
index = []
for ind, j in enumerate(s):
if i == j:
index.append(ind)
for j in index:
temp = []
for k in range(5):
... | s = eval(input())
K = int(eval(input()))
l = [chr(i) for i in range(97, 97 + 26)]
selected = []
for i in l:
if i in s:
index = []
for ind, j in enumerate(s):
if i == j:
index.append(ind)
for j in index:
for k in range(K):
if j + k == le... | false | 4.761905 | [
"- temp = []",
"- for k in range(5):",
"- if j + k == len(s) or len(temp) >= K:",
"+ for k in range(K):",
"+ if j + k == len(s):"
] | false | 0.042362 | 0.041736 | 1.015012 | [
"s457629677",
"s698741120"
] |
u678167152 | p02983 | python | s134534418 | s841280039 | 731 | 275 | 3,060 | 74,076 | Accepted | Accepted | 62.38 | L, R = list(map(int, input().split()))
m = 2019
if R-L>=2018:
for i in range(2019):
for j in range(i+1,2019):
m = min(m,i*j%2019)
else:
for i in range(L,R+1):
for j in range(i+1,R+1):
m = min(m,i*j%2019)
print(m) | def solve():
L, R = list(map(int, input().split()))
mod = 2019
table = [[0]*2019 for _ in range(2019)]
for i in range(2019):
for j in range(2019):
table[i][j] = i*j%mod
ans = 10**7
if R-L>=2018:
for i in range(2019):
for j in range(i+1,2019):
... | 13 | 27 | 246 | 758 | L, R = list(map(int, input().split()))
m = 2019
if R - L >= 2018:
for i in range(2019):
for j in range(i + 1, 2019):
m = min(m, i * j % 2019)
else:
for i in range(L, R + 1):
for j in range(i + 1, R + 1):
m = min(m, i * j % 2019)
print(m)
| def solve():
L, R = list(map(int, input().split()))
mod = 2019
table = [[0] * 2019 for _ in range(2019)]
for i in range(2019):
for j in range(2019):
table[i][j] = i * j % mod
ans = 10**7
if R - L >= 2018:
for i in range(2019):
for j in range(i + 1, 2019):
... | false | 51.851852 | [
"-L, R = list(map(int, input().split()))",
"-m = 2019",
"-if R - L >= 2018:",
"+def solve():",
"+ L, R = list(map(int, input().split()))",
"+ mod = 2019",
"+ table = [[0] * 2019 for _ in range(2019)]",
"- for j in range(i + 1, 2019):",
"- m = min(m, i * j % 2019)",
"-els... | false | 0.28381 | 3.468638 | 0.081822 | [
"s134534418",
"s841280039"
] |
u623819879 | p02735 | python | s248169283 | s668212999 | 253 | 215 | 43,116 | 41,708 | Accepted | Accepted | 15.02 | from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().spli... | from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().spli... | 71 | 71 | 2,527 | 2,469 | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
import sys, bisect, string, math, time, functools, random
def Golf():
(*a,) = map(int, open(0))
def I():
return int(input())
def S_():
return input... | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
import sys, bisect, string, math, time, functools, random
def Golf():
(*a,) = map(int, open(0))
def I():
return int(input())
def S_():
return input... | false | 0 | [
"- dp[j + 1] = min(dp[j] + 1 if (g[j], g[j + 1]) == (0, 1) else dp[j], dp[j + 1])",
"- dp[j + w] = min(dp[j] + 1 if (g[j], g[j + w]) == (0, 1) else dp[j], dp[j + w])",
"+ for d in (1, w):",
"+ dp[j + d] = min(dp[j] + 1 if (g[j], g[j + d]) == (0, 1) else dp[j], dp[j + d])"
] | false | 0.061763 | 0.061735 | 1.00046 | [
"s248169283",
"s668212999"
] |
u516272298 | p03807 | python | s047072038 | s141462160 | 67 | 44 | 14,108 | 14,108 | Accepted | Accepted | 34.33 | n = int(eval(input()))
a = list(map(int,input().split()))
b = 0
c = 0
for i in range(len(a)):
if a[i]%2 == 0:
b += 1
else:
c += 1
if c%2 == 0:
print("YES")
else:
print("NO") | n = int(eval(input()))
a = list(map(int,input().split()))
if sum(a) % 2 == 0:
print("YES")
else:
print("NO") | 13 | 6 | 211 | 115 | n = int(eval(input()))
a = list(map(int, input().split()))
b = 0
c = 0
for i in range(len(a)):
if a[i] % 2 == 0:
b += 1
else:
c += 1
if c % 2 == 0:
print("YES")
else:
print("NO")
| n = int(eval(input()))
a = list(map(int, input().split()))
if sum(a) % 2 == 0:
print("YES")
else:
print("NO")
| false | 53.846154 | [
"-b = 0",
"-c = 0",
"-for i in range(len(a)):",
"- if a[i] % 2 == 0:",
"- b += 1",
"- else:",
"- c += 1",
"-if c % 2 == 0:",
"+if sum(a) % 2 == 0:"
] | false | 0.068227 | 0.042731 | 1.596658 | [
"s047072038",
"s141462160"
] |
u777283665 | p03673 | python | s566739592 | s316883226 | 172 | 49 | 26,180 | 27,044 | Accepted | Accepted | 71.51 | n = int(eval(input()))
a = list(map(int, input().split()))
a_odd = a[0::2]
a_even = a[1::2]
if n % 2 == 0:
print((*(a_even[::-1] + a_odd)))
else:
print((*(a_odd[::-1] + a_even))) | n = int(eval(input()))
a = list(input().split())
if n % 2 == 0:
print((" ".join(a[1::2][::-1] + a[0::2])))
else:
print((" ".join(a[0::2][::-1] + a[1::2]))) | 8 | 6 | 183 | 158 | n = int(eval(input()))
a = list(map(int, input().split()))
a_odd = a[0::2]
a_even = a[1::2]
if n % 2 == 0:
print((*(a_even[::-1] + a_odd)))
else:
print((*(a_odd[::-1] + a_even)))
| n = int(eval(input()))
a = list(input().split())
if n % 2 == 0:
print((" ".join(a[1::2][::-1] + a[0::2])))
else:
print((" ".join(a[0::2][::-1] + a[1::2])))
| false | 25 | [
"-a = list(map(int, input().split()))",
"-a_odd = a[0::2]",
"-a_even = a[1::2]",
"+a = list(input().split())",
"- print((*(a_even[::-1] + a_odd)))",
"+ print((\" \".join(a[1::2][::-1] + a[0::2])))",
"- print((*(a_odd[::-1] + a_even)))",
"+ print((\" \".join(a[0::2][::-1] + a[1::2])))"
] | false | 0.039162 | 0.039997 | 0.97911 | [
"s566739592",
"s316883226"
] |
u131984977 | p02398 | python | s364538814 | s996100238 | 40 | 20 | 6,724 | 7,712 | Accepted | Accepted | 50 | (a, b, c) = [int(x) for x in input().split()]
count = 0
for d in range(a, b + 1):
if c % d == 0:
count += 1
print(count) | a, b, c = [int(i) for i in input().split()]
total = 0
for d in range(a, b + 1):
if c % d == 0:
total += 1
print(total) | 8 | 8 | 141 | 139 | (a, b, c) = [int(x) for x in input().split()]
count = 0
for d in range(a, b + 1):
if c % d == 0:
count += 1
print(count)
| a, b, c = [int(i) for i in input().split()]
total = 0
for d in range(a, b + 1):
if c % d == 0:
total += 1
print(total)
| false | 0 | [
"-(a, b, c) = [int(x) for x in input().split()]",
"-count = 0",
"+a, b, c = [int(i) for i in input().split()]",
"+total = 0",
"- count += 1",
"-print(count)",
"+ total += 1",
"+print(total)"
] | false | 0.038136 | 0.03667 | 1.039968 | [
"s364538814",
"s996100238"
] |
u416011173 | p02554 | python | s328888271 | s504909412 | 557 | 391 | 11,140 | 11,116 | Accepted | Accepted | 29.8 | # -*- coding: utf-8 -*-
# 標準入力を取得
N = int(eval(input()))
# 求解処理
ans = 2 * (10**N - 9**N) - (10**N - 8**N)
ans %= 10**9 + 7
# 結果出力
print(ans)
| # -*- coding: utf-8 -*-
def get_input() -> int:
"""
標準入力を取得する.
Returns:\n
int: 標準入力
"""
N = int(eval(input()))
return N
def main(N: int) -> None:
"""
メイン処理.
Args:\n
N (int): 整数(1 <= N <= 10**6)
"""
# 求解処理
ans = 10**N - 2 * 9**N ... | 10 | 35 | 146 | 469 | # -*- coding: utf-8 -*-
# 標準入力を取得
N = int(eval(input()))
# 求解処理
ans = 2 * (10**N - 9**N) - (10**N - 8**N)
ans %= 10**9 + 7
# 結果出力
print(ans)
| # -*- coding: utf-8 -*-
def get_input() -> int:
"""
標準入力を取得する.
Returns:\n
int: 標準入力
"""
N = int(eval(input()))
return N
def main(N: int) -> None:
"""
メイン処理.
Args:\n
N (int): 整数(1 <= N <= 10**6)
"""
# 求解処理
ans = 10**N - 2 * 9**N + 8**N
ans %= 10**9 + ... | false | 71.428571 | [
"-# 標準入力を取得",
"-N = int(eval(input()))",
"-# 求解処理",
"-ans = 2 * (10**N - 9**N) - (10**N - 8**N)",
"-ans %= 10**9 + 7",
"-# 結果出力",
"-print(ans)",
"+def get_input() -> int:",
"+ \"\"\"",
"+ 標準入力を取得する.",
"+ Returns:\\n",
"+ int: 標準入力",
"+ \"\"\"",
"+ N = int(eval(input()... | false | 0.115486 | 0.274228 | 0.421133 | [
"s328888271",
"s504909412"
] |
u489959379 | p02762 | python | s841243302 | s703880576 | 1,353 | 597 | 31,860 | 51,600 | Accepted | Accepted | 55.88 | # Union Find
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
# xの根を返す
def find(self, x):
if self.parents[x] < 0:
return x
else:
# 経路圧縮
self.parents[x] = self.find(self.parents[x])
return ... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
# 親が同じか判別
def find(self, x):
if self.parents[x] < 0:
return x
... | 59 | 66 | 1,359 | 1,562 | # Union Find
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
# xの根を返す
def find(self, x):
if self.parents[x] < 0:
return x
else:
# 経路圧縮
self.parents[x] = self.find(self.parents[x])
return self.parents[... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
# 親が同じか判別
def find(self, x):
if self.parents[x] < 0:
return x
else:
s... | false | 10.606061 | [
"-# Union Find",
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
"+input = sys.stdin.readline",
"+f_inf = float(\"inf\")",
"+mod = 10**9 + 7",
"+",
"+",
"- # xの根を返す",
"+ # 親が同じか判別",
"- # 経路圧縮",
"- # xの根とyを連結させる",
"+ # 根を繋ぎ直す",
"- # xとyの親が同じ根か判別",
"+ # ... | false | 0.036374 | 0.047929 | 0.75892 | [
"s841243302",
"s703880576"
] |
u276192130 | p03433 | python | s269122944 | s820404588 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | n = int(eval(input()))
a = int(eval(input()))
if n % 500 <= a:
print('Yes')
else:
print('No') | if int(eval(input())) % 500 <= int(eval(input())):
print('Yes')
else:
print('No') | 6 | 4 | 94 | 80 | n = int(eval(input()))
a = int(eval(input()))
if n % 500 <= a:
print("Yes")
else:
print("No")
| if int(eval(input())) % 500 <= int(eval(input())):
print("Yes")
else:
print("No")
| false | 33.333333 | [
"-n = int(eval(input()))",
"-a = int(eval(input()))",
"-if n % 500 <= a:",
"+if int(eval(input())) % 500 <= int(eval(input())):"
] | false | 0.043158 | 0.04562 | 0.94602 | [
"s269122944",
"s820404588"
] |
u573754721 | p03160 | python | s169466820 | s096662164 | 175 | 126 | 13,928 | 13,980 | Accepted | Accepted | 28 | n=int(eval(input()))
h=list(map(int,input().split()))
dp=[float('inf')]*n
dp[0]=0
for i in range(n-1):
dp[i+1]=min(dp[i+1],dp[i]+abs(h[i]-h[i+1]))
if i<n-2:
dp[i+2]=min(dp[i+2],dp[i]+abs(h[i]-h[i+2]))
print((dp[-1]))
| n=int(eval(input()))
h=list(map(int,input().split()))
dp=[float('inf')]*n
dp[0]=0
dp[1]=abs(h[0]-h[1])
for i in range(2,n):
dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print((dp[-1])) | 10 | 10 | 243 | 209 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0] = 0
for i in range(n - 1):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))
if i < n - 2:
dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]))
print((dp[-1]))
| n = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0] = 0
dp[1] = abs(h[0] - h[1])
for i in range(2, n):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| false | 0 | [
"-for i in range(n - 1):",
"- dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))",
"- if i < n - 2:",
"- dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]))",
"+dp[1] = abs(h[0] - h[1])",
"+for i in range(2, n):",
"+ dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + ab... | false | 0.056864 | 0.039122 | 1.453479 | [
"s169466820",
"s096662164"
] |
u485435834 | p03013 | python | s871930989 | s213243783 | 615 | 503 | 465,400 | 58,200 | Accepted | Accepted | 18.21 | N, M = list(map(int, input().split()))
a = set(int(eval(input())) for _ in range(M))
dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
dp[1] = 1
for i in range(2, N + 1):
for k in [-2, -1]:
if i + k not in a:
dp[i] += dp[i+k]
print((dp[N] % 1000000007))
| N, M = list(map(int, input().split()))
a = set(int(eval(input())) for _ in range(M))
dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
dp[1] = 1
for i in range(2, N + 1):
for k in [-2, -1]:
if i + k not in a:
dp[i] += dp[i+k]
dp[i] %= 1000000007
print((dp[N]))
| 13 | 14 | 276 | 296 | N, M = list(map(int, input().split()))
a = set(int(eval(input())) for _ in range(M))
dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
dp[1] = 1
for i in range(2, N + 1):
for k in [-2, -1]:
if i + k not in a:
dp[i] += dp[i + k]
print((dp[N] % 1000000007))
| N, M = list(map(int, input().split()))
a = set(int(eval(input())) for _ in range(M))
dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
dp[1] = 1
for i in range(2, N + 1):
for k in [-2, -1]:
if i + k not in a:
dp[i] += dp[i + k]
dp[i] %= 1000000007
print((dp[N]))
| false | 7.142857 | [
"-print((dp[N] % 1000000007))",
"+ dp[i] %= 1000000007",
"+print((dp[N]))"
] | false | 0.048766 | 0.048305 | 1.009548 | [
"s871930989",
"s213243783"
] |
u037430802 | p02925 | python | s321789135 | s059287003 | 953 | 589 | 83,932 | 80,988 | Accepted | Accepted | 38.2 |
from collections import deque
N = int(eval(input()))
A = [deque([int(x) - 1 for x in input().split()]) for _ in range(N)]
next_vs = [None] * N
day_finished = [0] * N
q = deque()
for i in range(N):
q.append(i)
"""
・試合したらそいつらをキューに積む
・試合できなかったら、次はこいつと戦いたいよリストにいれる
キューを全て確認したのに、 次はこいつと戦いたいよリスト... | """
愚直に考えると、
・今XXX日目です
・試合できる人は試合をします。
・その日一回でも試合があれば次の日に進んで、なかったらおわり
をやる。愚直にやろうとすると、
・各選手について、次に試合する相手
・各選手がその日に試合したかどうか(1日に同じ人が複数回試合できないので)
・現在XXX日目
などの情報を持つ必要があり、また、その日の終わりに、各選手が試合したかどうかなどから、その日1回でも試合があったか判定をしたり、処理がめんどくさい。
ちょっとひねった方法で考えると、
・各選手が順番に、自分が次に試合するべき相手を一人指名して場にカードを出す。
・マッチングが成立する(a->b, b->a の... | 43 | 53 | 789 | 1,249 | from collections import deque
N = int(eval(input()))
A = [deque([int(x) - 1 for x in input().split()]) for _ in range(N)]
next_vs = [None] * N
day_finished = [0] * N
q = deque()
for i in range(N):
q.append(i)
"""
・試合したらそいつらをキューに積む
・試合できなかったら、次はこいつと戦いたいよリストにいれる
キューを全て確認したのに、 次はこいつと戦いたいよリストが残っている/未試合の相手が残っている 状態であれば... | """
愚直に考えると、
・今XXX日目です
・試合できる人は試合をします。
・その日一回でも試合があれば次の日に進んで、なかったらおわり
をやる。愚直にやろうとすると、
・各選手について、次に試合する相手
・各選手がその日に試合したかどうか(1日に同じ人が複数回試合できないので)
・現在XXX日目
などの情報を持つ必要があり、また、その日の終わりに、各選手が試合したかどうかなどから、その日1回でも試合があったか判定をしたり、処理がめんどくさい。
ちょっとひねった方法で考えると、
・各選手が順番に、自分が次に試合するべき相手を一人指名して場にカードを出す。
・マッチングが成立する(a->b, b->a のカードが両方場に出される)と... | false | 18.867925 | [
"+\"\"\"",
"+愚直に考えると、",
"+・今XXX日目です",
"+・試合できる人は試合をします。",
"+・その日一回でも試合があれば次の日に進んで、なかったらおわり",
"+をやる。愚直にやろうとすると、",
"+・各選手について、次に試合する相手",
"+・各選手がその日に試合したかどうか(1日に同じ人が複数回試合できないので)",
"+・現在XXX日目",
"+などの情報を持つ必要があり、また、その日の終わりに、各選手が試合したかどうかなどから、その日1回でも試合があったか判定をしたり、処理がめんどくさい。",
"+ちょっとひねった方法で考えると、",
"+・各... | false | 0.110077 | 0.188097 | 0.585213 | [
"s321789135",
"s059287003"
] |
u897536433 | p03043 | python | s889219526 | s731565913 | 64 | 54 | 2,940 | 2,940 | Accepted | Accepted | 15.62 | def winrate(wn, wk):
b = 0
while wn * 2**b < wk:
b += 1
return 1/2 ** b
n, k = list(map(int,input().split()))
ans = 0
for i in range(1, n+1):
ans += 1/n * winrate(i, k)
print(ans)
| def winrate(wn, wk):
b = 0
c = wn
while c < wk:
b += 1
c *= 2
return 1/2 ** b
n, k = list(map(int,input().split()))
ans = 0
for i in range(1, n+1):
ans += 1/n * winrate(i, k)
print(ans)
| 11 | 13 | 209 | 229 | def winrate(wn, wk):
b = 0
while wn * 2**b < wk:
b += 1
return 1 / 2**b
n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
ans += 1 / n * winrate(i, k)
print(ans)
| def winrate(wn, wk):
b = 0
c = wn
while c < wk:
b += 1
c *= 2
return 1 / 2**b
n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
ans += 1 / n * winrate(i, k)
print(ans)
| false | 15.384615 | [
"- while wn * 2**b < wk:",
"+ c = wn",
"+ while c < wk:",
"+ c *= 2"
] | false | 0.067616 | 0.059054 | 1.144973 | [
"s889219526",
"s731565913"
] |
u952708174 | p02819 | python | s087259686 | s532922987 | 45 | 32 | 5,216 | 4,180 | Accepted | Accepted | 28.89 | def c_next_prime():
from bisect import bisect_left
X = int(eval(input()))
def prime_table(n):
"""n以下の素数のリスト(エラトステネスの篩)"""
is_prime = [True] * (n + 1)
is_prime[0] = is_prime[1] = False # 0と1は素数でない
for j in range(2, int(n**0.5) + 1):
if not is_prime[j]:
... | def c_next_prime():
from bisect import bisect_left
X = int(eval(input()))
def prime_table(n):
"""n以下の素数のリスト(エラトステネスの篩)"""
is_prime = [True] * (n + 1)
is_prime[0] = is_prime[1] = False # 0と1は素数でない
for j in range(2, int(n**0.5) + 1):
if not is_prime[j]:
... | 19 | 19 | 595 | 611 | def c_next_prime():
from bisect import bisect_left
X = int(eval(input()))
def prime_table(n):
"""n以下の素数のリスト(エラトステネスの篩)"""
is_prime = [True] * (n + 1)
is_prime[0] = is_prime[1] = False # 0と1は素数でない
for j in range(2, int(n**0.5) + 1):
if not is_prime[j]:
... | def c_next_prime():
from bisect import bisect_left
X = int(eval(input()))
def prime_table(n):
"""n以下の素数のリスト(エラトステネスの篩)"""
is_prime = [True] * (n + 1)
is_prime[0] = is_prime[1] = False # 0と1は素数でない
for j in range(2, int(n**0.5) + 1):
if not is_prime[j]:
... | false | 0 | [
"- primes = prime_table(2 * X)",
"+ primes = prime_table(min(2 * X, 10**5 + 3))"
] | false | 0.114402 | 0.095171 | 1.202068 | [
"s087259686",
"s532922987"
] |
u903005414 | p03317 | python | s352300460 | s871903491 | 39 | 17 | 13,880 | 2,940 | Accepted | Accepted | 56.41 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = ((N - 1) + (K - 1 - 1)) // (K - 1)
print(ans)
| N, K = list(map(int, input().split()))
ans = 1 + ((N - K) + (K - 2)) // (K - 1)
print(ans)
| 4 | 3 | 124 | 87 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = ((N - 1) + (K - 1 - 1)) // (K - 1)
print(ans)
| N, K = list(map(int, input().split()))
ans = 1 + ((N - K) + (K - 2)) // (K - 1)
print(ans)
| false | 25 | [
"-A = list(map(int, input().split()))",
"-ans = ((N - 1) + (K - 1 - 1)) // (K - 1)",
"+ans = 1 + ((N - K) + (K - 2)) // (K - 1)"
] | false | 0.034087 | 0.041553 | 0.820317 | [
"s352300460",
"s871903491"
] |
u638902622 | p03448 | python | s158824950 | s963012088 | 44 | 18 | 3,064 | 3,064 | Accepted | Accepted | 59.09 | import sys
## io
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list([x-1 for x in MII()])
## dp
INIT_VAL = 0
DP2 = lambda d1, d2: [[INIT_VAL]*d2 for _ in range(d1)]
DP3 = lambda d1, d2, d3: [[[INIT_VAL]*d3 for _ in range(d2)] for _ i... | import sys
## io
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list([x-1 for x in MII()])
## dp
INIT_VAL = 0
DP2 = lambda d1, d2: [[INIT_VAL]*d2 for _ in range(d1)]
DP3 = lambda d1, d2, d3: [[[INIT_VAL]*d3 for _ in range(d2)] for _ i... | 26 | 26 | 673 | 664 | import sys
## io
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list([x - 1 for x in MII()])
## dp
INIT_VAL = 0
DP2 = lambda d1, d2: [[INIT_VAL] * d2 for _ in range(d1)]
DP3 = lambda d1, d2, d3: [[[INIT_VAL] * d3 for _ in range(d2)] for _ in ... | import sys
## io
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list([x - 1 for x in MII()])
## dp
INIT_VAL = 0
DP2 = lambda d1, d2: [[INIT_VAL] * d2 for _ in range(d1)]
DP3 = lambda d1, d2, d3: [[[INIT_VAL] * d3 for _ in range(d2)] for _ in ... | false | 0 | [
"- for k in range(c + 1):",
"- if i * 500 + j * 100 + k * 50 == x:",
"- cnt += 1",
"+ k = (x - (i * 500 + j * 100)) // 50",
"+ if 0 <= k <= c:",
"+ cnt += 1"
] | false | 0.178581 | 0.038515 | 4.636703 | [
"s158824950",
"s963012088"
] |
u773265208 | p02725 | python | s756495239 | s744085075 | 256 | 196 | 26,444 | 25,840 | Accepted | Accepted | 23.44 | k,n = list(map(int,input().split()))
a = list(map(int,input().split()))
start = 0
max_sa = 0
for i in range(n):
if i+1 == n:
sa = a[(i+1)%n] - (a[i%n]-k)
else:
sa = a[(i+1)%n] - a[i%n]
if max_sa < sa:
max_sa = sa
start = (i+1)%n
ans = 0
for i in range(n-1):
if start+i+1 == n:
ans +=... | k,n = list(map(int,input().split()))
a = list(map(int,input().split()))
r = [(a[0]-a[-1])%k]
l = [(a[-1]-a[0])%k]
for i in range(1,n):
r.append(a[i] - a[i-1])
l.append(abs(a[-i-1] - a[-i]))
sum_l = sum(l)
sum_r = sum(r)
print((min(sum_l-max(l),sum_r-max(r))))
| 24 | 14 | 419 | 271 | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
start = 0
max_sa = 0
for i in range(n):
if i + 1 == n:
sa = a[(i + 1) % n] - (a[i % n] - k)
else:
sa = a[(i + 1) % n] - a[i % n]
if max_sa < sa:
max_sa = sa
start = (i + 1) % n
ans = 0
for i in range(n... | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
r = [(a[0] - a[-1]) % k]
l = [(a[-1] - a[0]) % k]
for i in range(1, n):
r.append(a[i] - a[i - 1])
l.append(abs(a[-i - 1] - a[-i]))
sum_l = sum(l)
sum_r = sum(r)
print((min(sum_l - max(l), sum_r - max(r))))
| false | 41.666667 | [
"-start = 0",
"-max_sa = 0",
"-for i in range(n):",
"- if i + 1 == n:",
"- sa = a[(i + 1) % n] - (a[i % n] - k)",
"- else:",
"- sa = a[(i + 1) % n] - a[i % n]",
"- if max_sa < sa:",
"- max_sa = sa",
"- start = (i + 1) % n",
"-ans = 0",
"-for i in range(n - ... | false | 0.086932 | 0.037601 | 2.311942 | [
"s756495239",
"s744085075"
] |
u309716323 | p04013 | python | s854880820 | s244588286 | 417 | 282 | 144,112 | 139,160 | Accepted | Accepted | 32.37 |
def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(' ')))
def solve():
"""
OPT[i][j][k] - sum is i, j number of elements, first k elements
OPT[i][j][k] = OPT[i-x[k]][j-1][k-1] if j-th element is taken
OPT[i][... |
def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(' ')))
def solve():
"""
OPT[i][j][k] - sum is i, j number of elements, first k elements
OPT[i][j][k] = OPT[i-x[k]][j-1][k-1] if j-th element is taken
OPT[i][... | 37 | 38 | 924 | 964 | def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(" ")))
def solve():
"""
OPT[i][j][k] - sum is i, j number of elements, first k elements
OPT[i][j][k] = OPT[i-x[k]][j-1][k-1] if j-th element is taken
OPT[i][j][k-1]
OPT[... | def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(" ")))
def solve():
"""
OPT[i][j][k] - sum is i, j number of elements, first k elements
OPT[i][j][k] = OPT[i-x[k]][j-1][k-1] if j-th element is taken
OPT[i][j][k-1]
OPT[... | false | 2.631579 | [
"- OPT = [[[0 for _ in range(51)] for _ in range(51)] for _ in range(2501)]",
"+ OPT = [",
"+ [[0 for _ in range(N + 1)] for _ in range(N + 1)] for _ in range(N * max(x) + 1)",
"+ ]",
"- for k in range(1, N + 1):",
"+ for k in range(j, N + 1):",
"- T += OPT[A... | false | 0.515727 | 0.006863 | 75.146811 | [
"s854880820",
"s244588286"
] |
u970197315 | p02762 | python | s039671231 | s582798270 | 1,389 | 878 | 37,948 | 42,228 | Accepted | Accepted | 36.79 | class UnionFind:
def __init__(self, n):
self.p = [-1]*n
# union by rank
self.r = [1]*n
def find(self, x):
if self.p[x] < 0:
return x
else:
self.p[x] = self.find(self.p[x])
return self.p[x]
def union(self, x, y):
... | class UnionFind:
def __init__(self, n):
self.p = [-1]*n
# union by rank
self.r = [1]*n
def find(self, x):
if self.p[x] < 0:
return x
else:
self.p[x] = self.find(self.p[x])
return self.p[x]
def union(self, x, y):
rx, ry = self.find(x), self.find(y)
... | 62 | 59 | 1,234 | 1,126 | class UnionFind:
def __init__(self, n):
self.p = [-1] * n
# union by rank
self.r = [1] * n
def find(self, x):
if self.p[x] < 0:
return x
else:
self.p[x] = self.find(self.p[x])
return self.p[x]
def union(self, x, y):
rx, ry... | class UnionFind:
def __init__(self, n):
self.p = [-1] * n
# union by rank
self.r = [1] * n
def find(self, x):
if self.p[x] < 0:
return x
else:
self.p[x] = self.find(self.p[x])
return self.p[x]
def union(self, x, y):
rx, ry... | false | 4.83871 | [
"-ans = []",
"+cnt = []",
"- ans.append(t)",
"+ cnt.append(t)",
"- ans[a] -= 1",
"- ans[b] -= 1",
"+ cnt[a] -= 1",
"+ cnt[b] -= 1",
"- ans[c] -= 1",
"- ans[d] -= 1",
"-print((*ans))",
"+ cnt[c] -= 1",
"+ cnt[d] -= 1",
"+print((*... | false | 0.036775 | 0.036402 | 1.010238 | [
"s039671231",
"s582798270"
] |
u035445296 | p02659 | python | s479982370 | s436968548 | 31 | 28 | 10,468 | 10,072 | Accepted | Accepted | 9.68 | from math import floor
from fractions import Fraction
a, b = input().split()
a = int(a)
b = Fraction(b)
print((floor(a * b))) | from math import floor
from decimal import Decimal
a, b = input().split()
a = int(a)
b = Decimal(b)
print((floor(a * b))) | 6 | 6 | 128 | 124 | from math import floor
from fractions import Fraction
a, b = input().split()
a = int(a)
b = Fraction(b)
print((floor(a * b)))
| from math import floor
from decimal import Decimal
a, b = input().split()
a = int(a)
b = Decimal(b)
print((floor(a * b)))
| false | 0 | [
"-from fractions import Fraction",
"+from decimal import Decimal",
"-b = Fraction(b)",
"+b = Decimal(b)"
] | false | 0.059092 | 0.122203 | 0.483556 | [
"s479982370",
"s436968548"
] |
u170201762 | p03164 | python | s509528470 | s310181832 | 1,963 | 1,213 | 320,116 | 311,064 | Accepted | Accepted | 38.21 | N,W = list(map(int,input().split()))
c = [tuple(map(int,input().split())) for i in range(N)]
DP = [[float('inf') for i in range(10**3*N+1)] for i in range(N+1)]
DP[0][0] = 0
for i in range(N):
for v in range(10**3*N+1):
if v-c[i][1] < 0:
DP[i+1][v] = DP[i][v]
else:
D... | INF = float('inf')
N,W = list(map(int,input().split()))
wv = [list(map(int,input().split())) for _ in range(N)]
V = 1000*N
dp = [[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-wv[i][1] >= 0:
dp[i+1][j] = min(dp[i][j-wv[i][1]]+wv[i][0],dp[i][j])
... | 18 | 19 | 483 | 491 | N, W = list(map(int, input().split()))
c = [tuple(map(int, input().split())) for i in range(N)]
DP = [[float("inf") for i in range(10**3 * N + 1)] for i in range(N + 1)]
DP[0][0] = 0
for i in range(N):
for v in range(10**3 * N + 1):
if v - c[i][1] < 0:
DP[i + 1][v] = DP[i][v]
else:
... | INF = float("inf")
N, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(N)]
V = 1000 * N
dp = [[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 - wv[i][1] >= 0:
dp[i + 1][j] = min(dp[i][j - wv[i][1]] + wv[i]... | false | 5.263158 | [
"+INF = float(\"inf\")",
"-c = [tuple(map(int, input().split())) for i in range(N)]",
"-DP = [[float(\"inf\") for i in range(10**3 * N + 1)] for i in range(N + 1)]",
"-DP[0][0] = 0",
"+wv = [list(map(int, input().split())) for _ in range(N)]",
"+V = 1000 * N",
"+dp = [[INF] * (V + 1) for _ in range(N + ... | false | 0.138641 | 0.127371 | 1.088485 | [
"s509528470",
"s310181832"
] |
u576432509 | p03457 | python | s699262232 | s416463759 | 461 | 369 | 27,324 | 11,636 | Accepted | Accepted | 19.96 | def ynf(dt,dx,dy):
# print(dt,dx,dy)
if (dx+dy)>dt:
return 0
if (dx+dy)%2 != dt%2:
return 0
return 1
icase=0
if icase==0:
n=int(eval(input()))
txy=[]
for i in range(n):
txy.append(list(map(int,input().split())))
elif icase==1:
n=2
txy=[]
t... | n=int(eval(input()))
t=[0]*(n+1)
x=[0]*(n+1)
y=[0]*(n+1)
for i in range(1,n+1):
t[i],x[i],y[i]=list(map(int,input().split()))
yn=""
for i in range(n):
ti=t[i+1]-t[i]
d=abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
if d>ti or ti%2!=d%2:
yn="No"
break
if yn=="No":
print... | 49 | 21 | 859 | 345 | def ynf(dt, dx, dy):
# print(dt,dx,dy)
if (dx + dy) > dt:
return 0
if (dx + dy) % 2 != dt % 2:
return 0
return 1
icase = 0
if icase == 0:
n = int(eval(input()))
txy = []
for i in range(n):
txy.append(list(map(int, input().split())))
elif icase == 1:
n = 2
... | n = int(eval(input()))
t = [0] * (n + 1)
x = [0] * (n + 1)
y = [0] * (n + 1)
for i in range(1, n + 1):
t[i], x[i], y[i] = list(map(int, input().split()))
yn = ""
for i in range(n):
ti = t[i + 1] - t[i]
d = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
if d > ti or ti % 2 != d % 2:
yn = "No"
... | false | 57.142857 | [
"-def ynf(dt, dx, dy):",
"- # print(dt,dx,dy)",
"- if (dx + dy) > dt:",
"- return 0",
"- if (dx + dy) % 2 != dt % 2:",
"- return 0",
"- return 1",
"-",
"-",
"-icase = 0",
"-if icase == 0:",
"- n = int(eval(input()))",
"- txy = []",
"- for i in range(n)... | false | 0.04137 | 0.052619 | 0.786218 | [
"s699262232",
"s416463759"
] |
u968166680 | p03222 | python | s055647189 | s632221255 | 44 | 35 | 9,136 | 9,164 | Accepted | Accepted | 20.45 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
H, W, K = list(map(int, readline().split()))
dp = [0] * W
dp[0] = 1
for _ in range(H):
dp, dp_prev = [0] ... | import sys
from itertools import product
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
H, W, K = list(map(int, readline().split()))
A = product((0, 1), repeat=W - 1)
B = []
... | 41 | 46 | 1,022 | 1,046 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
H, W, K = list(map(int, readline().split()))
dp = [0] * W
dp[0] = 1
for _ in range(H):
dp, dp_prev = [0] * W, dp
for m... | import sys
from itertools import product
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
H, W, K = list(map(int, readline().split()))
A = product((0, 1), repeat=W - 1)
B = []
for bars in A:
... | false | 10.869565 | [
"+from itertools import product",
"+ A = product((0, 1), repeat=W - 1)",
"+ B = []",
"+ for bars in A:",
"+ ok = True",
"+ for i in range(W - 2):",
"+ if bars[i] and bars[i + 1]:",
"+ ok = False",
"+ break",
"+ if ok:",
"+ ... | false | 0.038806 | 0.038589 | 1.005635 | [
"s055647189",
"s632221255"
] |
u510814835 | p02694 | python | s202411542 | s040394736 | 24 | 22 | 9,116 | 9,116 | Accepted | Accepted | 8.33 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
x = int(eval(input()))
base = 100
year = 0
while True:
year += 1
base = int(base * 1.01)
if(x <= base):
print(year)
break
#結果:
#コード長:206 Byte
#処理速度:21 ms
#メモリ: 9096 KB | #!/usr/bin/env python
# -*- coding: utf-8 -*-
x = int(eval(input()))
base = 100
year = 0
while True:
year = year + 1
base = int(base * 1.01)
if(x <= base):
print(year)
break
#結果:
#コード長:206 Byte
#処理速度:21 ms
#メモリ: 9096 KB | 16 | 16 | 255 | 260 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
x = int(eval(input()))
base = 100
year = 0
while True:
year += 1
base = int(base * 1.01)
if x <= base:
print(year)
break
# 結果:
# コード長:206 Byte
# 処理速度:21 ms
# メモリ: 9096 KB
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
x = int(eval(input()))
base = 100
year = 0
while True:
year = year + 1
base = int(base * 1.01)
if x <= base:
print(year)
break
# 結果:
# コード長:206 Byte
# 処理速度:21 ms
# メモリ: 9096 KB
| false | 0 | [
"- year += 1",
"+ year = year + 1"
] | false | 0.036395 | 0.034297 | 1.061154 | [
"s202411542",
"s040394736"
] |
u021019433 | p02837 | python | s302342492 | s963659415 | 61 | 55 | 3,064 | 3,064 | Accepted | Accepted | 9.84 | from itertools import combinations, count
n = int(eval(input()))
r = list(range(n))
a = [(set(), set()) for _ in r]
for i in r:
for _ in range(int(eval(input()))):
x, y = list(map(int, input().split()))
a[i][y].add(x - 1)
r = next(i for i in count(n, -1) for x in combinations(r, i)
if all... | from itertools import combinations, count
n = int(eval(input()))
r = list(range(n))
a = [(set(), set()) for _ in r]
for i in r:
for _ in range(int(eval(input()))):
x, y = list(map(int, input().split()))
a[i][y].add(x - 1)
r = next(i for i in count(n, -1) for x in map(set, combinations(r, i))
... | 12 | 12 | 366 | 376 | from itertools import combinations, count
n = int(eval(input()))
r = list(range(n))
a = [(set(), set()) for _ in r]
for i in r:
for _ in range(int(eval(input()))):
x, y = list(map(int, input().split()))
a[i][y].add(x - 1)
r = next(
i
for i in count(n, -1)
for x in combinations(r, i)
... | from itertools import combinations, count
n = int(eval(input()))
r = list(range(n))
a = [(set(), set()) for _ in r]
for i in r:
for _ in range(int(eval(input()))):
x, y = list(map(int, input().split()))
a[i][y].add(x - 1)
r = next(
i
for i in count(n, -1)
for x in map(set, combinations(... | false | 0 | [
"- for x in combinations(r, i)",
"+ for x in map(set, combinations(r, i))"
] | false | 0.039621 | 0.03924 | 1.009697 | [
"s302342492",
"s963659415"
] |
u969190727 | p03371 | python | s358719135 | s944521020 | 262 | 121 | 3,064 | 3,060 | Accepted | Accepted | 53.82 | a,b,c,x,y=list(map(int,input().split()))
ans=float("inf")
for i in range(2*(max(x,y)+1)):
p=i*c
p+=max(x-i//2,0)*a
p+=max(y-i//2,0)*b
ans=min(p,ans)
print(ans) | a,b,c,x,y=list(map(int,input().split()))
ans=a*x+b*y
n=max(x,y)
for i in range(1,n+1):
ans=min(ans,2*i*c+a*max(0,x-i)+b*max(0,y-i))
print(ans)
| 8 | 8 | 168 | 148 | a, b, c, x, y = list(map(int, input().split()))
ans = float("inf")
for i in range(2 * (max(x, y) + 1)):
p = i * c
p += max(x - i // 2, 0) * a
p += max(y - i // 2, 0) * b
ans = min(p, ans)
print(ans)
| a, b, c, x, y = list(map(int, input().split()))
ans = a * x + b * y
n = max(x, y)
for i in range(1, n + 1):
ans = min(ans, 2 * i * c + a * max(0, x - i) + b * max(0, y - i))
print(ans)
| false | 0 | [
"-ans = float(\"inf\")",
"-for i in range(2 * (max(x, y) + 1)):",
"- p = i * c",
"- p += max(x - i // 2, 0) * a",
"- p += max(y - i // 2, 0) * b",
"- ans = min(p, ans)",
"+ans = a * x + b * y",
"+n = max(x, y)",
"+for i in range(1, n + 1):",
"+ ans = min(ans, 2 * i * c + a * max(0, ... | false | 0.118826 | 0.054534 | 2.17893 | [
"s358719135",
"s944521020"
] |
u450956662 | p02937 | python | s412409514 | s909340824 | 199 | 150 | 7,692 | 7,540 | Accepted | Accepted | 24.62 | import bisect
S = eval(input())
T = eval(input())
d = [[] for _ in range(27)]
alpha2num = lambda c: ord(c) - ord("a") + 1
for i, s in enumerate(S):
d[alpha2num(s)].append(i)
idx = -1
l = 0
ans = 0
for t in T:
dl = d[alpha2num(t)]
if not dl:
ans = -1
break
insert_id... | import bisect
S = eval(input())
T = eval(input())
d = [[] for _ in range(27)]
# alpha2num = lambda c: ord(c) - ord("a") + 1
d = {chr(c): [] for c in range(ord("a"), ord("z")+1)}
for i, s in enumerate(S):
# d[alpha2num(s)].append(i)
d[s].append(i)
idx = -1
l = 0
ans = 0
for t in T:
# dl ... | 28 | 31 | 495 | 591 | import bisect
S = eval(input())
T = eval(input())
d = [[] for _ in range(27)]
alpha2num = lambda c: ord(c) - ord("a") + 1
for i, s in enumerate(S):
d[alpha2num(s)].append(i)
idx = -1
l = 0
ans = 0
for t in T:
dl = d[alpha2num(t)]
if not dl:
ans = -1
break
insert_idx = bisect.bisect_righ... | import bisect
S = eval(input())
T = eval(input())
d = [[] for _ in range(27)]
# alpha2num = lambda c: ord(c) - ord("a") + 1
d = {chr(c): [] for c in range(ord("a"), ord("z") + 1)}
for i, s in enumerate(S):
# d[alpha2num(s)].append(i)
d[s].append(i)
idx = -1
l = 0
ans = 0
for t in T:
# dl = d[alpha2num(t)]
... | false | 9.677419 | [
"-alpha2num = lambda c: ord(c) - ord(\"a\") + 1",
"+# alpha2num = lambda c: ord(c) - ord(\"a\") + 1",
"+d = {chr(c): [] for c in range(ord(\"a\"), ord(\"z\") + 1)}",
"- d[alpha2num(s)].append(i)",
"+ # d[alpha2num(s)].append(i)",
"+ d[s].append(i)",
"- dl = d[alpha2num(t)]",
"+ # dl = d... | false | 0.0443 | 0.120401 | 0.36794 | [
"s412409514",
"s909340824"
] |
u901582103 | p03999 | python | s966821909 | s131289874 | 26 | 21 | 3,060 | 4,140 | Accepted | Accepted | 19.23 | s=eval(input())
n=len(s)
f=0
for i in range(1<<n-1):
a=s[0]
for j in range(n-1):
if i&(1<<j):
a+='+'+s[j+1]
else:
a+=s[j+1]
f+=eval(a)
print(f) | def dfs(i,f):
if i==n-1:
return f
return dfs(i+1,f+s[i+1])+'+'+dfs(i+1,f+'+'+s[i+1])
s=eval(input())
n=len(s)
print((eval(dfs(0,s[0])))) | 12 | 7 | 200 | 150 | s = eval(input())
n = len(s)
f = 0
for i in range(1 << n - 1):
a = s[0]
for j in range(n - 1):
if i & (1 << j):
a += "+" + s[j + 1]
else:
a += s[j + 1]
f += eval(a)
print(f)
| def dfs(i, f):
if i == n - 1:
return f
return dfs(i + 1, f + s[i + 1]) + "+" + dfs(i + 1, f + "+" + s[i + 1])
s = eval(input())
n = len(s)
print((eval(dfs(0, s[0]))))
| false | 41.666667 | [
"+def dfs(i, f):",
"+ if i == n - 1:",
"+ return f",
"+ return dfs(i + 1, f + s[i + 1]) + \"+\" + dfs(i + 1, f + \"+\" + s[i + 1])",
"+",
"+",
"-f = 0",
"-for i in range(1 << n - 1):",
"- a = s[0]",
"- for j in range(n - 1):",
"- if i & (1 << j):",
"- a += ... | false | 0.105511 | 0.072685 | 1.451622 | [
"s966821909",
"s131289874"
] |
u844646164 | p02918 | python | s675870728 | s897426514 | 70 | 58 | 4,780 | 7,804 | Accepted | Accepted | 17.14 | N, K = list(map(int, input().split()))
S = list(eval(input()))
T = []
pre = S[0]
cnt = 0
ans = -1
for i in range(N):
if S[i] == pre:
cnt += 1
pass
else:
T += [pre]
ans += cnt
cnt = 0
pre = S[i]
ans += cnt
T += [pre]
ans += min(K*2, len(T)-1)
print(ans) | N, K = list(map(int, input().split()))
S = list(eval(input()))
diff = []
ans = 0
for i in range(N-1):
if S[i] != S[i+1]:
diff += [i]
else:
ans += 1
print((min(N-1, ans+2*min(K, len(diff))))) | 20 | 12 | 288 | 201 | N, K = list(map(int, input().split()))
S = list(eval(input()))
T = []
pre = S[0]
cnt = 0
ans = -1
for i in range(N):
if S[i] == pre:
cnt += 1
pass
else:
T += [pre]
ans += cnt
cnt = 0
pre = S[i]
ans += cnt
T += [pre]
ans += min(K * 2, len(T) - 1)
print(ans)
| N, K = list(map(int, input().split()))
S = list(eval(input()))
diff = []
ans = 0
for i in range(N - 1):
if S[i] != S[i + 1]:
diff += [i]
else:
ans += 1
print((min(N - 1, ans + 2 * min(K, len(diff)))))
| false | 40 | [
"-T = []",
"-pre = S[0]",
"-cnt = 0",
"-ans = -1",
"-for i in range(N):",
"- if S[i] == pre:",
"- cnt += 1",
"- pass",
"+diff = []",
"+ans = 0",
"+for i in range(N - 1):",
"+ if S[i] != S[i + 1]:",
"+ diff += [i]",
"- T += [pre]",
"- ans += cnt",
... | false | 0.044133 | 0.034369 | 1.284099 | [
"s675870728",
"s897426514"
] |
u813387707 | p02971 | python | s424418782 | s521306645 | 564 | 363 | 14,112 | 18,856 | Accepted | Accepted | 35.64 | n = int(eval(input()))
a_list = []
for _ in range(n):
a = int(eval(input()))
a_list.append(a)
b_list = sorted(a_list, reverse=True)
for a in a_list:
ans = b_list[0] if a != b_list[0] else b_list[1]
print(ans) | n = int(eval(input()))
a_list = [int(eval(input())) for _ in range(n)]
b_list = sorted(a_list, reverse=True)
for a in a_list:
print((b_list[0] if a != b_list[0] else b_list[1])) | 11 | 5 | 224 | 171 | n = int(eval(input()))
a_list = []
for _ in range(n):
a = int(eval(input()))
a_list.append(a)
b_list = sorted(a_list, reverse=True)
for a in a_list:
ans = b_list[0] if a != b_list[0] else b_list[1]
print(ans)
| n = int(eval(input()))
a_list = [int(eval(input())) for _ in range(n)]
b_list = sorted(a_list, reverse=True)
for a in a_list:
print((b_list[0] if a != b_list[0] else b_list[1]))
| false | 54.545455 | [
"-a_list = []",
"-for _ in range(n):",
"- a = int(eval(input()))",
"- a_list.append(a)",
"+a_list = [int(eval(input())) for _ in range(n)]",
"- ans = b_list[0] if a != b_list[0] else b_list[1]",
"- print(ans)",
"+ print((b_list[0] if a != b_list[0] else b_list[1]))"
] | false | 0.043113 | 0.070886 | 0.60821 | [
"s424418782",
"s521306645"
] |
u634079249 | p03294 | python | s446588898 | s325113299 | 97 | 22 | 3,560 | 3,572 | Accepted | Accepted | 77.32 | import sys
import os
import math
import bisect
import collections
import itertools
import heapq
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.... | import sys
import os
import math
import bisect
import collections
import itertools
import heapq
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.... | 38 | 38 | 927 | 907 | import sys
import os
import math
import bisect
import collections
import itertools
import heapq
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffe... | import sys
import os
import math
import bisect
import collections
import itertools
import heapq
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffe... | false | 0 | [
"- q = 1",
"+ q = 0",
"- q *= a",
"- print((sum((q - 1) % a for a in A)))",
"+ q += a - 1",
"+ print(q)"
] | false | 0.036863 | 0.037453 | 0.984223 | [
"s446588898",
"s325113299"
] |
u263044948 | p03494 | python | s616922157 | s194230633 | 184 | 159 | 13,696 | 12,496 | Accepted | Accepted | 13.59 | import numpy as np
n=int(eval(input()))
a=list(map(int, input().split()))
b=np.array(a)
c=0
while all(b%2==0):
b=b/2
c += 1
print(c) | import numpy as np
n=int(eval(input()))
a=list(map(int, input().split()))
b=np.array([i for i in a])
c=0
while all(b%2==0):
b=b/2
c += 1
print(c) | 12 | 12 | 152 | 159 | import numpy as np
n = int(eval(input()))
a = list(map(int, input().split()))
b = np.array(a)
c = 0
while all(b % 2 == 0):
b = b / 2
c += 1
print(c)
| import numpy as np
n = int(eval(input()))
a = list(map(int, input().split()))
b = np.array([i for i in a])
c = 0
while all(b % 2 == 0):
b = b / 2
c += 1
print(c)
| false | 0 | [
"-b = np.array(a)",
"+b = np.array([i for i in a])"
] | false | 0.524788 | 0.494678 | 1.060868 | [
"s616922157",
"s194230633"
] |
u816116805 | p03295 | python | s619838704 | s096861253 | 1,046 | 387 | 18,160 | 18,160 | Accepted | Accepted | 63 | n,m=list(map(int,input().split()))
ass=[tuple(map(int,input().split())) for i in range(m)]
ass.sort(key=lambda x:x[1])
acum = []
def ifsatisfied(ab):
for x in acum:
if ab[0]<x <=ab[1]:
return(True)
return(False)
for ab in ass:
if not ifsatisfied(ab):
acum.append(... | n,m=list(map(int,input().split()))
ass=[tuple(map(int,input().split())) for i in range(m)]
ass.sort(key=lambda x:x[1])
acum = []
def ifsatisfied(ab):
for x in acum:
if ab[0]<x <=ab[1]:
return(True)
return(False)
for ab in ass:
if (acum == [] or ab[0]>=acum[-1]):
... | 17 | 17 | 341 | 353 | n, m = list(map(int, input().split()))
ass = [tuple(map(int, input().split())) for i in range(m)]
ass.sort(key=lambda x: x[1])
acum = []
def ifsatisfied(ab):
for x in acum:
if ab[0] < x <= ab[1]:
return True
return False
for ab in ass:
if not ifsatisfied(ab):
acum.append(ab[1... | n, m = list(map(int, input().split()))
ass = [tuple(map(int, input().split())) for i in range(m)]
ass.sort(key=lambda x: x[1])
acum = []
def ifsatisfied(ab):
for x in acum:
if ab[0] < x <= ab[1]:
return True
return False
for ab in ass:
if acum == [] or ab[0] >= acum[-1]:
acum... | false | 0 | [
"- if not ifsatisfied(ab):",
"+ if acum == [] or ab[0] >= acum[-1]:"
] | false | 0.068971 | 0.062949 | 1.095664 | [
"s619838704",
"s096861253"
] |
u989345508 | p02820 | python | s507917049 | s555112660 | 193 | 127 | 14,112 | 90,764 | Accepted | Accepted | 34.2 | n,k=list(map(int,input().split()))
x=list(map(int,input().split()))
t=eval(input())
y=[[] for i in range(k)]
for i in range(n):
if t[i]=="r":
y[i%k].append(2)
elif t[i]=="s":
y[i%k].append(0)
else:
y[i%k].append(1)
def groupby(a):
a2=[[a[0],1]]
for i in range(1... | n,k=list(map(int,input().split()))
dp=[[0,0,0] for i in range(n)]
janken=list(map(int,input().split( )))
t=[0 if i=="r" else 1 if i=="s" else 2 for i in eval(input())]
#直後の手を見て決める
for i in range(n):
if i<k:
for j in range(3):
if (j+1)%3==t[i]:
dp[i][j]=janken[j]
els... | 27 | 24 | 572 | 686 | n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
t = eval(input())
y = [[] for i in range(k)]
for i in range(n):
if t[i] == "r":
y[i % k].append(2)
elif t[i] == "s":
y[i % k].append(0)
else:
y[i % k].append(1)
def groupby(a):
a2 = [[a[0], 1]]
for i... | n, k = list(map(int, input().split()))
dp = [[0, 0, 0] for i in range(n)]
janken = list(map(int, input().split()))
t = [0 if i == "r" else 1 if i == "s" else 2 for i in eval(input())]
# 直後の手を見て決める
for i in range(n):
if i < k:
for j in range(3):
if (j + 1) % 3 == t[i]:
dp[i][j] = ... | false | 11.111111 | [
"-x = list(map(int, input().split()))",
"-t = eval(input())",
"-y = [[] for i in range(k)]",
"+dp = [[0, 0, 0] for i in range(n)]",
"+janken = list(map(int, input().split()))",
"+t = [0 if i == \"r\" else 1 if i == \"s\" else 2 for i in eval(input())]",
"+# 直後の手を見て決める",
"- if t[i] == \"r\":",
"- ... | false | 0.007813 | 0.04239 | 0.18431 | [
"s507917049",
"s555112660"
] |
u803617136 | p02844 | python | s139968868 | s280522610 | 479 | 19 | 43,356 | 3,060 | Accepted | Accepted | 96.03 | N = int(eval(input()))
S = list(eval(input()))
ans = 0
for n in range(1000):
pin = str(n).zfill(3)
head = 0
for c in S:
if c == pin[head]:
head += 1
if head == 3:
ans += 1
break
print(ans)
| n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(10):
for j in range(10):
for k in range(10):
i_index = s.find(str(i))
if i_index > - 1:
j_index = s.find(str(j), i_index + 1)
if j_index > -1:
k_index = s.fi... | 16 | 14 | 259 | 415 | N = int(eval(input()))
S = list(eval(input()))
ans = 0
for n in range(1000):
pin = str(n).zfill(3)
head = 0
for c in S:
if c == pin[head]:
head += 1
if head == 3:
ans += 1
break
print(ans)
| n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(10):
for j in range(10):
for k in range(10):
i_index = s.find(str(i))
if i_index > -1:
j_index = s.find(str(j), i_index + 1)
if j_index > -1:
k_index = s.find(str(k), j... | false | 12.5 | [
"-N = int(eval(input()))",
"-S = list(eval(input()))",
"+n = int(eval(input()))",
"+s = eval(input())",
"-for n in range(1000):",
"- pin = str(n).zfill(3)",
"- head = 0",
"- for c in S:",
"- if c == pin[head]:",
"- head += 1",
"- if head == 3:",
"- ... | false | 0.142638 | 0.035149 | 4.058113 | [
"s139968868",
"s280522610"
] |
u067237725 | p02586 | python | s233898508 | s536089226 | 1,469 | 859 | 465,084 | 467,664 | Accepted | Accepted | 41.52 | import sys
import numpy as np
from numba import njit, void, i8
input = sys.stdin.buffer.readline
def main():
R, C, K = list(map(int, input().split()))
cell = np.full((R+1, C+1), 0, dtype=np.int64)
for i in range(K):
x, y, c = list(map(int, input().split()))
cell[x-1, y-1] = c
... | import sys
import numpy as np
from numba import njit, void, i8
def main():
R, C, K = list(map(int, readline().split()))
items = np.array(read().split(), dtype=np.int64)
print((calc(R, C, K, items)))
@njit(i8(i8, i8, i8, i8[:]), cache=True)
def calc(R, C, K, items):
cell = np.zeros((R, C), d... | 31 | 39 | 1,018 | 1,279 | import sys
import numpy as np
from numba import njit, void, i8
input = sys.stdin.buffer.readline
def main():
R, C, K = list(map(int, input().split()))
cell = np.full((R + 1, C + 1), 0, dtype=np.int64)
for i in range(K):
x, y, c = list(map(int, input().split()))
cell[x - 1, y - 1] = c
... | import sys
import numpy as np
from numba import njit, void, i8
def main():
R, C, K = list(map(int, readline().split()))
items = np.array(read().split(), dtype=np.int64)
print((calc(R, C, K, items)))
@njit(i8(i8, i8, i8, i8[:]), cache=True)
def calc(R, C, K, items):
cell = np.zeros((R, C), dtype=np.i... | false | 20.512821 | [
"-input = sys.stdin.buffer.readline",
"+",
"+def main():",
"+ R, C, K = list(map(int, readline().split()))",
"+ items = np.array(read().split(), dtype=np.int64)",
"+ print((calc(R, C, K, items)))",
"-def main():",
"- R, C, K = list(map(int, input().split()))",
"- cell = np.full((R + 1... | false | 0.528763 | 0.625733 | 0.845031 | [
"s233898508",
"s536089226"
] |
u020390084 | p02713 | python | s413515194 | s490552468 | 679 | 494 | 9,512 | 67,768 | Accepted | Accepted | 27.25 | #!/usr/bin/env python3
import sys
import math
def solve(K: int):
answer = 0
GCDLIST = [[1]*(K+1) for _ in range(K+1)]
for i in range(1,K+1):
for j in range(1,K+1):
g = math.gcd(i,j)
GCDLIST[i][j] = g
GCDLIST[j][i] = g
for i in range(1,K+1)... | #!/usr/bin/env python3
import sys
import math
def solve(K: int):
answer = 0
# GCDLIST = [[1]*(K+1) for _ in range(K+1)]
# for i in range(1,K+1):
# for j in range(1,K+1):
# g = math.gcd(i,j)
# GCDLIST[i][j] = g
# GCDLIST[j][i] = g
for i in ... | 35 | 35 | 918 | 930 | #!/usr/bin/env python3
import sys
import math
def solve(K: int):
answer = 0
GCDLIST = [[1] * (K + 1) for _ in range(K + 1)]
for i in range(1, K + 1):
for j in range(1, K + 1):
g = math.gcd(i, j)
GCDLIST[i][j] = g
GCDLIST[j][i] = g
for i in range(1, K + 1):
... | #!/usr/bin/env python3
import sys
import math
def solve(K: int):
answer = 0
# GCDLIST = [[1]*(K+1) for _ in range(K+1)]
# for i in range(1,K+1):
# for j in range(1,K+1):
# g = math.gcd(i,j)
# GCDLIST[i][j] = g
# GCDLIST[j][i] = g
for i in range(1, K + 1):
... | false | 0 | [
"- GCDLIST = [[1] * (K + 1) for _ in range(K + 1)]",
"- for i in range(1, K + 1):",
"- for j in range(1, K + 1):",
"- g = math.gcd(i, j)",
"- GCDLIST[i][j] = g",
"- GCDLIST[j][i] = g",
"+ # GCDLIST = [[1]*(K+1) for _ in range(K+1)]",
"+ # for i in ra... | false | 0.301547 | 0.141576 | 2.12993 | [
"s413515194",
"s490552468"
] |
u204800924 | p02701 | python | s229990218 | s572718166 | 340 | 287 | 23,616 | 35,300 | Accepted | Accepted | 15.59 | n = int(eval(input()))
s = []
for _ in range(n):
s.append(eval(input()))
s.sort()
ans = n
for i in range(n-1):
if s[i] == s[i+1]:
ans -= 1
print(ans) | n = int(eval(input()))
s = []
for _ in range(n):
s.append(eval(input()))
types = set(s)
print((len(types))) | 13 | 7 | 168 | 104 | n = int(eval(input()))
s = []
for _ in range(n):
s.append(eval(input()))
s.sort()
ans = n
for i in range(n - 1):
if s[i] == s[i + 1]:
ans -= 1
print(ans)
| n = int(eval(input()))
s = []
for _ in range(n):
s.append(eval(input()))
types = set(s)
print((len(types)))
| false | 46.153846 | [
"-s.sort()",
"-ans = n",
"-for i in range(n - 1):",
"- if s[i] == s[i + 1]:",
"- ans -= 1",
"-print(ans)",
"+types = set(s)",
"+print((len(types)))"
] | false | 0.035169 | 0.035158 | 1.000313 | [
"s229990218",
"s572718166"
] |
u260216890 | p02616 | python | s029278251 | s643548908 | 1,796 | 163 | 114,624 | 113,056 | Accepted | Accepted | 90.92 | n,k=list(map(int, input().split()))
a = list(map(int, input().split()))
mod=10**9+7
if n==k:
ans=1
for i in range(k):
ans*=a[i]
ans%=mod
print(ans)
exit()
minus=[i for i in a if i<0]
plus=[i for i in a if i>=0]
from collections import deque
minus=deque(sorted(minus))
plus=d... | n,k=list(map(int, input().split()))
a = list(map(int, input().split()))
mod=10**9+7
if n==k:
ans=1
for i in range(k):
ans*=a[i]
ans%=mod
print(ans)
exit()
minus=[i for i in a if i<0]
plus=[i for i in a if i>=0]
from collections import deque
minus=deque(sorted(minus))
plus=d... | 120 | 73 | 2,731 | 1,625 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9 + 7
if n == k:
ans = 1
for i in range(k):
ans *= a[i]
ans %= mod
print(ans)
exit()
minus = [i for i in a if i < 0]
plus = [i for i in a if i >= 0]
from collections import deque
minus = deque(sorted(mi... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9 + 7
if n == k:
ans = 1
for i in range(k):
ans *= a[i]
ans %= mod
print(ans)
exit()
minus = [i for i in a if i < 0]
plus = [i for i in a if i >= 0]
from collections import deque
minus = deque(sorted(mi... | false | 39.166667 | [
"-cnt_minus = 0",
"-cand = deque([])",
"-for i in range(k):",
"- if not plus or ((plus and minus) and abs(minus[0]) > abs(plus[0])):",
"- cand.append(minus.popleft())",
"- cnt_minus += 1",
"- elif not minus or ((plus and minus) and abs(minus[0]) < abs(plus[0])):",
"- cand.ap... | false | 0.047655 | 0.047174 | 1.0102 | [
"s029278251",
"s643548908"
] |
u089230684 | p04020 | python | s041044977 | s548651805 | 139 | 85 | 7,084 | 3,060 | Accepted | Accepted | 38.85 | from sys import stdin
def main():
N = int(stdin.readline().strip())
i,card = 0,[-1 for x in range(N)]
while i < N:
x = int(stdin.readline().strip())
card[i] = x
i+=1
i,ans = 0,0
while i < N:
if card[i]%2==0:
ans+= card[i]//2
card[i] = 0
else:
ans+=(card[i]-1)//2
card[i] = 1
... | from sys import stdin
def main():
nums = int(stdin.readline())
l = []
actual = int(stdin.readline())
total = 0
for x in range(nums-1):
total += actual//2
temp = int(stdin.readline())
if temp != 0:
actual = actual%2 + temp
else:
ac... | 23 | 20 | 433 | 396 | from sys import stdin
def main():
N = int(stdin.readline().strip())
i, card = 0, [-1 for x in range(N)]
while i < N:
x = int(stdin.readline().strip())
card[i] = x
i += 1
i, ans = 0, 0
while i < N:
if card[i] % 2 == 0:
ans += card[i] // 2
card... | from sys import stdin
def main():
nums = int(stdin.readline())
l = []
actual = int(stdin.readline())
total = 0
for x in range(nums - 1):
total += actual // 2
temp = int(stdin.readline())
if temp != 0:
actual = actual % 2 + temp
else:
actual =... | false | 13.043478 | [
"- N = int(stdin.readline().strip())",
"- i, card = 0, [-1 for x in range(N)]",
"- while i < N:",
"- x = int(stdin.readline().strip())",
"- card[i] = x",
"- i += 1",
"- i, ans = 0, 0",
"- while i < N:",
"- if card[i] % 2 == 0:",
"- ans += card[... | false | 0.049299 | 0.049031 | 1.005459 | [
"s041044977",
"s548651805"
] |
u638456847 | p02821 | python | s783580329 | s170434245 | 1,028 | 346 | 14,268 | 23,460 | Accepted | Accepted | 66.34 | ######################
# AC: ms(PyPy)
# AC: ms(Python3)
######################
from bisect import bisect_left
import sys
input = sys.stdin.readline
def main():
N,M = list(map(int, input().split()))
A = [int(i) for i in input().split()]
A.sort()
left = 0
right = A[-1] * 2 + 5
... | import numpy as np
import sys
input = sys.stdin.readline
def main():
N,M = list(map(int, input().split()))
A = np.array(sorted([int(i) for i in input().split()]))
left = 0
right = A[-1] * 2 + 5
while right - left > 1:
x = (left + right) // 2
count = N**2 - np.search... | 49 | 31 | 896 | 632 | ######################
# AC: ms(PyPy)
# AC: ms(Python3)
######################
from bisect import bisect_left
import sys
input = sys.stdin.readline
def main():
N, M = list(map(int, input().split()))
A = [int(i) for i in input().split()]
A.sort()
left = 0
right = A[-1] * 2 + 5
while right - le... | import numpy as np
import sys
input = sys.stdin.readline
def main():
N, M = list(map(int, input().split()))
A = np.array(sorted([int(i) for i in input().split()]))
left = 0
right = A[-1] * 2 + 5
while right - left > 1:
x = (left + right) // 2
count = N**2 - np.searchsorted(A, x - ... | false | 36.734694 | [
"-######################",
"-# AC: ms(PyPy)",
"-# AC: ms(Python3)",
"-######################",
"-from bisect import bisect_left",
"+import numpy as np",
"- A = [int(i) for i in input().split()]",
"- A.sort()",
"+ A = np.array(sorted([int(i) for i in input().split()]))",
"- X = (lef... | false | 0.09118 | 0.538524 | 0.169315 | [
"s783580329",
"s170434245"
] |
u620868411 | p03426 | python | s258851873 | s952359427 | 613 | 411 | 46,908 | 44,780 | Accepted | Accepted | 32.95 | # -*- coding: utf-8 -*-
h,w,d = list(map(int, input().split()))
dd = {}
for hi in range(h):
line = list(map(int, input().split()))
for wi in range(w):
dd[line[wi]] = (hi, wi)
q = int(eval(input()))
lr = [list(map(int, input().split())) for _ in range(q)]
acc = [0]*(h*w+1)
for i in range(h*w+... | h,w,d = list(map(int, input().split()))
ad = {}
for i in range(h):
line = list(map(int, input().split()))
for j in range(w):
ad[line[j]] = (i,j)
q = int(eval(input()))
lr = [list(map(int, input().split())) for _ in range(q)]
cl = [0]*(h*w+1)
for i in range(1,h*w+1):
if i+d<len(cl):
... | 22 | 18 | 503 | 443 | # -*- coding: utf-8 -*-
h, w, d = list(map(int, input().split()))
dd = {}
for hi in range(h):
line = list(map(int, input().split()))
for wi in range(w):
dd[line[wi]] = (hi, wi)
q = int(eval(input()))
lr = [list(map(int, input().split())) for _ in range(q)]
acc = [0] * (h * w + 1)
for i in range(h * w + ... | h, w, d = list(map(int, input().split()))
ad = {}
for i in range(h):
line = list(map(int, input().split()))
for j in range(w):
ad[line[j]] = (i, j)
q = int(eval(input()))
lr = [list(map(int, input().split())) for _ in range(q)]
cl = [0] * (h * w + 1)
for i in range(1, h * w + 1):
if i + d < len(cl):... | false | 18.181818 | [
"-# -*- coding: utf-8 -*-",
"-dd = {}",
"-for hi in range(h):",
"+ad = {}",
"+for i in range(h):",
"- for wi in range(w):",
"- dd[line[wi]] = (hi, wi)",
"+ for j in range(w):",
"+ ad[line[j]] = (i, j)",
"-acc = [0] * (h * w + 1)",
"-for i in range(h * w + 1):",
"- if i <... | false | 0.154534 | 0.108029 | 1.430491 | [
"s258851873",
"s952359427"
] |
u894258749 | p02960 | python | s058045984 | s203765464 | 511 | 336 | 42,732 | 46,044 | Accepted | Accepted | 34.25 | MOD = 10**9 + 7
S = eval(input())
cur = [0] * 13
cur[0] = 1
r = 1
for i in range(len(S)):
s = S[-(i+1)]
if s == '?':
digits = list(range(10))
else:
digits = [int(s)]
prev = cur
cur = [0] * 13
for m in range(13):
for d in digits:
cur[(m + r*d... | MOD = 10**9 + 7
S = eval(input())
cur = [0] * 13
cur[0] = 1
r = 1
base = 0
for i in range(len(S)):
s = S[-(i+1)]
if s == '?':
prev = cur
cur = [sum(prev)] * 13
for m in range(13):
for d in range(10,13):
cur[(m + r*d) % 13] -= prev[m]
fo... | 23 | 23 | 414 | 462 | MOD = 10**9 + 7
S = eval(input())
cur = [0] * 13
cur[0] = 1
r = 1
for i in range(len(S)):
s = S[-(i + 1)]
if s == "?":
digits = list(range(10))
else:
digits = [int(s)]
prev = cur
cur = [0] * 13
for m in range(13):
for d in digits:
cur[(m + r * d) % 13] += prev... | MOD = 10**9 + 7
S = eval(input())
cur = [0] * 13
cur[0] = 1
r = 1
base = 0
for i in range(len(S)):
s = S[-(i + 1)]
if s == "?":
prev = cur
cur = [sum(prev)] * 13
for m in range(13):
for d in range(10, 13):
cur[(m + r * d) % 13] -= prev[m]
for m in rang... | false | 0 | [
"+base = 0",
"- digits = list(range(10))",
"+ prev = cur",
"+ cur = [sum(prev)] * 13",
"+ for m in range(13):",
"+ for d in range(10, 13):",
"+ cur[(m + r * d) % 13] -= prev[m]",
"+ for m in range(13):",
"+ cur[m] %= MOD",
"- ... | false | 0.040491 | 0.100026 | 0.404805 | [
"s058045984",
"s203765464"
] |
u263830634 | p03372 | python | s659415552 | s400940722 | 769 | 505 | 50,600 | 50,604 | Accepted | Accepted | 34.33 | N, C = list(map(int, input().split()))
left = []
right = []
for _ in range(N):
x, v = list(map(int, input().split()))
left.append([x, v])
right.append([C - x, v])
tmp1 = max(0, left[0][1] - left[0][0])
left_value = [0, tmp1]
tmp2 = max(0, left[0][1] - 2 * left[0][0])
left_value_back = [0, tmp2... | def main():
import sys
input = sys.stdin.readline
N, C = list(map(int, input().split()))
left = []
right = []
left_append = left.append
right_append = right.append
for _ in range(N):
x, v = list(map(int, input().split()))
left_append([x, v])
right_app... | 46 | 58 | 1,295 | 1,818 | N, C = list(map(int, input().split()))
left = []
right = []
for _ in range(N):
x, v = list(map(int, input().split()))
left.append([x, v])
right.append([C - x, v])
tmp1 = max(0, left[0][1] - left[0][0])
left_value = [0, tmp1]
tmp2 = max(0, left[0][1] - 2 * left[0][0])
left_value_back = [0, tmp2]
for i in ran... | def main():
import sys
input = sys.stdin.readline
N, C = list(map(int, input().split()))
left = []
right = []
left_append = left.append
right_append = right.append
for _ in range(N):
x, v = list(map(int, input().split()))
left_append([x, v])
right_append([C - x, ... | false | 20.689655 | [
"-N, C = list(map(int, input().split()))",
"-left = []",
"-right = []",
"-for _ in range(N):",
"- x, v = list(map(int, input().split()))",
"- left.append([x, v])",
"- right.append([C - x, v])",
"-tmp1 = max(0, left[0][1] - left[0][0])",
"-left_value = [0, tmp1]",
"-tmp2 = max(0, left[0][1... | false | 0.156915 | 0.045321 | 3.462332 | [
"s659415552",
"s400940722"
] |
u691874710 | p02690 | python | s433275485 | s763177225 | 35 | 30 | 9,124 | 9,184 | Accepted | Accepted | 14.29 | x=int(eval(input()))
A = 0
B = 0
for a in range(-120, 120):
a5 = a**5
for b in range(-120, 120):
if (a5 < x and b >=0 ) or (a5 > x and b <= 0):
continue
if a5 - b**5 == x:
A = a
B = b
break
print((A, B)) | x=int(eval(input()))
for a in range(-120, 120):
a5 = a**5
for b in range(-120, 120):
if (a5 < x and b >= 0 ) or (a5 > x and b <= 0):
continue
if a5 - b**5 == x:
print((a, b))
break
else:
continue
break | 13 | 13 | 279 | 282 | x = int(eval(input()))
A = 0
B = 0
for a in range(-120, 120):
a5 = a**5
for b in range(-120, 120):
if (a5 < x and b >= 0) or (a5 > x and b <= 0):
continue
if a5 - b**5 == x:
A = a
B = b
break
print((A, B))
| x = int(eval(input()))
for a in range(-120, 120):
a5 = a**5
for b in range(-120, 120):
if (a5 < x and b >= 0) or (a5 > x and b <= 0):
continue
if a5 - b**5 == x:
print((a, b))
break
else:
continue
break
| false | 0 | [
"-A = 0",
"-B = 0",
"- A = a",
"- B = b",
"+ print((a, b))",
"-print((A, B))",
"+ else:",
"+ continue",
"+ break"
] | false | 0.048736 | 0.047519 | 1.025597 | [
"s433275485",
"s763177225"
] |
u279955105 | p02389 | python | s845070976 | s116101105 | 20 | 10 | 7,660 | 7,656 | Accepted | Accepted | 50 | t = input().split()
a = int(t[0])
b = int(t[1])
s = 2 * (a + b)
l = a * b
print((str(l) + " " + str(s))) | a,b = list(map(int, input().split()))
c = 2 * (a+ b)
d = a * b
print((str(d) + " " + str(c))) | 6 | 4 | 107 | 94 | t = input().split()
a = int(t[0])
b = int(t[1])
s = 2 * (a + b)
l = a * b
print((str(l) + " " + str(s)))
| a, b = list(map(int, input().split()))
c = 2 * (a + b)
d = a * b
print((str(d) + " " + str(c)))
| false | 33.333333 | [
"-t = input().split()",
"-a = int(t[0])",
"-b = int(t[1])",
"-s = 2 * (a + b)",
"-l = a * b",
"-print((str(l) + \" \" + str(s)))",
"+a, b = list(map(int, input().split()))",
"+c = 2 * (a + b)",
"+d = a * b",
"+print((str(d) + \" \" + str(c)))"
] | false | 0.200828 | 0.114117 | 1.759846 | [
"s845070976",
"s116101105"
] |
u729133443 | p03148 | python | s406185157 | s737047230 | 794 | 634 | 73,760 | 36,956 | Accepted | Accepted | 20.15 | import heapq as h;I=lambda:list(map(int,input().split()));n,k=I();z=[i*2+1for i in range(n)];s=sorted([I()for _ in[0]*n],key=lambda x:-x[1]);q=[];v=A=0;l=[0]*-~n
for a in s[:k]:
if l[a[0]]:h.heappush(q,a[1])
else:A+=z[v];v+=1
l[a[0]]=1;A+=a[1]
T=A
for a in s[k:]:
if q and l[a[0]]^1:l[a[0]]=1;t=h.heappop(q);T... | import heapq as h;I=lambda:list(map(int,input().split()));n,k=I();z=[i*2+1for i in range(n)];s=sorted([I()for _ in[0]*n],key=lambda x:-x[1]);q=[];v=A=0;l=[0]*-~n
for a,b in s[:k]:
if l[a]:h.heappush(q,b)
else:A+=z[v];v+=1
l[a]=1;A+=b
T=A
for a,b in s[k:]:
if l[a]^1and q:l[a]=1;T+=b+z[v]-h.heappop(q);v+=1;A=m... | 9 | 9 | 360 | 337 | import heapq as h
I = lambda: list(map(int, input().split()))
n, k = I()
z = [i * 2 + 1 for i in range(n)]
s = sorted([I() for _ in [0] * n], key=lambda x: -x[1])
q = []
v = A = 0
l = [0] * -~n
for a in s[:k]:
if l[a[0]]:
h.heappush(q, a[1])
else:
A += z[v]
v += 1
l[a[0]] = 1
A ... | import heapq as h
I = lambda: list(map(int, input().split()))
n, k = I()
z = [i * 2 + 1 for i in range(n)]
s = sorted([I() for _ in [0] * n], key=lambda x: -x[1])
q = []
v = A = 0
l = [0] * -~n
for a, b in s[:k]:
if l[a]:
h.heappush(q, b)
else:
A += z[v]
v += 1
l[a] = 1
A += b
T... | false | 0 | [
"-for a in s[:k]:",
"- if l[a[0]]:",
"- h.heappush(q, a[1])",
"+for a, b in s[:k]:",
"+ if l[a]:",
"+ h.heappush(q, b)",
"- l[a[0]] = 1",
"- A += a[1]",
"+ l[a] = 1",
"+ A += b",
"-for a in s[k:]:",
"- if q and l[a[0]] ^ 1:",
"- l[a[0]] = 1",
"- ... | false | 0.087395 | 0.062971 | 1.387867 | [
"s406185157",
"s737047230"
] |
u002625175 | p02724 | python | s778956507 | s172538611 | 188 | 17 | 2,940 | 2,940 | Accepted | Accepted | 90.96 |
def main():
x = int(eval(input()))
ans = 0
while x >= 500:
x -= 500
ans += 1000
while x >= 5:
x -= 5
ans += 5
print(ans)
main()
|
def main():
x = int(eval(input()))
ans = 0
ans += (x // 500) * 500
x -= ans
ans *= 2
ans += (x // 5) * 5
print(ans)
main()
| 17 | 15 | 170 | 151 | def main():
x = int(eval(input()))
ans = 0
while x >= 500:
x -= 500
ans += 1000
while x >= 5:
x -= 5
ans += 5
print(ans)
main()
| def main():
x = int(eval(input()))
ans = 0
ans += (x // 500) * 500
x -= ans
ans *= 2
ans += (x // 5) * 5
print(ans)
main()
| false | 11.764706 | [
"- while x >= 500:",
"- x -= 500",
"- ans += 1000",
"- while x >= 5:",
"- x -= 5",
"- ans += 5",
"+ ans += (x // 500) * 500",
"+ x -= ans",
"+ ans *= 2",
"+ ans += (x // 5) * 5"
] | false | 0.076857 | 0.034844 | 2.205738 | [
"s778956507",
"s172538611"
] |
u323680411 | p02783 | python | s683159078 | s069533193 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | h, a = list(map(int, input().split()))
ans = 0
while h > 0:
h -= a
ans += 1
print(ans) | h, a = list(map(int, input().split()))
ans = 1 + (h - 1) // a
print(ans)
| 9 | 4 | 99 | 71 | h, a = list(map(int, input().split()))
ans = 0
while h > 0:
h -= a
ans += 1
print(ans)
| h, a = list(map(int, input().split()))
ans = 1 + (h - 1) // a
print(ans)
| false | 55.555556 | [
"-ans = 0",
"-while h > 0:",
"- h -= a",
"- ans += 1",
"+ans = 1 + (h - 1) // a"
] | false | 0.048126 | 0.149205 | 0.322551 | [
"s683159078",
"s069533193"
] |
u463775490 | p03370 | python | s588038663 | s483532656 | 39 | 17 | 3,064 | 2,940 | Accepted | Accepted | 56.41 | n,x = list(map(int,input().split()))
m = [int(eval(input())) for _ in range(n)]
ans = 0
minm = 1000
for i in range(n):
x -= m[i]
minm = min(minm,m[i])
ans += 1
while x >= minm:
x -= minm
ans += 1
print(ans) | n,x = list(map(int,input().split()))
m = [int(eval(input())) for _ in range(n)]
x -= sum(m)
ans = n + x//min(m)
print(ans) | 12 | 5 | 225 | 114 | n, x = list(map(int, input().split()))
m = [int(eval(input())) for _ in range(n)]
ans = 0
minm = 1000
for i in range(n):
x -= m[i]
minm = min(minm, m[i])
ans += 1
while x >= minm:
x -= minm
ans += 1
print(ans)
| n, x = list(map(int, input().split()))
m = [int(eval(input())) for _ in range(n)]
x -= sum(m)
ans = n + x // min(m)
print(ans)
| false | 58.333333 | [
"-ans = 0",
"-minm = 1000",
"-for i in range(n):",
"- x -= m[i]",
"- minm = min(minm, m[i])",
"- ans += 1",
"-while x >= minm:",
"- x -= minm",
"- ans += 1",
"+x -= sum(m)",
"+ans = n + x // min(m)"
] | false | 0.033664 | 0.054258 | 0.620445 | [
"s588038663",
"s483532656"
] |
u222668979 | p02579 | python | s024480036 | s408889350 | 658 | 511 | 95,400 | 88,200 | Accepted | Accepted | 22.34 | from collections import deque
from itertools import product
def bfs(x, y):
dist = [[10 ** 9] * w for _ in range(h)]
dist[y][x] = 0
que = deque([(x, y)])
near = list(product(list(range(-2, 3)), repeat=2))
while len(que) > 0:
x, y = que.popleft()
if (x, y) == (Dw - 1, Dh... | from collections import deque
from itertools import product
def bfs(x, y):
dist = [[10 ** 9] * w for _ in range(h)]
dist[y][x] = 0
que = deque([(x, y)])
move = product(list(range(-2, 3)), repeat=2)
near = [(dx, dy, (abs(dx) + abs(dy) >= 2)) for dx, dy in move]
while len(que) > 0:
... | 34 | 34 | 962 | 985 | from collections import deque
from itertools import product
def bfs(x, y):
dist = [[10**9] * w for _ in range(h)]
dist[y][x] = 0
que = deque([(x, y)])
near = list(product(list(range(-2, 3)), repeat=2))
while len(que) > 0:
x, y = que.popleft()
if (x, y) == (Dw - 1, Dh - 1):
... | from collections import deque
from itertools import product
def bfs(x, y):
dist = [[10**9] * w for _ in range(h)]
dist[y][x] = 0
que = deque([(x, y)])
move = product(list(range(-2, 3)), repeat=2)
near = [(dx, dy, (abs(dx) + abs(dy) >= 2)) for dx, dy in move]
while len(que) > 0:
x, y = ... | false | 0 | [
"- near = list(product(list(range(-2, 3)), repeat=2))",
"+ move = product(list(range(-2, 3)), repeat=2)",
"+ near = [(dx, dy, (abs(dx) + abs(dy) >= 2)) for dx, dy in move]",
"- for dx, dy in near:",
"- cnt = abs(dx) + abs(dy) >= 2",
"+ for dx, dy, cnt in near:"
] | false | 0.039847 | 0.047453 | 0.839722 | [
"s024480036",
"s408889350"
] |
u708255304 | p03062 | python | s990798390 | s428332110 | 130 | 71 | 14,332 | 14,412 | Accepted | Accepted | 45.38 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = 0
hoge = 10000000000000000000
# マイナスの個数が偶数かつ、Nが偶数なら全部の絶対値で良い気がする
# マイナスの個数が偶数なら全部の和でいい
n = sum(x < 0 for x in A)
if n % 2 == 0:
for i in range(N):
ans += abs(A[i])
print(ans)
exit()
else:
for i in range(N):
... | N = int(eval(input()))
A = list(map(int, input().split()))
under_zero_count = sum([i < 0 for i in A])
ans = 0
if under_zero_count % 2 == 0:
for i in range(N):
ans += abs(A[i])
print(ans)
else:
abs_list = []
for i in range(N):
abs_list.append(abs(A[i]))
print((sum(abs_... | 21 | 15 | 478 | 338 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = 0
hoge = 10000000000000000000
# マイナスの個数が偶数かつ、Nが偶数なら全部の絶対値で良い気がする
# マイナスの個数が偶数なら全部の和でいい
n = sum(x < 0 for x in A)
if n % 2 == 0:
for i in range(N):
ans += abs(A[i])
print(ans)
exit()
else:
for i in range(N):
ans += ... | N = int(eval(input()))
A = list(map(int, input().split()))
under_zero_count = sum([i < 0 for i in A])
ans = 0
if under_zero_count % 2 == 0:
for i in range(N):
ans += abs(A[i])
print(ans)
else:
abs_list = []
for i in range(N):
abs_list.append(abs(A[i]))
print((sum(abs_list) - min(abs_... | false | 28.571429 | [
"-A.sort()",
"+under_zero_count = sum([i < 0 for i in A])",
"-hoge = 10000000000000000000",
"-# マイナスの個数が偶数かつ、Nが偶数なら全部の絶対値で良い気がする",
"-# マイナスの個数が偶数なら全部の和でいい",
"-n = sum(x < 0 for x in A)",
"-if n % 2 == 0:",
"+if under_zero_count % 2 == 0:",
"- exit()",
"+ abs_list = []",
"- ans += ab... | false | 0.038695 | 0.08317 | 0.465257 | [
"s990798390",
"s428332110"
] |
u396495667 | p02982 | python | s283588623 | s080509152 | 25 | 18 | 3,316 | 3,064 | Accepted | Accepted | 28 | n,d = list(map(int, input().split()))
a =[[int(x) for x in input().split()] for i in range(n)]
cnt =0
sei = [i*i for i in range(10000)]
for i in range(n):
for j in range(i):
dis = sum( [((a[i][k] - a[j][k] )*(a[i][k] - a[j][k])) for k in range(d)])
if dis in sei:
cnt +=1
print(cnt) | n,d = list(map(int, input().split()))
xd = [(list(int(_) for _ in input().split())) for i in range(n)]
ans =0
for i in range(n):
x1 = xd[i]
for j in range(i+1,n):
x2 = xd[j]
dis =0
for x,y in zip(x1,x2):
dis += (y-x) **2
k = dis **0.5
if int(k)**2 ==dis:
ans +=1
print(... | 11 | 15 | 305 | 318 | n, d = list(map(int, input().split()))
a = [[int(x) for x in input().split()] for i in range(n)]
cnt = 0
sei = [i * i for i in range(10000)]
for i in range(n):
for j in range(i):
dis = sum([((a[i][k] - a[j][k]) * (a[i][k] - a[j][k])) for k in range(d)])
if dis in sei:
cnt += 1
print(cnt)... | n, d = list(map(int, input().split()))
xd = [(list(int(_) for _ in input().split())) for i in range(n)]
ans = 0
for i in range(n):
x1 = xd[i]
for j in range(i + 1, n):
x2 = xd[j]
dis = 0
for x, y in zip(x1, x2):
dis += (y - x) ** 2
k = dis**0.5
if int(k) ** 2 ... | false | 26.666667 | [
"-a = [[int(x) for x in input().split()] for i in range(n)]",
"-cnt = 0",
"-sei = [i * i for i in range(10000)]",
"+xd = [(list(int(_) for _ in input().split())) for i in range(n)]",
"+ans = 0",
"- for j in range(i):",
"- dis = sum([((a[i][k] - a[j][k]) * (a[i][k] - a[j][k])) for k in range(d)... | false | 0.042502 | 0.091482 | 0.464598 | [
"s283588623",
"s080509152"
] |
u477977638 | p02925 | python | s388941083 | s238136005 | 1,932 | 821 | 56,028 | 78,704 | Accepted | Accepted | 57.51 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
def main():
n=int(eval(input()))
A=[list(map(int,input().split()))[::-1] for i in range(n)]
day=0
zan=[n-1]*n
zann=sum(zan)
sumi=set(range(n))
while True:
day+=1
... | import sys
input = sys.stdin.readline
from collections import deque
def main():
N=int(eval(input()))
A=[deque()]+[deque(list(map(int,input().split()))) for _ in range(N)]
Days=[0]*(N+1)
NOW=[0]*(N+1)
q=deque([i+1 for i in range(N)])
while q:
i=q.popleft()
if not A[i]:
con... | 47 | 35 | 740 | 639 | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
def main():
n = int(eval(input()))
A = [list(map(int, input().split()))[::-1] for i in range(n)]
day = 0
zan = [n - 1] * n
zann = sum(zan)
sumi = set(range(n))
while True:
... | import sys
input = sys.stdin.readline
from collections import deque
def main():
N = int(eval(input()))
A = [deque()] + [deque(list(map(int, input().split()))) for _ in range(N)]
Days = [0] * (N + 1)
NOW = [0] * (N + 1)
q = deque([i + 1 for i in range(N)])
while q:
i = q.popleft()
... | false | 25.531915 | [
"-read = sys.stdin.buffer.read",
"-input = sys.stdin.buffer.readline",
"-inputs = sys.stdin.buffer.readlines",
"+input = sys.stdin.readline",
"+from collections import deque",
"- n = int(eval(input()))",
"- A = [list(map(int, input().split()))[::-1] for i in range(n)]",
"- day = 0",
"- z... | false | 0.077266 | 0.044281 | 1.744905 | [
"s388941083",
"s238136005"
] |
u558242240 | p03089 | python | s553639293 | s662353627 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | import sys
sys.setrecursionlimit(10**6)
n = int(eval(input()))
b = list(map(int , input().split()))
def dfs(s, ans):
if len(s) == 0:
print(('\n'.join(map(str, reversed(ans)))))
exit()
return
for i in range(len(s)):
#if s[i] == i+1:
#if s[i] == i+1 and max(s... | n = int(eval(input()))
b = list(map(int , input().split()))
def f(c):
for i in reversed(list(range(len(c)))):
if c[i] == i+1:
return (c[i], c[:i] + c[i+1:])
return (-1, c)
ans = []
for i in range(n):
(a, b) = f(b)
if a == -1:
print((-1))
exit()
an... | 31 | 19 | 743 | 383 | import sys
sys.setrecursionlimit(10**6)
n = int(eval(input()))
b = list(map(int, input().split()))
def dfs(s, ans):
if len(s) == 0:
print(("\n".join(map(str, reversed(ans)))))
exit()
return
for i in range(len(s)):
# if s[i] == i+1:
# if s[i] == i+1 and max(s[:i] + [0])... | n = int(eval(input()))
b = list(map(int, input().split()))
def f(c):
for i in reversed(list(range(len(c)))):
if c[i] == i + 1:
return (c[i], c[:i] + c[i + 1 :])
return (-1, c)
ans = []
for i in range(n):
(a, b) = f(b)
if a == -1:
print((-1))
exit()
ans.append(... | false | 38.709677 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**6)",
"-def dfs(s, ans):",
"- if len(s) == 0:",
"- print((\"\\n\".join(map(str, reversed(ans)))))",
"- exit()",
"- return",
"- for i in range(len(s)):",
"- # if s[i] == i+1:",
"- # if s[i] == i+1 and max(s[:i... | false | 0.088462 | 0.044671 | 1.980295 | [
"s553639293",
"s662353627"
] |
u500396695 | p02258 | python | s484322780 | s034708120 | 580 | 510 | 17,012 | 7,664 | Accepted | Accepted | 12.07 | n = int(eval(input()))
R = []
for i in range(n):
R.append(int(eval(input())))
# R???i???????????§???????°???????i?????????????´???¨???????????????list
mins = [R[0]]
for i in range(1, n):
mins.append(min(R[i], mins[i-1]))
# ???????????????j????????????????????\??????????°??????¨??????????±???????????... | n = int(eval(input()))
# R[0]
minv = int(eval(input()))
maxv = - 10 ** 10
# R[1..N-1]
for j in range(1, n):
r = int(eval(input()))
maxv = max(maxv, r - minv)
minv = min(minv, r)
print(maxv) | 16 | 13 | 432 | 198 | n = int(eval(input()))
R = []
for i in range(n):
R.append(int(eval(input())))
# R???i???????????§???????°???????i?????????????´???¨???????????????list
mins = [R[0]]
for i in range(1, n):
mins.append(min(R[i], mins[i - 1]))
# ???????????????j????????????????????\??????????°??????¨??????????±?????????????????????... | n = int(eval(input()))
# R[0]
minv = int(eval(input()))
maxv = -(10**10)
# R[1..N-1]
for j in range(1, n):
r = int(eval(input()))
maxv = max(maxv, r - minv)
minv = min(minv, r)
print(maxv)
| false | 18.75 | [
"-R = []",
"-for i in range(n):",
"- R.append(int(eval(input())))",
"-# R???i???????????§???????°???????i?????????????´???¨???????????????list",
"-mins = [R[0]]",
"-for i in range(1, n):",
"- mins.append(min(R[i], mins[i - 1]))",
"-# ???????????????j????????????????????\\??????????°??????¨??????... | false | 0.042861 | 0.041192 | 1.04051 | [
"s484322780",
"s034708120"
] |
u841531687 | p03160 | python | s530013086 | s345543756 | 241 | 166 | 52,544 | 14,484 | Accepted | Accepted | 31.12 | import math
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float('INF')] * N
def chmin(a, b):
if a >= b:
return b
else:
return a
#初期値
dp[0] = 0
#Loop
for i in range(1, N):
dp[i] = chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
if i > 1:
dp[i] ... | import math
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float('INF')] * (10**5 + 10)
def chmin(a, b):
if a >= b:
return b
else:
return a
dp[0] = 0 #初期値 = 0
for i in range(N-1):
dp[i+1] = chmin(dp[i+1], dp[i] + abs(h[i+1] - h[i]))
if i < N-2:
... | 21 | 18 | 373 | 384 | import math
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("INF")] * N
def chmin(a, b):
if a >= b:
return b
else:
return a
# 初期値
dp[0] = 0
# Loop
for i in range(1, N):
dp[i] = chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
if i > 1:
dp[i] = chmin(dp[i... | import math
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("INF")] * (10**5 + 10)
def chmin(a, b):
if a >= b:
return b
else:
return a
dp[0] = 0 # 初期値 = 0
for i in range(N - 1):
dp[i + 1] = chmin(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
if i < N - 2:
... | false | 14.285714 | [
"-dp = [float(\"INF\")] * N",
"+dp = [float(\"INF\")] * (10**5 + 10)",
"-# 初期値",
"-dp[0] = 0",
"-# Loop",
"-for i in range(1, N):",
"- dp[i] = chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))",
"- if i > 1:",
"- dp[i] = chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))",
"-print((dp[-1]))"... | false | 0.038296 | 0.039954 | 0.958494 | [
"s530013086",
"s345543756"
] |
u673361376 | p03147 | python | s664860070 | s714857880 | 23 | 19 | 3,316 | 3,064 | Accepted | Accepted | 17.39 | from collections import deque
def sol():
q = deque()
q.append(H)
ans = 0
while len(q) != 0:
prv_H = q.pop()
min_h = min(prv_H)
ans += min_h
tmp_H = ''.join([',' if h-min_h == 0 else str(h-min_h)+' ' for h in prv_H])
for sub_H in tmp_H.split(','):
if len(sub_H.replace... | import itertools
def get_num_1group(input_list):
num_group = 0
for key, elems in itertools.groupby(input_list):
if key == 1:
num_group += 1
return num_group
N = int(eval(input()))
H = list(map(int, input().split()))
maxH = max(H)
hist = [[0 for _ in range(N)] for _ in r... | 21 | 20 | 493 | 474 | from collections import deque
def sol():
q = deque()
q.append(H)
ans = 0
while len(q) != 0:
prv_H = q.pop()
min_h = min(prv_H)
ans += min_h
tmp_H = "".join(
["," if h - min_h == 0 else str(h - min_h) + " " for h in prv_H]
)
for sub_H in tmp_H... | import itertools
def get_num_1group(input_list):
num_group = 0
for key, elems in itertools.groupby(input_list):
if key == 1:
num_group += 1
return num_group
N = int(eval(input()))
H = list(map(int, input().split()))
maxH = max(H)
hist = [[0 for _ in range(N)] for _ in range(maxH)]
fo... | false | 4.761905 | [
"-from collections import deque",
"+import itertools",
"-def sol():",
"- q = deque()",
"- q.append(H)",
"- ans = 0",
"- while len(q) != 0:",
"- prv_H = q.pop()",
"- min_h = min(prv_H)",
"- ans += min_h",
"- tmp_H = \"\".join(",
"- [\",\" if h ... | false | 0.036653 | 0.038997 | 0.939899 | [
"s664860070",
"s714857880"
] |
u476604182 | p02948 | python | s894673072 | s165675934 | 629 | 573 | 75,484 | 31,976 | Accepted | Accepted | 8.9 | from heapq import heappop, heappush
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
X = sorted([list(map(int, input().split())) for _ in range(N)], key = lambda x: x[0])
hq = []
ans, j = 0, 0
for i in range(1, M + 1): # M - i 日後にするバイトを考える
while (j < N) and (X[j][0] <= i):... | from heapq import heappop, heappush
N, M = list(map(int, input().split()))
X = sorted([list(map(int, input().split())) for _ in range(N)], key = lambda x: x[0])
hq = []
ans, j = 0, 0
for i in range(1, M + 1): # M - i 日後にするバイトを考える
while (j < N) and (X[j][0] <= i):
heappush(hq, -X[j][1]) # 候補の追加
... | 18 | 15 | 455 | 414 | from heapq import heappop, heappush
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
X = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])
hq = []
ans, j = 0, 0
for i in range(1, M + 1): # M - i 日後にするバイトを考える
while (j < N) and (X[j][0] <= i):
heappu... | from heapq import heappop, heappush
N, M = list(map(int, input().split()))
X = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])
hq = []
ans, j = 0, 0
for i in range(1, M + 1): # M - i 日後にするバイトを考える
while (j < N) and (X[j][0] <= i):
heappush(hq, -X[j][1]) # 候補の追加
j +=... | false | 16.666667 | [
"-import sys",
"-input = sys.stdin.readline"
] | false | 0.043505 | 0.091479 | 0.475573 | [
"s894673072",
"s165675934"
] |
u094191970 | p02912 | python | s275055241 | s886445505 | 172 | 158 | 14,200 | 14,180 | Accepted | Accepted | 8.14 | import heapq
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
aa=list([x*(-1) for x in a])
heapq.heapify(aa)
for i in range(m):
max=heapq.heappop(aa)
heapq.heappush(aa,max//2+max%2)
print((-1*sum(aa))) | from heapq import heappush, heappop
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
hp=[]
for i in a:
heappush(hp,-i)
for i in range(m):
max=heappop(hp)
heappush(hp, -(-max//2))
print((-sum(hp))) | 10 | 11 | 233 | 224 | import heapq
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
aa = list([x * (-1) for x in a])
heapq.heapify(aa)
for i in range(m):
max = heapq.heappop(aa)
heapq.heappush(aa, max // 2 + max % 2)
print((-1 * sum(aa)))
| from heapq import heappush, heappop
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
hp = []
for i in a:
heappush(hp, -i)
for i in range(m):
max = heappop(hp)
heappush(hp, -(-max // 2))
print((-sum(hp)))
| false | 9.090909 | [
"-import heapq",
"+from heapq import heappush, heappop",
"-aa = list([x * (-1) for x in a])",
"-heapq.heapify(aa)",
"+hp = []",
"+for i in a:",
"+ heappush(hp, -i)",
"- max = heapq.heappop(aa)",
"- heapq.heappush(aa, max // 2 + max % 2)",
"-print((-1 * sum(aa)))",
"+ max = heappop(hp... | false | 0.04079 | 0.060374 | 0.675619 | [
"s275055241",
"s886445505"
] |
u562400059 | p02983 | python | s211713251 | s708617121 | 786 | 60 | 2,940 | 2,940 | Accepted | Accepted | 92.37 | L, R = list(map(int, input().split()))
x = 2020
if R - L > 2019:
print((0))
else:
for i in range(R+1)[L:]:
for j in range(R+1)[i+1:]:
mod = i * j % 2019
x = min(mod, x)
print(x)
| L, R = list(map(int, input().split()))
x = 2020
for i in range(R + 1)[L:]:
if x == 0:
break
for j in range(R + 1)[i + 1:]:
mod = i * j % 2019
x = min(mod, x)
if x == 0:
break
print(x)
| 16 | 14 | 235 | 246 | L, R = list(map(int, input().split()))
x = 2020
if R - L > 2019:
print((0))
else:
for i in range(R + 1)[L:]:
for j in range(R + 1)[i + 1 :]:
mod = i * j % 2019
x = min(mod, x)
print(x)
| L, R = list(map(int, input().split()))
x = 2020
for i in range(R + 1)[L:]:
if x == 0:
break
for j in range(R + 1)[i + 1 :]:
mod = i * j % 2019
x = min(mod, x)
if x == 0:
break
print(x)
| false | 12.5 | [
"-if R - L > 2019:",
"- print((0))",
"-else:",
"- for i in range(R + 1)[L:]:",
"- for j in range(R + 1)[i + 1 :]:",
"- mod = i * j % 2019",
"- x = min(mod, x)",
"- print(x)",
"+for i in range(R + 1)[L:]:",
"+ if x == 0:",
"+ break",
"+ for j i... | false | 0.092584 | 0.040236 | 2.30105 | [
"s211713251",
"s708617121"
] |
u072053884 | p02469 | python | s116457073 | s003841190 | 60 | 30 | 7,788 | 8,352 | Accepted | Accepted | 50 | def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // int(gcd(a, b))
def solve():
n = eval(input())
nums = list(map(int, input().split()))
ans = 1
for n in nums:
ans = lcm(n, ans)
print(ans)
solve() | def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // int(gcd(a, b))
import functools
def solve():
n = eval(input())
nums = list(map(int, input().split()))
print((functools.reduce(lcm, nums)))
solve() | 19 | 16 | 301 | 263 | def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // int(gcd(a, b))
def solve():
n = eval(input())
nums = list(map(int, input().split()))
ans = 1
for n in nums:
ans = lcm(n, ans)
print(ans)
solve()
| def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // int(gcd(a, b))
import functools
def solve():
n = eval(input())
nums = list(map(int, input().split()))
print((functools.reduce(lcm, nums)))
solve()
| false | 15.789474 | [
"+import functools",
"+",
"+",
"- ans = 1",
"- for n in nums:",
"- ans = lcm(n, ans)",
"- print(ans)",
"+ print((functools.reduce(lcm, nums)))"
] | false | 0.047745 | 0.173183 | 0.27569 | [
"s116457073",
"s003841190"
] |
u978178314 | p03478 | python | s810325262 | s607859935 | 60 | 35 | 3,060 | 2,940 | Accepted | Accepted | 41.67 | N, A, B = list(map(int, input().split()))
ans = 0
for n in range(1, N+1):
tmp = n
i = 4
s = 0
while i > -1:
keta = tmp // (10 ** i)
tmp -= keta * (10 ** i)
s += keta
i -= 1
if s >= A and s <= B:
ans += n
print(ans)
| N, A, B = list(map(int, input().split()))
ans = 0
for n in range(1, N+1):
s = sum(map(int, list(str(n))))
if s >= A and s <= B:
ans += n
print(ans)
| 15 | 8 | 255 | 158 | N, A, B = list(map(int, input().split()))
ans = 0
for n in range(1, N + 1):
tmp = n
i = 4
s = 0
while i > -1:
keta = tmp // (10**i)
tmp -= keta * (10**i)
s += keta
i -= 1
if s >= A and s <= B:
ans += n
print(ans)
| N, A, B = list(map(int, input().split()))
ans = 0
for n in range(1, N + 1):
s = sum(map(int, list(str(n))))
if s >= A and s <= B:
ans += n
print(ans)
| false | 46.666667 | [
"- tmp = n",
"- i = 4",
"- s = 0",
"- while i > -1:",
"- keta = tmp // (10**i)",
"- tmp -= keta * (10**i)",
"- s += keta",
"- i -= 1",
"+ s = sum(map(int, list(str(n))))"
] | false | 0.044652 | 0.043874 | 1.017746 | [
"s810325262",
"s607859935"
] |
u388817534 | p02881 | python | s317752598 | s985524250 | 361 | 311 | 2,940 | 3,060 | Accepted | Accepted | 13.85 | n=int(eval(input()))
i=1
ans=10**13
while(i*i<=n):
if(n%i==0):
ans=min(ans,n/i+i-2)
i+=1
print((int(ans))) | n=int(eval(input()))
i=1
ans=10**13
while(i*i<=n):
if(n%i==0):
ans=min(ans,n//i+i-2)
i+=1
print(ans) | 8 | 8 | 121 | 117 | n = int(eval(input()))
i = 1
ans = 10**13
while i * i <= n:
if n % i == 0:
ans = min(ans, n / i + i - 2)
i += 1
print((int(ans)))
| n = int(eval(input()))
i = 1
ans = 10**13
while i * i <= n:
if n % i == 0:
ans = min(ans, n // i + i - 2)
i += 1
print(ans)
| false | 0 | [
"- ans = min(ans, n / i + i - 2)",
"+ ans = min(ans, n // i + i - 2)",
"-print((int(ans)))",
"+print(ans)"
] | false | 0.136878 | 0.055442 | 2.468844 | [
"s317752598",
"s985524250"
] |
u865383026 | p03073 | python | s191792233 | s447191826 | 54 | 48 | 9,848 | 9,156 | Accepted | Accepted | 11.11 | S = eval(input())
L = [int(i) for i in S]
b = 1
B = 0
for i in L:
if i != b:
B += 1
b = 1 - b
l = len(L)
print((min(B, l - B))) | result1 = 0
S = eval(input())
l = len(S)
for i in range(l):
if i % 2 == 0:
if S[i] == "0":
result1 += 1
else:
if S[i] == "1":
result1 += 1
print((min(result1,l - result1))) | 10 | 11 | 136 | 198 | S = eval(input())
L = [int(i) for i in S]
b = 1
B = 0
for i in L:
if i != b:
B += 1
b = 1 - b
l = len(L)
print((min(B, l - B)))
| result1 = 0
S = eval(input())
l = len(S)
for i in range(l):
if i % 2 == 0:
if S[i] == "0":
result1 += 1
else:
if S[i] == "1":
result1 += 1
print((min(result1, l - result1)))
| false | 9.090909 | [
"+result1 = 0",
"-L = [int(i) for i in S]",
"-b = 1",
"-B = 0",
"-for i in L:",
"- if i != b:",
"- B += 1",
"- b = 1 - b",
"-l = len(L)",
"-print((min(B, l - B)))",
"+l = len(S)",
"+for i in range(l):",
"+ if i % 2 == 0:",
"+ if S[i] == \"0\":",
"+ resul... | false | 0.071692 | 0.043896 | 1.633222 | [
"s191792233",
"s447191826"
] |
u758815106 | p03162 | python | s035978882 | s559090004 | 701 | 251 | 50,212 | 105,188 | Accepted | Accepted | 64.19 | #import
#import math
#import numpy as np
N = int(eval(input()))
#= input()
#= map(int, input().split())
#= list(map(int, input().split()))
#= [input(), input()]
a = []
# dp[i][0]:Aを選んだ dp[i][1]:Bを選んだ dp[i][2]:Cを選んだ
dp = [[0]*3 for _ in range(N+1)]
for _ in range(N):
aa = list(map(int, input()... | #!/usr/bin/env python3
#import
#import math
#import numpy as np
N = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(N)]
dp = [[0] * 3 for _ in range(N)]
for i in range(N):
if i == 0:
dp[i][0] = abc[i][0]
dp[i][1] = abc[i][1]
dp[i][2] = abc[i][2]
... | 26 | 25 | 531 | 499 | # import
# import math
# import numpy as np
N = int(eval(input()))
# = input()
# = map(int, input().split())
# = list(map(int, input().split()))
# = [input(), input()]
a = []
# dp[i][0]:Aを選んだ dp[i][1]:Bを選んだ dp[i][2]:Cを選んだ
dp = [[0] * 3 for _ in range(N + 1)]
for _ in range(N):
aa = list(map(int, input().split()))... | #!/usr/bin/env python3
# import
# import math
# import numpy as np
N = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(N)]
dp = [[0] * 3 for _ in range(N)]
for i in range(N):
if i == 0:
dp[i][0] = abc[i][0]
dp[i][1] = abc[i][1]
dp[i][2] = abc[i][2]
continue
... | false | 3.846154 | [
"+#!/usr/bin/env python3",
"-# = input()",
"-# = map(int, input().split())",
"-# = list(map(int, input().split()))",
"-# = [input(), input()]",
"-a = []",
"-# dp[i][0]:Aを選んだ dp[i][1]:Bを選んだ dp[i][2]:Cを選んだ",
"-dp = [[0] * 3 for _ in range(N + 1)]",
"-for _ in range(N):",
"- aa = list(map(int, i... | false | 0.041908 | 0.04634 | 0.904345 | [
"s035978882",
"s559090004"
] |
u074220993 | p03557 | python | s532231060 | s770780045 | 511 | 247 | 47,404 | 29,056 | Accepted | Accepted | 51.66 | N = int(eval(input()))
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
import bisect as bs
import numpy as np
A.sort()
C.sort()
#B_a:b未満のAのパーツ数、B_c:b超のCのパーツ数
B_a = np.array([bs.bisect_left(A,b) for b in B])
B_c = np.array([N-bs.bisect_right(... | import bisect as bs
def main():
with open(0) as f:
N = int(f.readline())
A = sorted(list(map(int, f.readline().split())))
B = list(map(int, f.readline().split()))
C = sorted(list(map(int, f.readline().split())))
ans = 0
for b in B:
ans += bs.bisect_left(A... | 14 | 15 | 367 | 378 | N = int(eval(input()))
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
import bisect as bs
import numpy as np
A.sort()
C.sort()
# B_a:b未満のAのパーツ数、B_c:b超のCのパーツ数
B_a = np.array([bs.bisect_left(A, b) for b in B])
B_c = np.array([N - bs.bisect_right(C, b) fo... | import bisect as bs
def main():
with open(0) as f:
N = int(f.readline())
A = sorted(list(map(int, f.readline().split())))
B = list(map(int, f.readline().split()))
C = sorted(list(map(int, f.readline().split())))
ans = 0
for b in B:
ans += bs.bisect_left(A, b) * (N -... | false | 6.666667 | [
"-N = int(eval(input()))",
"-A = [int(x) for x in input().split()]",
"-B = [int(x) for x in input().split()]",
"-C = [int(x) for x in input().split()]",
"-import numpy as np",
"-A.sort()",
"-C.sort()",
"-# B_a:b未満のAのパーツ数、B_c:b超のCのパーツ数",
"-B_a = np.array([bs.bisect_left(A, b) for b in B])",
"-B_c =... | false | 0.293128 | 0.037713 | 7.772531 | [
"s532231060",
"s770780045"
] |
u681444474 | p03160 | python | s483003365 | s120961646 | 222 | 121 | 52,208 | 20,716 | Accepted | Accepted | 45.5 | # coding: utf-8
N=int(eval(input()))
H=list(map(int,input().split()))
def dp(L):
dp=[0]*N
dp[1]=abs(L[1]-L[0])
for i in range(N-2):
dp[i+2]=min(dp[i]+abs(L[i+2]-L[i]),dp[i+1]+abs(L[i+2]-L[i+1]))
return dp[N-1]
print((dp(H))) | # coding: utf-8
n = int(eval(input()))
h = list(map(int,input().split()))
dp = [0] * n
dp[1] = abs(h[0]-h[1])
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])) | 11 | 8 | 255 | 215 | # coding: utf-8
N = int(eval(input()))
H = list(map(int, input().split()))
def dp(L):
dp = [0] * N
dp[1] = abs(L[1] - L[0])
for i in range(N - 2):
dp[i + 2] = min(
dp[i] + abs(L[i + 2] - L[i]), dp[i + 1] + abs(L[i + 2] - L[i + 1])
)
return dp[N - 1]
print((dp(H)))
| # coding: utf-8
n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * n
dp[1] = abs(h[0] - h[1])
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 | 27.272727 | [
"-N = int(eval(input()))",
"-H = list(map(int, input().split()))",
"-",
"-",
"-def dp(L):",
"- dp = [0] * N",
"- dp[1] = abs(L[1] - L[0])",
"- for i in range(N - 2):",
"- dp[i + 2] = min(",
"- dp[i] + abs(L[i + 2] - L[i]), dp[i + 1] + abs(L[i + 2] - L[i + 1])",
"- ... | false | 0.039564 | 0.037024 | 1.068606 | [
"s483003365",
"s120961646"
] |
u423665486 | p03730 | python | s971349279 | s952560780 | 179 | 37 | 38,256 | 5,076 | Accepted | Accepted | 79.33 | def resolve():
a, b, c = list(map(int, input().split()))
ans = "NO"
for i in range(1, b+1):
if i*a % b == c:
ans = "YES"
break
print(ans)
resolve() | from fractions import gcd
def ngcd(nums):
n = 0
for i in nums:
n = gcd(n, i)
return n
def resolve():
nums = list(map(int, input().split()))
t = ngcd(nums)
if t != 1:
nums = [int(i/t) for i in nums]
if gcd(nums[0], nums[1]) == 1:
print("YES")
else:
print("NO")
resolve() | 9 | 18 | 161 | 304 | def resolve():
a, b, c = list(map(int, input().split()))
ans = "NO"
for i in range(1, b + 1):
if i * a % b == c:
ans = "YES"
break
print(ans)
resolve()
| from fractions import gcd
def ngcd(nums):
n = 0
for i in nums:
n = gcd(n, i)
return n
def resolve():
nums = list(map(int, input().split()))
t = ngcd(nums)
if t != 1:
nums = [int(i / t) for i in nums]
if gcd(nums[0], nums[1]) == 1:
print("YES")
else:
pr... | false | 50 | [
"+from fractions import gcd",
"+",
"+",
"+def ngcd(nums):",
"+ n = 0",
"+ for i in nums:",
"+ n = gcd(n, i)",
"+ return n",
"+",
"+",
"- a, b, c = list(map(int, input().split()))",
"- ans = \"NO\"",
"- for i in range(1, b + 1):",
"- if i * a % b == c:",
"-... | false | 0.036469 | 0.044819 | 0.81371 | [
"s971349279",
"s952560780"
] |
u216015528 | p02726 | python | s647519051 | s558655726 | 1,460 | 266 | 137,652 | 106,992 | Accepted | Accepted | 81.78 | #!/usr/bin/env python3
def main():
from collections import deque
N, X, Y = list(map(int, input().split()))
G = [[1]] + [[x - 1, x + 1] for x in range(1, N - 1)] + [[N - 2]]
G[X - 1].append(Y - 1)
G[Y - 1].append(X - 1)
dist = [[-1] * N for _ in [0] * N]
for s in range(N... | #!/usr/bin/env python3
def main():
from collections import deque
N, X, Y = list(map(int, input().split()))
G = [[1]] + [[x - 1, x + 1] for x in range(1, N - 1)] + [[N - 2]]
G[X - 1].append(Y - 1)
G[Y - 1].append(X - 1)
dist = [[-1] * N for _ in [0] * N]
for start in ran... | 30 | 30 | 770 | 812 | #!/usr/bin/env python3
def main():
from collections import deque
N, X, Y = list(map(int, input().split()))
G = [[1]] + [[x - 1, x + 1] for x in range(1, N - 1)] + [[N - 2]]
G[X - 1].append(Y - 1)
G[Y - 1].append(X - 1)
dist = [[-1] * N for _ in [0] * N]
for s in range(N):
q = deque(... | #!/usr/bin/env python3
def main():
from collections import deque
N, X, Y = list(map(int, input().split()))
G = [[1]] + [[x - 1, x + 1] for x in range(1, N - 1)] + [[N - 2]]
G[X - 1].append(Y - 1)
G[Y - 1].append(X - 1)
dist = [[-1] * N for _ in [0] * N]
for start in range(N):
q = de... | false | 0 | [
"- for s in range(N):",
"- q = deque([s])",
"- dist[s][s] = 0",
"+ for start in range(N):",
"+ q = deque([start])",
"+ dist[start][start] = 0",
"- v = q.popleft()",
"- for nv in G[v]:",
"- if dist[s][nv] == -1:",
"- ... | false | 0.079079 | 0.048288 | 1.637656 | [
"s647519051",
"s558655726"
] |
u854931881 | p02572 | python | s572136892 | s605629606 | 163 | 134 | 31,436 | 31,544 | Accepted | Accepted | 17.79 | n=int(eval(input()))
a=list(map(int,input().split()))
x=0
for i in range(n):
x+=a[i]
x=x**2
y=0
for j in range(n):
y+=a[j]**2
z=(x-y)//2
print((z%(10**9+7))) | n=int(eval(input()))
a=list(map(int,input().split()))
x=sum(a)**2
total=0
for i in range(n):
total+=a[i]**2
y=int((x-total)//2)
print((y%(10**9+7))) | 11 | 8 | 163 | 151 | n = int(eval(input()))
a = list(map(int, input().split()))
x = 0
for i in range(n):
x += a[i]
x = x**2
y = 0
for j in range(n):
y += a[j] ** 2
z = (x - y) // 2
print((z % (10**9 + 7)))
| n = int(eval(input()))
a = list(map(int, input().split()))
x = sum(a) ** 2
total = 0
for i in range(n):
total += a[i] ** 2
y = int((x - total) // 2)
print((y % (10**9 + 7)))
| false | 27.272727 | [
"-x = 0",
"+x = sum(a) ** 2",
"+total = 0",
"- x += a[i]",
"-x = x**2",
"-y = 0",
"-for j in range(n):",
"- y += a[j] ** 2",
"-z = (x - y) // 2",
"-print((z % (10**9 + 7)))",
"+ total += a[i] ** 2",
"+y = int((x - total) // 2)",
"+print((y % (10**9 + 7)))"
] | false | 0.039867 | 0.043195 | 0.922951 | [
"s572136892",
"s605629606"
] |
u271934630 | p03221 | python | s791526386 | s324652156 | 1,406 | 898 | 126,040 | 75,680 | Accepted | Accepted | 36.13 | n, m = list(map(int, input().split()))
prefectures = []
for i in range(m):
p, y = list(map(int, input().split()))
prefectures.append({'i': i, 'p': p, 'y': y})
prefectures.sort(key=lambda x: (x['p'], x['y']))
ans = []
cnt = 1
for i in range(len(prefectures)):
if i != 0:
if prefectures... | n, m = map(int, input().split())
prefectures = [[] for _ in range(n)]
for i in range(m):
p, y = map(int, input().split())
prefectures[p-1].append((y, i))
ans = [None] * m
for i, p in enumerate(prefectures):
p.sort()
for j, (y, k) in enumerate(p):
ans[k] = "%06d%06d" % (i+1, j+1)
... | 25 | 14 | 586 | 342 | n, m = list(map(int, input().split()))
prefectures = []
for i in range(m):
p, y = list(map(int, input().split()))
prefectures.append({"i": i, "p": p, "y": y})
prefectures.sort(key=lambda x: (x["p"], x["y"]))
ans = []
cnt = 1
for i in range(len(prefectures)):
if i != 0:
if prefectures[i - 1]["p"] == ... | n, m = map(int, input().split())
prefectures = [[] for _ in range(n)]
for i in range(m):
p, y = map(int, input().split())
prefectures[p - 1].append((y, i))
ans = [None] * m
for i, p in enumerate(prefectures):
p.sort()
for j, (y, k) in enumerate(p):
ans[k] = "%06d%06d" % (i + 1, j + 1)
print(*ans... | false | 44 | [
"-n, m = list(map(int, input().split()))",
"-prefectures = []",
"+n, m = map(int, input().split())",
"+prefectures = [[] for _ in range(n)]",
"- p, y = list(map(int, input().split()))",
"- prefectures.append({\"i\": i, \"p\": p, \"y\": y})",
"-prefectures.sort(key=lambda x: (x[\"p\"], x[\"y\"]))",... | false | 0.042204 | 0.03784 | 1.115332 | [
"s791526386",
"s324652156"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.