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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u141574039 | p02743 | python | s204267582 | s622320086 | 34 | 17 | 5,076 | 2,940 | Accepted | Accepted | 50 | from decimal import Decimal
A,B,C=list(map(int,input().split()))
if (C-A-B)<0:
print("No")
else:
if Decimal(4*A*B)<Decimal((C-A-B)**2):
print("Yes")
else:
print("No") | A,B,C=list(map(int,input().split()))
if (C-A-B)<0:
print("No")
else:
if 4*A*B<(C-A-B)**2:
print("Yes")
else:
print("No") | 9 | 8 | 184 | 137 | from decimal import Decimal
A, B, C = list(map(int, input().split()))
if (C - A - B) < 0:
print("No")
else:
if Decimal(4 * A * B) < Decimal((C - A - B) ** 2):
print("Yes")
else:
print("No")
| A, B, C = list(map(int, input().split()))
if (C - A - B) < 0:
print("No")
else:
if 4 * A * B < (C - A - B) ** 2:
print("Yes")
else:
print("No")
| false | 11.111111 | [
"-from decimal import Decimal",
"-",
"- if Decimal(4 * A * B) < Decimal((C - A - B) ** 2):",
"+ if 4 * A * B < (C - A - B) ** 2:"
] | false | 0.071671 | 0.046255 | 1.549455 | [
"s204267582",
"s622320086"
] |
u392319141 | p03062 | python | s139916671 | s349948618 | 102 | 65 | 14,412 | 14,412 | Accepted | Accepted | 36.27 | N = int(eval(input()))
A = list(map(int,input().split()))
minus = 1
for i,a in enumerate(A) :
if a < 0 :
minus *= -1
A[i] = -a
ans = sum(A)
A.sort()
if minus == -1 :
ans -= A[0] * 2
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
negA = []
posA = []
for a in A:
if a >= 0:
posA.append(a)
else:
negA.append(a)
ans = sum(posA) - sum(negA)
if len(negA) % 2 == 1:
ans -= min([abs(a) for a in A]) * 2
print(ans)
| 17 | 17 | 232 | 278 | N = int(eval(input()))
A = list(map(int, input().split()))
minus = 1
for i, a in enumerate(A):
if a < 0:
minus *= -1
A[i] = -a
ans = sum(A)
A.sort()
if minus == -1:
ans -= A[0] * 2
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
negA = []
posA = []
for a in A:
if a >= 0:
posA.append(a)
else:
negA.append(a)
ans = sum(posA) - sum(negA)
if len(negA) % 2 == 1:
ans -= min([abs(a) for a in A]) * 2
print(ans)
| false | 0 | [
"-minus = 1",
"-for i, a in enumerate(A):",
"- if a < 0:",
"- minus *= -1",
"- A[i] = -a",
"-ans = sum(A)",
"-A.sort()",
"-if minus == -1:",
"- ans -= A[0] * 2",
"+negA = []",
"+posA = []",
"+for a in A:",
"+ if a >= 0:",
"+ posA.append(a)",
"+ else:",
... | false | 0.044454 | 0.045558 | 0.975768 | [
"s139916671",
"s349948618"
] |
u507456172 | p02555 | python | s549404204 | s568538172 | 31 | 28 | 9,192 | 9,284 | Accepted | Accepted | 9.68 | S = int(eval(input()))
if S == 1 or S ==2:
print((0))
elif S == 3:
print((1))
else:
#初期化
dp = [0]*S
dp[2] = 1
dp_S = 0
#dp
for i in range(3,S):
dp_S += dp[i-3]
dp[i] = 1+dp_S
print((dp[S-1]%1000000007)) | S = int(eval(input()))
#初期化
dp = [0]*S
if S > 2:
dp[2] = 1
dp_S = 0
#dp
for i in range(3,S):
dp_S += dp[i-3]
dp[i] = 1+dp_S
print((dp[S-1]%1000000007)) | 21 | 14 | 251 | 176 | S = int(eval(input()))
if S == 1 or S == 2:
print((0))
elif S == 3:
print((1))
else:
# 初期化
dp = [0] * S
dp[2] = 1
dp_S = 0
# dp
for i in range(3, S):
dp_S += dp[i - 3]
dp[i] = 1 + dp_S
print((dp[S - 1] % 1000000007))
| S = int(eval(input()))
# 初期化
dp = [0] * S
if S > 2:
dp[2] = 1
dp_S = 0
# dp
for i in range(3, S):
dp_S += dp[i - 3]
dp[i] = 1 + dp_S
print((dp[S - 1] % 1000000007))
| false | 33.333333 | [
"-if S == 1 or S == 2:",
"- print((0))",
"-elif S == 3:",
"- print((1))",
"-else:",
"- # 初期化",
"- dp = [0] * S",
"+# 初期化",
"+dp = [0] * S",
"+if S > 2:",
"- print((dp[S - 1] % 1000000007))",
"+print((dp[S - 1] % 1000000007))"
] | false | 0.03759 | 0.03719 | 1.010757 | [
"s549404204",
"s568538172"
] |
u297574184 | p03732 | python | s274364744 | s726406473 | 600 | 148 | 28,292 | 12,004 | Accepted | Accepted | 75.33 | N, W = list(map(int, input().split()))
items = [tuple(map(int, input().split())) for i in range(N)]
w0 = items[0][0]
sizeX = min(W, sum([items[i][0] for i in range(N)])) // w0 + 1
sizeY = min(w0, 3 * (N - 1) + 1)
memo = [[[-1 for y in range(sizeY)] for x in range(sizeX)] for i in range(N + 1)]
memo[0][0][0] =... | N, W = list(map(int, input().split()))
items = [tuple(map(int, input().split())) for i in range(N)]
memo = [{} for i in range(N + 1)]
memo[0] = {0: 0}
for i, (wi, vi) in enumerate(items):
for w, v in list(memo[i].items()):
if w + wi <= W:
memo[i + 1][w + wi] = max(memo[i + 1].get(w ... | 21 | 15 | 724 | 416 | N, W = list(map(int, input().split()))
items = [tuple(map(int, input().split())) for i in range(N)]
w0 = items[0][0]
sizeX = min(W, sum([items[i][0] for i in range(N)])) // w0 + 1
sizeY = min(w0, 3 * (N - 1) + 1)
memo = [[[-1 for y in range(sizeY)] for x in range(sizeX)] for i in range(N + 1)]
memo[0][0][0] = 0
for i, ... | N, W = list(map(int, input().split()))
items = [tuple(map(int, input().split())) for i in range(N)]
memo = [{} for i in range(N + 1)]
memo[0] = {0: 0}
for i, (wi, vi) in enumerate(items):
for w, v in list(memo[i].items()):
if w + wi <= W:
memo[i + 1][w + wi] = max(memo[i + 1].get(w + wi, 0), v +... | false | 28.571429 | [
"-w0 = items[0][0]",
"-sizeX = min(W, sum([items[i][0] for i in range(N)])) // w0 + 1",
"-sizeY = min(w0, 3 * (N - 1) + 1)",
"-memo = [[[-1 for y in range(sizeY)] for x in range(sizeX)] for i in range(N + 1)]",
"-memo[0][0][0] = 0",
"+memo = [{} for i in range(N + 1)]",
"+memo[0] = {0: 0}",
"- for ... | false | 0.0532 | 0.079264 | 0.671176 | [
"s274364744",
"s726406473"
] |
u638902622 | p03475 | python | s713512651 | s644945134 | 62 | 53 | 3,572 | 3,188 | Accepted | Accepted | 14.52 | 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
MD2 = lambda d1,d2: [[INIT_VAL]*d2 for _ in range(d1)]
MD3 = lambda d1,d2,d3: [MD2(d2,d3) for _ in range(d1)]
## math
DIVC... | 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
MD2 = lambda d1,d2: [[INIT_VAL]*d2 for _ in range(d1)]
MD3 = lambda d1,d2,d3: [MD2(d2,d3) for _ in range(d1)]
## math
DIVC... | 38 | 35 | 889 | 791 | 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
MD2 = lambda d1, d2: [[INIT_VAL] * d2 for _ in range(d1)]
MD3 = lambda d1, d2, d3: [MD2(d2, d3) for _ in range(d1)]
## math
DIVC =... | 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
MD2 = lambda d1, d2: [[INIT_VAL] * d2 for _ in range(d1)]
MD3 = lambda d1, d2, d3: [MD2(d2, d3) for _ in range(d1)]
## math
DIVC =... | false | 7.894737 | [
"-from collections import namedtuple",
"- for i in range(n - 1):",
"+ for i in range(n):",
"- for j in range(i, n - 1):",
"- c, s, f = tt[j]",
"+ for c, s, f in tt[i:]:",
"- pass",
"- print((0))"
] | false | 0.038155 | 0.036497 | 1.045441 | [
"s713512651",
"s644945134"
] |
u180058306 | p03565 | python | s063448119 | s314725195 | 20 | 18 | 3,188 | 3,064 | Accepted | Accepted | 10 | import re
# 文字列S'(s)および文字列Tを入力する
s = eval(input())
T = eval(input())
# sの"?"を"."に置き換え、新たな文字列(pattern)とする
pattern = s.replace("?", ".")
# sとTの長さの差をNとする
N = len(s) - len(T)
# Sを設定する(初期状態 = "UNRESTORABLE")
S = "UNRESTORABLE"
# 0〜Nまでの整数iについて繰り返す
for i in range(N + 1):
# patternの先頭N - i文字をTの先頭につけ、patternの後方... | # 文字列S'(s)および文字列Tを入力する
s = eval(input())
T = eval(input())
# Sを設定する(初期状態 = "UNRESTORABLE")
S = "UNRESTORABLE"
# |s|が|T|以上である場合に探索する
if len(s) >= len(T):
# sの|T|文字の部分文字列(s_partial)について探索する
for i in range(len(s) - len(T) + 1):
s_partial = s[i:i + len(T)]
# 部分文字列中のj番目の文字を調べる
for... | 26 | 28 | 728 | 853 | import re
# 文字列S'(s)および文字列Tを入力する
s = eval(input())
T = eval(input())
# sの"?"を"."に置き換え、新たな文字列(pattern)とする
pattern = s.replace("?", ".")
# sとTの長さの差をNとする
N = len(s) - len(T)
# Sを設定する(初期状態 = "UNRESTORABLE")
S = "UNRESTORABLE"
# 0〜Nまでの整数iについて繰り返す
for i in range(N + 1):
# patternの先頭N - i文字をTの先頭につけ、patternの後方i文字をTの後方につけ... | # 文字列S'(s)および文字列Tを入力する
s = eval(input())
T = eval(input())
# Sを設定する(初期状態 = "UNRESTORABLE")
S = "UNRESTORABLE"
# |s|が|T|以上である場合に探索する
if len(s) >= len(T):
# sの|T|文字の部分文字列(s_partial)について探索する
for i in range(len(s) - len(T) + 1):
s_partial = s[i : i + len(T)]
# 部分文字列中のj番目の文字を調べる
for j in ran... | false | 7.142857 | [
"-import re",
"-",
"-# sの\"?\"を\".\"に置き換え、新たな文字列(pattern)とする",
"-pattern = s.replace(\"?\", \".\")",
"-# sとTの長さの差をNとする",
"-N = len(s) - len(T)",
"-# 0〜Nまでの整数iについて繰り返す",
"-for i in range(N + 1):",
"- # patternの先頭N - i文字をTの先頭につけ、patternの後方i文字をTの後方につけた文字列を作成する(text)",
"- text = pattern[: N - i]... | false | 0.07185 | 0.068443 | 1.049769 | [
"s063448119",
"s314725195"
] |
u941753895 | p02685 | python | s332695702 | s280918898 | 141 | 116 | 77,912 | 76,572 | Accepted | Accepted | 17.73 | import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for... | import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for... | 47 | 48 | 1,070 | 1,303 | import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) for x in sys.stdin.readline().spl... | import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) for x in sys.stdin.readline().spl... | false | 2.083333 | [
"-com_mx = 200005",
"-mod = 998244353",
"-fac = [0] * com_mx",
"-finv = [0] * com_mx",
"-inv = [0] * com_mx",
"-fac[0] = 1",
"-fac[1] = 1",
"-finv[0] = 1",
"-finv[1] = 1",
"-inv[1] = 1",
"-for i in range(2, com_mx):",
"- fac[i] = fac[i - 1] * i % mod",
"- inv[i] = -inv[mod % i] * (mod ... | false | 0.901168 | 0.008743 | 103.068287 | [
"s332695702",
"s280918898"
] |
u190405389 | p02861 | python | s926462727 | s393554306 | 221 | 167 | 45,552 | 38,384 | Accepted | Accepted | 24.43 | from itertools import permutations
from math import factorial
n = int(eval(input()))
xy = [list(map(int, input().split())) for i in range(n)]
root = list(permutations(xy,n))
ans = 0
for r in root:
a = 0
for i in range(n-1):
a += ((r[i+1][0]-r[i][0])**2 + (r[i+1][1]-r[i][1])**2)**0.5
... | from itertools import combinations
n = int(eval(input()))
xy = [list(map(int, input().split())) for i in range(n)]
pair = list(combinations(xy,2))
ans = 0
for p in pair:
ans += ((p[0][0]-p[1][0])**2 + (p[0][1]-p[1][1])**2)**0.5
print((ans*(n-1)/len(pair)))
| 15 | 10 | 348 | 264 | from itertools import permutations
from math import factorial
n = int(eval(input()))
xy = [list(map(int, input().split())) for i in range(n)]
root = list(permutations(xy, n))
ans = 0
for r in root:
a = 0
for i in range(n - 1):
a += ((r[i + 1][0] - r[i][0]) ** 2 + (r[i + 1][1] - r[i][1]) ** 2) ** 0.5
... | from itertools import combinations
n = int(eval(input()))
xy = [list(map(int, input().split())) for i in range(n)]
pair = list(combinations(xy, 2))
ans = 0
for p in pair:
ans += ((p[0][0] - p[1][0]) ** 2 + (p[0][1] - p[1][1]) ** 2) ** 0.5
print((ans * (n - 1) / len(pair)))
| false | 33.333333 | [
"-from itertools import permutations",
"-from math import factorial",
"+from itertools import combinations",
"-root = list(permutations(xy, n))",
"+pair = list(combinations(xy, 2))",
"-for r in root:",
"- a = 0",
"- for i in range(n - 1):",
"- a += ((r[i + 1][0] - r[i][0]) ** 2 + (r[i +... | false | 0.039647 | 0.037261 | 1.064053 | [
"s926462727",
"s393554306"
] |
u397496203 | p02844 | python | s469189132 | s754685851 | 185 | 169 | 39,280 | 82,864 | Accepted | Accepted | 8.65 | import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)
def main():
N = int(eval(input()))
S = input().rstrip()
ans = 0
for i in range(1000):
i = str(i).zfill(3)
prev = -1
for s in i:
pos = S.find(s, prev + 1)
if pos > prev:
... | n = int(eval(input()))
s = eval(input())
top_used = set()
used = set()
ans = 0
for i in range(n - 1):
if int(s[i]) in top_used:
continue
top_used.add(int(s[i]))
for j in range(i + 1, n):
top = s[i] + s[j]
if top not in used:
ans += len(set(s[j + 1:]))
... | 25 | 18 | 479 | 345 | import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)
def main():
N = int(eval(input()))
S = input().rstrip()
ans = 0
for i in range(1000):
i = str(i).zfill(3)
prev = -1
for s in i:
pos = S.find(s, prev + 1)
if pos > prev:
... | n = int(eval(input()))
s = eval(input())
top_used = set()
used = set()
ans = 0
for i in range(n - 1):
if int(s[i]) in top_used:
continue
top_used.add(int(s[i]))
for j in range(i + 1, n):
top = s[i] + s[j]
if top not in used:
ans += len(set(s[j + 1 :]))
used.ad... | false | 28 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-# sys.setrecursionlimit(100000)",
"-def main():",
"- N = int(eval(input()))",
"- S = input().rstrip()",
"- ans = 0",
"- for i in range(1000):",
"- i = str(i).zfill(3)",
"- prev = -1",
"- for s in i:",
"- ... | false | 0.048254 | 0.047795 | 1.0096 | [
"s469189132",
"s754685851"
] |
u728901930 | p00009 | python | s097858858 | s268377793 | 2,170 | 1,190 | 15,148 | 15,124 | Accepted | Accepted | 45.16 | import sys
import math as mas
def sieve(n):
p=[True for i in range(n+1)]
p[0]=p[1]=False
end=int(n**0.5)
for i in range(2,end+1):
if p[i]:
for j in range(i*i,n+1,i):
p[j]=False
return p
sosu=sieve(1000010)
for i in sys.stdin:
print((sum(sosu[t] for t in range(int(i)+1))))
# a,b=map(i... | import sys
import math as mas
def sieve(n):
p=[True for i in range(n+1)]
p[0]=p[1]=False
end=int(n**0.5)
for i in range(2,end+1):
if p[i]:
for j in range(i*i,n+1,i):
p[j]=False
return p
sosu=sieve(1000010)
for i in sys.stdin:
t=int(i)
if t<2:print((0))
elif t==2:print((1))
else:pr... | 19 | 22 | 359 | 420 | import sys
import math as mas
def sieve(n):
p = [True for i in range(n + 1)]
p[0] = p[1] = False
end = int(n**0.5)
for i in range(2, end + 1):
if p[i]:
for j in range(i * i, n + 1, i):
p[j] = False
return p
sosu = sieve(1000010)
for i in sys.stdin:
print((... | import sys
import math as mas
def sieve(n):
p = [True for i in range(n + 1)]
p[0] = p[1] = False
end = int(n**0.5)
for i in range(2, end + 1):
if p[i]:
for j in range(i * i, n + 1, i):
p[j] = False
return p
sosu = sieve(1000010)
for i in sys.stdin:
t = int... | false | 13.636364 | [
"- print((sum(sosu[t] for t in range(int(i) + 1))))",
"+ t = int(i)",
"+ if t < 2:",
"+ print((0))",
"+ elif t == 2:",
"+ print((1))",
"+ else:",
"+ print((1 + sum(sosu[t] for t in range(3, int(i) + 1, 2))))"
] | false | 0.343289 | 0.248389 | 1.382062 | [
"s097858858",
"s268377793"
] |
u936985471 | p02683 | python | s173443233 | s382605374 | 84 | 68 | 9,240 | 9,192 | Accepted | Accepted | 19.05 | import sys
readline = sys.stdin.readline
N,M,X = list(map(int,readline().split()))
data = [None] * N
for i in range(N):
d = list(map(int,input().split()))
c = d[0]
target = d[1:]
data[i] = [c,target]
ans = 10 ** 9
for i in range(2 ** N):
cost = 0
skills = [0] * M
for j in range(N):
i... | import sys
readline = sys.stdin.readline
N,M,X = list(map(int,readline().split()))
books = [None] * N
for i in range(N):
data = list(map(int,readline().split()))
cost = data[0]
point = data[1:]
books[i] = [cost,point]
# M個から1個以上M個以下を選ぶ。選ぶ数でループ
INF = 10 ** 10
ans = INF
import itertools
for i i... | 31 | 34 | 614 | 750 | import sys
readline = sys.stdin.readline
N, M, X = list(map(int, readline().split()))
data = [None] * N
for i in range(N):
d = list(map(int, input().split()))
c = d[0]
target = d[1:]
data[i] = [c, target]
ans = 10**9
for i in range(2**N):
cost = 0
skills = [0] * M
for j in range(N):
... | import sys
readline = sys.stdin.readline
N, M, X = list(map(int, readline().split()))
books = [None] * N
for i in range(N):
data = list(map(int, readline().split()))
cost = data[0]
point = data[1:]
books[i] = [cost, point]
# M個から1個以上M個以下を選ぶ。選ぶ数でループ
INF = 10**10
ans = INF
import itertools
for i in rang... | false | 8.823529 | [
"-data = [None] * N",
"+books = [None] * N",
"- d = list(map(int, input().split()))",
"- c = d[0]",
"- target = d[1:]",
"- data[i] = [c, target]",
"-ans = 10**9",
"-for i in range(2**N):",
"- cost = 0",
"- skills = [0] * M",
"- for j in range(N):",
"- if (i >> j) & ... | false | 0.04921 | 0.041798 | 1.177326 | [
"s173443233",
"s382605374"
] |
u396495667 | p03834 | python | s710582425 | s402988195 | 168 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.88 | s = eval(input())
ans = s.replace(',',' ')
print(ans) | s = eval(input())
print((s.replace(',',' '))) | 3 | 2 | 49 | 38 | s = eval(input())
ans = s.replace(",", " ")
print(ans)
| s = eval(input())
print((s.replace(",", " ")))
| false | 33.333333 | [
"-ans = s.replace(\",\", \" \")",
"-print(ans)",
"+print((s.replace(\",\", \" \")))"
] | false | 0.08021 | 0.040836 | 1.964204 | [
"s710582425",
"s402988195"
] |
u597455618 | p02678 | python | s631241442 | s060667455 | 464 | 428 | 47,288 | 47,348 | Accepted | Accepted | 7.76 | import sys
from collections import deque
n, m = map(int, input().split())
link = [ [] for i in range(n)]
for i in sys.stdin.readlines():
a, b = map(int, i.split())
link[a-1].append(b-1)
link[b-1].append(a-1)
d = deque([0])
ans = [-1]*n
ans[0] = 0
while d:
p = d.popleft()
for v in li... | import sys
from collections import deque
n, m = map(int, input().split())
link = [ [] for i in range(n)]
for i in sys.stdin.readlines():
a, b = map(int, i.split())
link[a-1].append(b-1)
link[b-1].append(a-1)
d = deque([0])
ans = [-1]*n
ans[0] = 0
while d:
p = d.pop()
for v in link[p... | 25 | 25 | 494 | 494 | import sys
from collections import deque
n, m = map(int, input().split())
link = [[] for i in range(n)]
for i in sys.stdin.readlines():
a, b = map(int, i.split())
link[a - 1].append(b - 1)
link[b - 1].append(a - 1)
d = deque([0])
ans = [-1] * n
ans[0] = 0
while d:
p = d.popleft()
for v in link[p]:
... | import sys
from collections import deque
n, m = map(int, input().split())
link = [[] for i in range(n)]
for i in sys.stdin.readlines():
a, b = map(int, i.split())
link[a - 1].append(b - 1)
link[b - 1].append(a - 1)
d = deque([0])
ans = [-1] * n
ans[0] = 0
while d:
p = d.pop()
for v in link[p]:
... | false | 0 | [
"- p = d.popleft()",
"+ p = d.pop()",
"- d.append(v)",
"+ d.appendleft(v)"
] | false | 0.049556 | 0.096215 | 0.51506 | [
"s631241442",
"s060667455"
] |
u474925961 | p03379 | python | s302227976 | s378371826 | 874 | 646 | 34,152 | 34,176 | Accepted | Accepted | 26.09 | import numpy as np
n=int(eval(input()))
l=list(map(int,input().split()))
arr=np.sort(np.array(l))
med=np.median(arr)
med_max=int(np.median(np.delete(arr,0)))
med_min=int(np.median(np.delete(arr,n-1)))
if n%2==1:
p=(n-1)//2
med_midmin=int(np.median(np.delete(arr,p+1)))
med_mid=int(np.median(n... | import numpy as np
n=int(eval(input()))
l=list(map(int,input().split()))
arr=np.sort(np.array(l))
med=np.median(arr)
med_max=int(np.median(np.delete(arr,0)))
med_min=int(np.median(np.delete(arr,n-1)))
p=(n+1)//2
for i in range(n):
if l[i]<=arr[p-1]:
print(med_max)
else:
print... | 41 | 17 | 1,056 | 323 | import numpy as np
n = int(eval(input()))
l = list(map(int, input().split()))
arr = np.sort(np.array(l))
med = np.median(arr)
med_max = int(np.median(np.delete(arr, 0)))
med_min = int(np.median(np.delete(arr, n - 1)))
if n % 2 == 1:
p = (n - 1) // 2
med_midmin = int(np.median(np.delete(arr, p + 1)))
med_mi... | import numpy as np
n = int(eval(input()))
l = list(map(int, input().split()))
arr = np.sort(np.array(l))
med = np.median(arr)
med_max = int(np.median(np.delete(arr, 0)))
med_min = int(np.median(np.delete(arr, n - 1)))
p = (n + 1) // 2
for i in range(n):
if l[i] <= arr[p - 1]:
print(med_max)
else:
... | false | 58.536585 | [
"-if n % 2 == 1:",
"- p = (n - 1) // 2",
"- med_midmin = int(np.median(np.delete(arr, p + 1)))",
"- med_mid = int(np.median(np.delete(arr, p)))",
"- med_midmax = int(np.median(np.delete(arr, p - 1)))",
"- for i in range(n):",
"- if l[i] < arr[p - 1]:",
"- print(med_max... | false | 0.175406 | 0.177644 | 0.987406 | [
"s302227976",
"s378371826"
] |
u939814144 | p02255 | python | s211543118 | s229067280 | 60 | 20 | 8,032 | 7,672 | Accepted | Accepted | 66.67 | def insertion_sort(array, element_number):
for i in range(element_number):
v = array[i]
j = i - 1
while(j>=0 and array[j] > v):
array[j+1] = array[j]
j = j - 1
array[j+1] = v
for k in range(element_number):
if k < element_num... | def insertion_sort(array):
'''?????????????´?????????????????????¨??????????????????????????¨???????????????????????§?????\?????????????????°????????????
1. ??????????????¨??????????????????????´?????????????????????? v ????¨?????????????
2. ????????????????????¨??????????????????v ????????§??????????´??... | 27 | 36 | 668 | 1,028 | def insertion_sort(array, element_number):
for i in range(element_number):
v = array[i]
j = i - 1
while j >= 0 and array[j] > v:
array[j + 1] = array[j]
j = j - 1
array[j + 1] = v
for k in range(element_number):
if k < element_number - 1:
... | def insertion_sort(array):
"""?????????????´?????????????????????¨??????????????????????????¨???????????????????????§?????\?????????????????°????????????
1. ??????????????¨??????????????????????´?????????????????????? v ????¨?????????????
2. ????????????????????¨??????????????????v ????????§??????????´?????... | false | 25 | [
"-def insertion_sort(array, element_number):",
"- for i in range(element_number):",
"+def insertion_sort(array):",
"+ \"\"\"?????????????´?????????????????????¨??????????????????????????¨???????????????????????§?????\\?????????????????°????????????",
"+ 1. ??????????????¨??????????????????????´????... | false | 0.056145 | 0.051297 | 1.094523 | [
"s211543118",
"s229067280"
] |
u969850098 | p02850 | python | s447742325 | s714825116 | 548 | 505 | 45,640 | 49,444 | Accepted | Accepted | 7.85 | from collections import deque
def main():
N = int(eval(input()))
path = [[] for _ in range(N)]
ab = []
ans = {}
visited = [False] * N
visited[0] = True
for _ in range(N-1):
a, b = list(map(int, input().split()))
path[a-1].append(b-1)
# path[b-1].append(a-... | from collections import deque
def main():
N = int(eval(input()))
path = [[] for _ in range(N)]
ab = []
ans = {}
visited = [False] * N
visited[0] = True
for _ in range(N-1):
a, b = list(map(int, input().split()))
path[a-1].append(b-1)
ab.append((a-1, b-1))... | 37 | 33 | 869 | 791 | from collections import deque
def main():
N = int(eval(input()))
path = [[] for _ in range(N)]
ab = []
ans = {}
visited = [False] * N
visited[0] = True
for _ in range(N - 1):
a, b = list(map(int, input().split()))
path[a - 1].append(b - 1)
# path[b-1].append(a-1)
... | from collections import deque
def main():
N = int(eval(input()))
path = [[] for _ in range(N)]
ab = []
ans = {}
visited = [False] * N
visited[0] = True
for _ in range(N - 1):
a, b = list(map(int, input().split()))
path[a - 1].append(b - 1)
ab.append((a - 1, b - 1))
... | false | 10.810811 | [
"- # path[b-1].append(a-1)",
"- for next_node in path[pre]:",
"- if visited[next_node]:",
"+ for node in path[pre]:",
"+ if visited[node]:",
"- visited[next_node] = True",
"- ans[(pre, next_node)] = k",
"- que.append((next_nod... | false | 0.13841 | 0.041884 | 3.304619 | [
"s447742325",
"s714825116"
] |
u227082700 | p03295 | python | s087962634 | s348301580 | 567 | 523 | 28,252 | 29,660 | Accepted | Accepted | 7.76 | n,m=list(map(int,input().split()))
ab=[list(map(int,input().split()))for _ in range(m)]
ab.sort()
l,r=ab[0]
ans=1
for i,j in ab[1:]:
if j<=l or r<=i:
ans+=1
l,r=i,j
l=max(l,i)
r=min(r,j)
print(ans) | n,m=list(map(int,input().split()))
ab=[list(map(int,input().split()))for _ in range(m)]
ab.sort()
l,r=ab[0]
ans=1
for a,b in ab[1:]:
if r<=a:
ans+=1
l,r=a,b
else:
l=max(l,a)
r=min(r,b)
print(ans) | 12 | 13 | 216 | 221 | n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
ab.sort()
l, r = ab[0]
ans = 1
for i, j in ab[1:]:
if j <= l or r <= i:
ans += 1
l, r = i, j
l = max(l, i)
r = min(r, j)
print(ans)
| n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
ab.sort()
l, r = ab[0]
ans = 1
for a, b in ab[1:]:
if r <= a:
ans += 1
l, r = a, b
else:
l = max(l, a)
r = min(r, b)
print(ans)
| false | 7.692308 | [
"-for i, j in ab[1:]:",
"- if j <= l or r <= i:",
"+for a, b in ab[1:]:",
"+ if r <= a:",
"- l, r = i, j",
"- l = max(l, i)",
"- r = min(r, j)",
"+ l, r = a, b",
"+ else:",
"+ l = max(l, a)",
"+ r = min(r, b)"
] | false | 0.045113 | 0.044798 | 1.007023 | [
"s087962634",
"s348301580"
] |
u133936772 | p02714 | python | s722495544 | s564697700 | 1,319 | 717 | 69,320 | 69,012 | Accepted | Accepted | 45.64 | n=int(eval(input()));s=eval(input());c=s.count;print((c('R')*c('G')*c('B')-sum(sorted(s[i:j+1:(j-i)//2])==list('BGR')for i in range(n-2)for j in range(i+2,n,2)))) | n=int(eval(input()));s=eval(input());c=s.count;print((c('R')*c('G')*c('B')-sum(len(set(s[i:j+1:(j-i)//2]))>2for i in range(n-2)for j in range(i+2,n,2)))) | 1 | 1 | 148 | 139 | n = int(eval(input()))
s = eval(input())
c = s.count
print(
(
c("R") * c("G") * c("B")
- sum(
sorted(s[i : j + 1 : (j - i) // 2]) == list("BGR")
for i in range(n - 2)
for j in range(i + 2, n, 2)
)
)
)
| n = int(eval(input()))
s = eval(input())
c = s.count
print(
(
c("R") * c("G") * c("B")
- sum(
len(set(s[i : j + 1 : (j - i) // 2])) > 2
for i in range(n - 2)
for j in range(i + 2, n, 2)
)
)
)
| false | 0 | [
"- sorted(s[i : j + 1 : (j - i) // 2]) == list(\"BGR\")",
"+ len(set(s[i : j + 1 : (j - i) // 2])) > 2"
] | false | 0.041897 | 0.03878 | 1.080387 | [
"s722495544",
"s564697700"
] |
u489959379 | p03062 | python | s049100571 | s014598451 | 187 | 67 | 32,756 | 20,172 | Accepted | Accepted | 64.17 | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
total = 0
mi = f_inf
for a in A:
total += abs(a)
if a < 0:
... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
total = 0
mi = f_inf
cnt_minus = 0
for a in A:
if a < 0:
cnt_minus += 1
... | 43 | 25 | 879 | 493 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
cnt = 0
total = 0
mi = f_inf
for a in A:
total += abs(a)
if a < 0:
cnt += 1
if ... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
total = 0
mi = f_inf
cnt_minus = 0
for a in A:
if a < 0:
cnt_minus += 1
if mi > abs(a):... | false | 41.860465 | [
"- cnt = 0",
"+ cnt_minus = 0",
"- total += abs(a)",
"- cnt += 1",
"+ cnt_minus += 1",
"- if cnt % 2 == 0:",
"- print(total)",
"- else:",
"- print((total - mi * 2))",
"-",
"-",
"-def resolve2():",
"- n = int(eval(input()))",
"- A... | false | 0.076119 | 0.037103 | 2.051581 | [
"s049100571",
"s014598451"
] |
u312025627 | p02756 | python | s272800050 | s806213730 | 640 | 354 | 8,684 | 103,160 | Accepted | Accepted | 44.69 | def main():
from collections import deque
S = eval(input())
Q = int(eval(input()))
S = deque(S)
flag = False
for query in range(Q):
a, *bc = (i for i in input().split())
# print(a, bc)
if a == "1":
flag = not(flag)
else:
if flag... | def main():
from collections import deque
S = eval(input())
Q = int(eval(input()))
rev = 0 # 1のとき反転
que = deque((s for s in S))
for _ in range(Q):
Cmd = [i for i in input().split()]
if Cmd[0] == "1":
rev ^= 1
else:
if rev == 0:
... | 30 | 33 | 738 | 846 | def main():
from collections import deque
S = eval(input())
Q = int(eval(input()))
S = deque(S)
flag = False
for query in range(Q):
a, *bc = (i for i in input().split())
# print(a, bc)
if a == "1":
flag = not (flag)
else:
if flag:
... | def main():
from collections import deque
S = eval(input())
Q = int(eval(input()))
rev = 0 # 1のとき反転
que = deque((s for s in S))
for _ in range(Q):
Cmd = [i for i in input().split()]
if Cmd[0] == "1":
rev ^= 1
else:
if rev == 0:
if... | false | 9.090909 | [
"- S = deque(S)",
"- flag = False",
"- for query in range(Q):",
"- a, *bc = (i for i in input().split())",
"- # print(a, bc)",
"- if a == \"1\":",
"- flag = not (flag)",
"+ rev = 0 # 1のとき反転",
"+ que = deque((s for s in S))",
"+ for _ in range(Q):"... | false | 0.046266 | 0.103853 | 0.44549 | [
"s272800050",
"s806213730"
] |
u188827677 | p03043 | python | s897613060 | s118505127 | 49 | 45 | 2,940 | 2,940 | Accepted | Accepted | 8.16 | n,k = list(map(int,input().split()))
ans = 0
for i in range(1, n+1):
count = 0
while i < k:
i *= 2
count += 1
ans += (1/n) * (1/2**count)
print(ans) | n,k = list(map(int, input().split()))
ans = 0
for i in range(1, n+1):
t = 0
while i < k:
i = i*2
t += 1
ans += (0.5**t)/n
print(ans) | 11 | 10 | 170 | 150 | n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
count = 0
while i < k:
i *= 2
count += 1
ans += (1 / n) * (1 / 2**count)
print(ans)
| n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
t = 0
while i < k:
i = i * 2
t += 1
ans += (0.5**t) / n
print(ans)
| false | 9.090909 | [
"- count = 0",
"+ t = 0",
"- i *= 2",
"- count += 1",
"- ans += (1 / n) * (1 / 2**count)",
"+ i = i * 2",
"+ t += 1",
"+ ans += (0.5**t) / n"
] | false | 0.067369 | 0.056059 | 1.201753 | [
"s897613060",
"s118505127"
] |
u997641430 | p03017 | python | s334606802 | s360165736 | 172 | 92 | 4,020 | 3,572 | Accepted | Accepted | 46.51 | def passable(road):
n=len(road)
for i in range(n-1):
block=road[i:i+2]
if block=='##':
return False
return True
def safe_place(road):
n=len(road)
for i in range(n-2):
block=road[i:i+3]
if block=='...':
return i+1
return -1
... | def passable(road):
n=len(road)
for i in range(n-1):
block=road[i:i+2]
if block=='##':
return False
return True
def blank(road):
n=len(road)
for i in range(1,n-1):
block=road[i-1:i+2]
if block=='...':
return True
return False... | 43 | 27 | 1,065 | 626 | def passable(road):
n = len(road)
for i in range(n - 1):
block = road[i : i + 2]
if block == "##":
return False
return True
def safe_place(road):
n = len(road)
for i in range(n - 2):
block = road[i : i + 3]
if block == "...":
return i + 1
... | def passable(road):
n = len(road)
for i in range(n - 1):
block = road[i : i + 2]
if block == "##":
return False
return True
def blank(road):
n = len(road)
for i in range(1, n - 1):
block = road[i - 1 : i + 2]
if block == "...":
return True
... | false | 37.209302 | [
"-def safe_place(road):",
"+def blank(road):",
"- for i in range(n - 2):",
"- block = road[i : i + 3]",
"+ for i in range(1, n - 1):",
"+ block = road[i - 1 : i + 2]",
"- return i + 1",
"- return -1",
"-",
"-",
"-def passEach(A, B, C, D, road):",
"- if pass... | false | 0.042082 | 0.036128 | 1.164825 | [
"s334606802",
"s360165736"
] |
u857605629 | p03997 | python | s295128143 | s834556547 | 198 | 10 | 2,692 | 2,580 | Accepted | Accepted | 94.95 |
a = eval(input())
b = eval(input())
h = eval(input())
print(int(((a+b)/2)*h)) | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h/2) | 5 | 4 | 94 | 81 | a = eval(input())
b = eval(input())
h = eval(input())
print(int(((a + b) / 2) * h))
| a = int(input())
b = int(input())
h = int(input())
print((a + b) * h / 2)
| false | 20 | [
"-a = eval(input())",
"-b = eval(input())",
"-h = eval(input())",
"-print(int(((a + b) / 2) * h))",
"+a = int(input())",
"+b = int(input())",
"+h = int(input())",
"+print((a + b) * h / 2)"
] | false | 0.054339 | 0.036334 | 1.495548 | [
"s295128143",
"s834556547"
] |
u644907318 | p02971 | python | s166517867 | s806378449 | 1,135 | 301 | 83,288 | 90,668 | Accepted | Accepted | 73.48 | N = int(eval(input()))
A = [(i,int(eval(input()))) for i in range(N)]
B = sorted(A,key=lambda x:x[1],reverse=True)
cnt = 0
bmax = B[0][1]
for i in range(N):
if B[i][1]==bmax:
cnt += 1
else:break
for i in range(N):
if A[i][1] < bmax:
print(bmax)
elif A[i][1]==bmax and cnt==1:
... | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
B = sorted(A,reverse=True)
b0 = B[0]
b1 = B[1]
for i in range(N):
a = A[i]
if a!=b0:
print(b0)
else:
print(b1) | 16 | 11 | 387 | 202 | N = int(eval(input()))
A = [(i, int(eval(input()))) for i in range(N)]
B = sorted(A, key=lambda x: x[1], reverse=True)
cnt = 0
bmax = B[0][1]
for i in range(N):
if B[i][1] == bmax:
cnt += 1
else:
break
for i in range(N):
if A[i][1] < bmax:
print(bmax)
elif A[i][1] == bmax and cnt... | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
B = sorted(A, reverse=True)
b0 = B[0]
b1 = B[1]
for i in range(N):
a = A[i]
if a != b0:
print(b0)
else:
print(b1)
| false | 31.25 | [
"-A = [(i, int(eval(input()))) for i in range(N)]",
"-B = sorted(A, key=lambda x: x[1], reverse=True)",
"-cnt = 0",
"-bmax = B[0][1]",
"+A = [int(eval(input())) for _ in range(N)]",
"+B = sorted(A, reverse=True)",
"+b0 = B[0]",
"+b1 = B[1]",
"- if B[i][1] == bmax:",
"- cnt += 1",
"+ ... | false | 0.038497 | 0.065062 | 0.591689 | [
"s166517867",
"s806378449"
] |
u802963389 | p03363 | python | s994917045 | s565045902 | 856 | 267 | 113,096 | 41,672 | Accepted | Accepted | 68.81 | from collections import Counter
import math
def combi(n, r):
if n >= 2:
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
else:
return 0
n = int(eval(input()))
a = list(map(int, input().split()))
s = [0]
for i in range(n):
s.append(s[i] + a[i])
cs = Counter(s)
ans ... | from collections import defaultdict
n = int(eval(input()))
A = list(map(int, input().split()))
accum = [0] * (n + 1)
for i in range(n):
accum[i + 1] = accum[i] + A[i]
box = defaultdict(int)
for i in accum:
box[i] += 1
ans = 0
for k, v in list(box.items()):
ans += v * (v -1) // 2
pr... | 20 | 20 | 374 | 316 | from collections import Counter
import math
def combi(n, r):
if n >= 2:
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
else:
return 0
n = int(eval(input()))
a = list(map(int, input().split()))
s = [0]
for i in range(n):
s.append(s[i] + a[i])
cs = Counter(s)
ans =... | from collections import defaultdict
n = int(eval(input()))
A = list(map(int, input().split()))
accum = [0] * (n + 1)
for i in range(n):
accum[i + 1] = accum[i] + A[i]
box = defaultdict(int)
for i in accum:
box[i] += 1
ans = 0
for k, v in list(box.items()):
ans += v * (v - 1) // 2
print(ans)
| false | 0 | [
"-from collections import Counter",
"-import math",
"-",
"-",
"-def combi(n, r):",
"- if n >= 2:",
"- return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))",
"- else:",
"- return 0",
"-",
"+from collections import defaultdict",
"-a = list(map(int, input().... | false | 0.048094 | 0.039555 | 1.215896 | [
"s994917045",
"s565045902"
] |
u612975321 | p02788 | python | s803886366 | s540343846 | 651 | 527 | 62,196 | 50,068 | Accepted | Accepted | 19.05 | from collections import deque
import sys
input = sys.stdin.buffer.readline
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
n, d, a = MAP()
xh = [LIST() for i in range(n)]
xh = sorted(xh, key=lambda x:(x[0]))
q = deque()
ca = 0
cnt = 0
for i in range(... | from collections import deque
import sys
input = sys.stdin.buffer.readline
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
n, d, a = MAP()
monster = {}
x = []
for i in range(n):
xx, hh = MAP()
monster[xx] = hh
x.append(xx)
x.sort()
q = ... | 30 | 35 | 601 | 643 | from collections import deque
import sys
input = sys.stdin.buffer.readline
def MAP():
return list(map(int, input().split()))
def LIST():
return list(map(int, input().split()))
n, d, a = MAP()
xh = [LIST() for i in range(n)]
xh = sorted(xh, key=lambda x: (x[0]))
q = deque()
ca = 0
cnt = 0
for i in range(n... | from collections import deque
import sys
input = sys.stdin.buffer.readline
def MAP():
return list(map(int, input().split()))
def LIST():
return list(map(int, input().split()))
n, d, a = MAP()
monster = {}
x = []
for i in range(n):
xx, hh = MAP()
monster[xx] = hh
x.append(xx)
x.sort()
q = dequ... | false | 14.285714 | [
"-xh = [LIST() for i in range(n)]",
"-xh = sorted(xh, key=lambda x: (x[0]))",
"+monster = {}",
"+x = []",
"+for i in range(n):",
"+ xx, hh = MAP()",
"+ monster[xx] = hh",
"+ x.append(xx)",
"+x.sort()",
"- cx, ch = xh[i][0], xh[i][1]",
"+ cx, ch = x[i], monster[x[i]]"
] | false | 0.044936 | 0.043369 | 1.036145 | [
"s803886366",
"s540343846"
] |
u745514010 | p03095 | python | s518546456 | s313579086 | 65 | 47 | 9,964 | 9,216 | Accepted | Accepted | 27.69 | n = int(eval(input()))
s = list(eval(input()))
mod = 10 ** 9 + 7
alpha = "abcdefghijklmnopqrstuvwxyz"
cnt = []
for a in alpha:
tmp = s.count(a)
cnt.append(tmp + 1)
ans = 1
for num in cnt:
ans *= num
ans %= mod
print((ans - 1)) | MOD = 10 ** 9 + 7
cnt = [1 for _ in range(26)]
n = int(eval(input()))
string = eval(input())
for s in string:
cnt[ord(s) - 97] += 1
ans = 1
for num in cnt:
ans *= num
ans %= MOD
print(((ans - 1) % MOD)) | 13 | 11 | 240 | 210 | n = int(eval(input()))
s = list(eval(input()))
mod = 10**9 + 7
alpha = "abcdefghijklmnopqrstuvwxyz"
cnt = []
for a in alpha:
tmp = s.count(a)
cnt.append(tmp + 1)
ans = 1
for num in cnt:
ans *= num
ans %= mod
print((ans - 1))
| MOD = 10**9 + 7
cnt = [1 for _ in range(26)]
n = int(eval(input()))
string = eval(input())
for s in string:
cnt[ord(s) - 97] += 1
ans = 1
for num in cnt:
ans *= num
ans %= MOD
print(((ans - 1) % MOD))
| false | 15.384615 | [
"+MOD = 10**9 + 7",
"+cnt = [1 for _ in range(26)]",
"-s = list(eval(input()))",
"-mod = 10**9 + 7",
"-alpha = \"abcdefghijklmnopqrstuvwxyz\"",
"-cnt = []",
"-for a in alpha:",
"- tmp = s.count(a)",
"- cnt.append(tmp + 1)",
"+string = eval(input())",
"+for s in string:",
"+ cnt[ord(s)... | false | 0.042748 | 0.038163 | 1.120155 | [
"s518546456",
"s313579086"
] |
u298297089 | p03244 | python | s700873231 | s175440213 | 113 | 104 | 22,132 | 19,040 | Accepted | Accepted | 7.96 | from collections import Counter
N = int(eval(input()))
a = list(map(int,input().split()))
even = [[0,0]] + sorted([v,k] for k,v in list(Counter(a[1::2]).items()))
odd = [[0,0]] + sorted([v,k] for k,v in list(Counter(a[0::2]).items()))
if even[-1][1] != odd[-1][1]:
print((N - even[-1][0] - odd[-1][0]))
else... | from collections import Counter
n = int(eval(input()))
v = list(map(int, input().split()))
a = [v[i] for i in range(n) if i % 2]
b = [v[i] for i in range(n) if i % 2 == 0]
aa = Counter(a)
bb = Counter(b)
ans = 0
aas = sorted(list(aa.keys()), key=lambda key:aa[key], reverse=True)
bbs = sorted(list(bb.keys()... | 10 | 24 | 378 | 693 | from collections import Counter
N = int(eval(input()))
a = list(map(int, input().split()))
even = [[0, 0]] + sorted([v, k] for k, v in list(Counter(a[1::2]).items()))
odd = [[0, 0]] + sorted([v, k] for k, v in list(Counter(a[0::2]).items()))
if even[-1][1] != odd[-1][1]:
print((N - even[-1][0] - odd[-1][0]))
else:... | from collections import Counter
n = int(eval(input()))
v = list(map(int, input().split()))
a = [v[i] for i in range(n) if i % 2]
b = [v[i] for i in range(n) if i % 2 == 0]
aa = Counter(a)
bb = Counter(b)
ans = 0
aas = sorted(list(aa.keys()), key=lambda key: aa[key], reverse=True)
bbs = sorted(list(bb.keys()), key=lamb... | false | 58.333333 | [
"-N = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-even = [[0, 0]] + sorted([v, k] for k, v in list(Counter(a[1::2]).items()))",
"-odd = [[0, 0]] + sorted([v, k] for k, v in list(Counter(a[0::2]).items()))",
"-if even[-1][1] != odd[-1][1]:",
"- print((N - even[-1][0] - odd[-1][0]))",
... | false | 0.084285 | 0.045163 | 1.866243 | [
"s700873231",
"s175440213"
] |
u816631826 | p02621 | python | s531791182 | s892301931 | 424 | 57 | 84,936 | 64,112 | Accepted | Accepted | 86.56 | s = int(input())
print(s + s ** 2 + s ** 3)
|
s = input()
s = int(s)
print(s + s ** 2 + s ** 3)
| 8 | 5 | 60 | 59 | s = int(input())
print(s + s**2 + s**3)
| s = input()
s = int(s)
print(s + s**2 + s**3)
| false | 37.5 | [
"-s = int(input())",
"+s = input()",
"+s = int(s)"
] | false | 0.04239 | 0.036738 | 1.15386 | [
"s531791182",
"s892301931"
] |
u075012704 | p02850 | python | s572708792 | s273000396 | 902 | 770 | 53,976 | 47,432 | Accepted | Accepted | 14.63 | from collections import defaultdict
N = int(input())
tree = [[] for i in range(N)] # 入力で与えられる木: [[to, 辺のindex],]
degrees = defaultdict(int) # 各頂点の次数を記録
for i in range(N - 1):
a, b = map(int, input().split())
a, b = a - 1, b - 1
tree[a].append([b, i])
tree[b].append([a, i])
degrees[a] +=... | N = int(input())
T = [[] for i in range(N)]
for i in range(N - 1):
a, b = map(int, input().split())
a, b = a - 1, b - 1
# 辺のindexを持っておく
T[a].append([b, i])
T[b].append([a, i])
stack = [[0, 0]] # [次の頂点番号, 親に続く辺の色]
visited = [0] * N
colors = [0] * (N - 1)
while stack:
n, parent_... | 43 | 38 | 912 | 658 | from collections import defaultdict
N = int(input())
tree = [[] for i in range(N)] # 入力で与えられる木: [[to, 辺のindex],]
degrees = defaultdict(int) # 各頂点の次数を記録
for i in range(N - 1):
a, b = map(int, input().split())
a, b = a - 1, b - 1
tree[a].append([b, i])
tree[b].append([a, i])
degrees[a] += 1
deg... | N = int(input())
T = [[] for i in range(N)]
for i in range(N - 1):
a, b = map(int, input().split())
a, b = a - 1, b - 1
# 辺のindexを持っておく
T[a].append([b, i])
T[b].append([a, i])
stack = [[0, 0]] # [次の頂点番号, 親に続く辺の色]
visited = [0] * N
colors = [0] * (N - 1)
while stack:
n, parent_color = stack.pop(... | false | 11.627907 | [
"-from collections import defaultdict",
"-",
"-tree = [[] for i in range(N)] # 入力で与えられる木: [[to, 辺のindex],]",
"-degrees = defaultdict(int) # 各頂点の次数を記録",
"+T = [[] for i in range(N)]",
"- tree[a].append([b, i])",
"- tree[b].append([a, i])",
"- degrees[a] += 1",
"- degrees[b] += 1",
"-#... | false | 0.046618 | 0.047004 | 0.991804 | [
"s572708792",
"s273000396"
] |
u686036872 | p03212 | python | s377203802 | s948702638 | 296 | 49 | 49,500 | 3,060 | Accepted | Accepted | 83.45 | N = int(eval(input()))
def dfs(s):
if int(s) > N:
return 0
else:
if '7' in s and '5' in s and '3' in s:
ret = 1
else:
ret = 0
for i in '357':
ret += dfs(s + i)
return ret
print((dfs("0"))) | from itertools import product
N = int(eval(input()))
ans = 0
for j in range(3, len(str(N))+1):
for i in product("357", repeat=j):
x = "".join(i)
if 357 <= int(x) <= N and len(set(x)) == 3:
ans += 1
print(ans) | 13 | 10 | 276 | 244 | N = int(eval(input()))
def dfs(s):
if int(s) > N:
return 0
else:
if "7" in s and "5" in s and "3" in s:
ret = 1
else:
ret = 0
for i in "357":
ret += dfs(s + i)
return ret
print((dfs("0")))
| from itertools import product
N = int(eval(input()))
ans = 0
for j in range(3, len(str(N)) + 1):
for i in product("357", repeat=j):
x = "".join(i)
if 357 <= int(x) <= N and len(set(x)) == 3:
ans += 1
print(ans)
| false | 23.076923 | [
"+from itertools import product",
"+",
"-",
"-",
"-def dfs(s):",
"- if int(s) > N:",
"- return 0",
"- else:",
"- if \"7\" in s and \"5\" in s and \"3\" in s:",
"- ret = 1",
"- else:",
"- ret = 0",
"- for i in \"357\":",
"- ... | false | 0.041035 | 0.038503 | 1.065763 | [
"s377203802",
"s948702638"
] |
u572122511 | p02803 | python | s296879359 | s301361322 | 488 | 279 | 3,064 | 3,188 | Accepted | Accepted | 42.83 | H, W = list(map(int, input().split()))
S = [input() for _ in range(H)]
def update(y, x, direction, d, q, end_pos):
next_y, next_x = (y + direction[0], x + direction[1])
if (next_y < 0 or next_y >= H or next_x < 0 or next_x >= W): # 端なら
return end_pos
if (S[next_y][next_x] == '#') or (d[next... | H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
def f(i, j):
t = [[-1] * W for _ in range(H)]
t[i][j] = 0
q = [(i, j)]
while q:
y, x = q.pop(0)
if y - 1 >= 0 and S[y - 1][x] != '#' and t[y - 1][x] == -1:
t[y - 1][x] = t[y][x] + 1
... | 36 | 31 | 1,214 | 944 | H, W = list(map(int, input().split()))
S = [input() for _ in range(H)]
def update(y, x, direction, d, q, end_pos):
next_y, next_x = (y + direction[0], x + direction[1])
if next_y < 0 or next_y >= H or next_x < 0 or next_x >= W: # 端なら
return end_pos
if (S[next_y][next_x] == "#") or (d[next_y][next... | H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
def f(i, j):
t = [[-1] * W for _ in range(H)]
t[i][j] = 0
q = [(i, j)]
while q:
y, x = q.pop(0)
if y - 1 >= 0 and S[y - 1][x] != "#" and t[y - 1][x] == -1:
t[y - 1][x] = t[y][x] + 1
q.a... | false | 13.888889 | [
"-S = [input() for _ in range(H)]",
"+S = [eval(input()) for _ in range(H)]",
"-def update(y, x, direction, d, q, end_pos):",
"- next_y, next_x = (y + direction[0], x + direction[1])",
"- if next_y < 0 or next_y >= H or next_x < 0 or next_x >= W: # 端なら",
"- return end_pos",
"- if (S[nex... | false | 0.047678 | 0.048714 | 0.97873 | [
"s296879359",
"s301361322"
] |
u672475305 | p02981 | python | s392735852 | s384039853 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | n,a,b = list(map(int,input().split()))
print((min(n*a,b))) | n,a,b = list(map(int,input().split()))
print((min(a*n,b))) | 2 | 2 | 51 | 51 | n, a, b = list(map(int, input().split()))
print((min(n * a, b)))
| n, a, b = list(map(int, input().split()))
print((min(a * n, b)))
| false | 0 | [
"-print((min(n * a, b)))",
"+print((min(a * n, b)))"
] | false | 0.103232 | 0.044719 | 2.308447 | [
"s392735852",
"s384039853"
] |
u968166680 | p02838 | python | s332411416 | s942828092 | 664 | 320 | 136,452 | 136,480 | Accepted | Accepted | 51.81 | 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():
N, *A = list(map(int, read().split()))
M = 61
C = [0] * M
for a in A:
a = str(format(a, 'b'))
for i,... | 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():
N, *A = list(map(int, read().split()))
M = 61
C = [0] * M
for a in A:
for i in range(M):
if not ... | 32 | 34 | 584 | 607 | 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():
N, *A = list(map(int, read().split()))
M = 61
C = [0] * M
for a in A:
a = str(format(a, "b"))
for i, d in enumerate(re... | 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():
N, *A = list(map(int, read().split()))
M = 61
C = [0] * M
for a in A:
for i in range(M):
if not a:
... | false | 5.882353 | [
"- a = str(format(a, \"b\"))",
"- for i, d in enumerate(reversed(a)):",
"- if d == \"1\":",
"+ for i in range(M):",
"+ if not a:",
"+ break",
"+ a, r = a // 2, a % 2",
"+ if r:"
] | false | 0.044173 | 0.037212 | 1.187044 | [
"s332411416",
"s942828092"
] |
u226108478 | p03588 | python | s287064323 | s009704530 | 380 | 328 | 3,060 | 3,060 | Accepted | Accepted | 13.68 | # -*- coding: utf-8 -*-
# Tenka1 Programmer Beginner Contest
# Problem B
if __name__ == '__main__':
n = int(eval(input()))
worst_rank = -1
worst_score = float('inf')
# See:
# https://beta.atcoder.jp/contests/tenka1-2017-beginner/submissions/1637273
for i in range(n):
ai, ... | # -*- coding: utf-8 -*-
# Tenka1 Programmer Beginner Contest
# Problem B
if __name__ == '__main__':
n = int(eval(input()))
worst_rank, worst_score = 0, 0
# See:
# https://beta.atcoder.jp/contests/tenka1-2017-beginner/submissions/1637273
# https://beta.atcoder.jp/contests/tenka1-2017-be... | 18 | 20 | 476 | 544 | # -*- coding: utf-8 -*-
# Tenka1 Programmer Beginner Contest
# Problem B
if __name__ == "__main__":
n = int(eval(input()))
worst_rank = -1
worst_score = float("inf")
# See:
# https://beta.atcoder.jp/contests/tenka1-2017-beginner/submissions/1637273
for i in range(n):
ai, bi = list(map(in... | # -*- coding: utf-8 -*-
# Tenka1 Programmer Beginner Contest
# Problem B
if __name__ == "__main__":
n = int(eval(input()))
worst_rank, worst_score = 0, 0
# See:
# https://beta.atcoder.jp/contests/tenka1-2017-beginner/submissions/1637273
# https://beta.atcoder.jp/contests/tenka1-2017-beginner/submiss... | false | 10 | [
"- worst_rank = -1",
"- worst_score = float(\"inf\")",
"+ worst_rank, worst_score = 0, 0",
"+ # https://beta.atcoder.jp/contests/tenka1-2017-beginner/submissions/1655004",
"- worst_rank = max(worst_rank, ai)",
"- worst_score = min(worst_score, bi)",
"+ if ai > worst_rank... | false | 0.080717 | 0.03856 | 2.093279 | [
"s287064323",
"s009704530"
] |
u366959492 | p03281 | python | s783087740 | s282074805 | 169 | 104 | 38,384 | 62,952 | Accepted | Accepted | 38.46 | def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort()
return divisors
n=int(eval(input()))
if n<105:
print((0))
exit()
ans=1
for... | n=int(eval(input()))
if n<105:
print((0))
exit()
ans=0
for i in range(105,n+1,2):
c=0
for j in range(1,i+1):
if i%j==0:
c+=1
if c==8:
ans+=1
print(ans) | 22 | 13 | 439 | 203 | def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
divisors.sort()
return divisors
n = int(eval(input()))
if n < 105:
print((0))
exit()
ans = 1
for i i... | n = int(eval(input()))
if n < 105:
print((0))
exit()
ans = 0
for i in range(105, n + 1, 2):
c = 0
for j in range(1, i + 1):
if i % j == 0:
c += 1
if c == 8:
ans += 1
print(ans)
| false | 40.909091 | [
"-def make_divisors(n):",
"- divisors = []",
"- for i in range(1, int(n**0.5) + 1):",
"- if n % i == 0:",
"- divisors.append(i)",
"- if i != n // i:",
"- divisors.append(n // i)",
"- divisors.sort()",
"- return divisors",
"-",
"-",
"-ans ... | false | 0.101183 | 0.038814 | 2.606849 | [
"s783087740",
"s282074805"
] |
u073549161 | p03645 | python | s696841552 | s504512835 | 1,469 | 942 | 53,592 | 61,144 | Accepted | Accepted | 35.87 | from collections import deque
n, m = list(map(int, input().split()))
dat = deque([])
dat_finish = [False] * (n + 1)
for i in range(m):
a, b = list(map(int, input().split()))
dat.append((a, b))
for i in range(m):
a, b = dat[i]
if b == n:
dat_finish[a] = True
c = False
for i in r... | from collections import deque
n, m = list(map(int, input().split()))
dat = deque([])
dat2 = deque([])
dat_finish = [False] * (n + 1)
for i in range(m):
a, b = list(map(int, input().split()))
dat.append((a, b))
dat2.append((a, b))
for i in range(m):
a, b = dat.pop()
if b == n:
... | 22 | 24 | 444 | 495 | from collections import deque
n, m = list(map(int, input().split()))
dat = deque([])
dat_finish = [False] * (n + 1)
for i in range(m):
a, b = list(map(int, input().split()))
dat.append((a, b))
for i in range(m):
a, b = dat[i]
if b == n:
dat_finish[a] = True
c = False
for i in range(m):
a, b... | from collections import deque
n, m = list(map(int, input().split()))
dat = deque([])
dat2 = deque([])
dat_finish = [False] * (n + 1)
for i in range(m):
a, b = list(map(int, input().split()))
dat.append((a, b))
dat2.append((a, b))
for i in range(m):
a, b = dat.pop()
if b == n:
dat_finish[a] ... | false | 8.333333 | [
"+dat2 = deque([])",
"+ dat2.append((a, b))",
"- a, b = dat[i]",
"+ a, b = dat.pop()",
"- a, b = dat[i]",
"+ a, b = dat2.pop()"
] | false | 0.115003 | 0.039517 | 2.910235 | [
"s696841552",
"s504512835"
] |
u471214054 | p02732 | python | s507728852 | s072977692 | 1,675 | 280 | 26,140 | 24,748 | Accepted | Accepted | 83.28 | from math import factorial
N = int(eval(input()))
A = list(map(int, input().split()))
def comb(n, r):
return factorial(n) // (factorial(n - r) * factorial(r))
counts = [0] * (N + 1)
for a in A:
counts[a] += 1
total = sum([comb(n, 2) for n in [n for n in counts if n > 1]])
for a in A:
p... | N = int(eval(input()))
A = list(map(int, input().split()))
def comb2(n):
return n * (n - 1) // 2
counts = [0] * (N + 1)
for a in A:
counts[a] += 1
total = sum([comb2(n) for n in [n for n in counts if n > 1]])
for a in A:
print((total - (counts[a] - 1)))
| 17 | 15 | 352 | 285 | from math import factorial
N = int(eval(input()))
A = list(map(int, input().split()))
def comb(n, r):
return factorial(n) // (factorial(n - r) * factorial(r))
counts = [0] * (N + 1)
for a in A:
counts[a] += 1
total = sum([comb(n, 2) for n in [n for n in counts if n > 1]])
for a in A:
print((total - (co... | N = int(eval(input()))
A = list(map(int, input().split()))
def comb2(n):
return n * (n - 1) // 2
counts = [0] * (N + 1)
for a in A:
counts[a] += 1
total = sum([comb2(n) for n in [n for n in counts if n > 1]])
for a in A:
print((total - (counts[a] - 1)))
| false | 11.764706 | [
"-from math import factorial",
"-",
"-def comb(n, r):",
"- return factorial(n) // (factorial(n - r) * factorial(r))",
"+def comb2(n):",
"+ return n * (n - 1) // 2",
"-total = sum([comb(n, 2) for n in [n for n in counts if n > 1]])",
"+total = sum([comb2(n) for n in [n for n in counts if n > 1]])... | false | 0.086495 | 0.035923 | 2.407798 | [
"s507728852",
"s072977692"
] |
u382748202 | p03049 | python | s315088581 | s675255597 | 51 | 38 | 3,064 | 3,064 | Accepted | Accepted | 25.49 | N = int(eval(input()))
count_ab = 0
count_fb = 0
count_ea = 0
count_fbea = 0
for i in range(N):
s = eval(input())
for j in range(len(s)-1):
if s[j:j+2] == "AB":
count_ab += 1
if s[0] == "B" and s[len(s)-1] == "A":
count_fbea += 1
elif s[0] == "B":
count... | N = int(eval(input()))
count_ab = 0
count_fb = 0
count_ea = 0
count_fbea = 0
for i in range(N):
s = eval(input())
count_ab += s.count("AB")
if s[0] == "B" and s[len(s)-1] == "A":
count_fbea += 1
elif s[0] == "B":
count_fb += 1
elif s[len(s)-1] == "A":
count_ea ... | 29 | 27 | 604 | 547 | N = int(eval(input()))
count_ab = 0
count_fb = 0
count_ea = 0
count_fbea = 0
for i in range(N):
s = eval(input())
for j in range(len(s) - 1):
if s[j : j + 2] == "AB":
count_ab += 1
if s[0] == "B" and s[len(s) - 1] == "A":
count_fbea += 1
elif s[0] == "B":
count_fb += ... | N = int(eval(input()))
count_ab = 0
count_fb = 0
count_ea = 0
count_fbea = 0
for i in range(N):
s = eval(input())
count_ab += s.count("AB")
if s[0] == "B" and s[len(s) - 1] == "A":
count_fbea += 1
elif s[0] == "B":
count_fb += 1
elif s[len(s) - 1] == "A":
count_ea += 1
ans = ... | false | 6.896552 | [
"- for j in range(len(s) - 1):",
"- if s[j : j + 2] == \"AB\":",
"- count_ab += 1",
"+ count_ab += s.count(\"AB\")"
] | false | 0.103538 | 0.062783 | 1.649132 | [
"s315088581",
"s675255597"
] |
u934442292 | p02936 | python | s099881819 | s018400784 | 890 | 803 | 65,664 | 65,636 | Accepted | Accepted | 9.78 | import sys
from collections import deque
input = sys.stdin.readline
def bfs(G, v, p, counter):
queue = deque([(v, p)])
while queue:
v, p = queue.popleft()
for c in G[v]:
if c == p:
continue
counter[c] += counter[v]
queue.append... | import sys
from collections import deque
input = sys.stdin.readline
def bfs(G, v, p, counter):
queue = deque([(v, p)])
while queue:
v, p = queue.popleft()
for c in G[v]:
if c == p:
continue
counter[c] += counter[v]
queue.append... | 41 | 38 | 816 | 782 | import sys
from collections import deque
input = sys.stdin.readline
def bfs(G, v, p, counter):
queue = deque([(v, p)])
while queue:
v, p = queue.popleft()
for c in G[v]:
if c == p:
continue
counter[c] += counter[v]
queue.append((c, v))
def... | import sys
from collections import deque
input = sys.stdin.readline
def bfs(G, v, p, counter):
queue = deque([(v, p)])
while queue:
v, p = queue.popleft()
for c in G[v]:
if c == p:
continue
counter[c] += counter[v]
queue.append((c, v))
def... | false | 7.317073 | [
"- G = [[] for _ in range(N)]",
"+ G = [[] for _ in range(N + 1)]",
"- a -= 1",
"- b -= 1",
"- counter = [0] * N",
"+ counter = [0] * (N + 1)",
"- p -= 1",
"- bfs(G, 0, -1, counter)",
"- print((\" \".join(map(str, counter))))",
"+ bfs(G, 1, -1, counter)",
... | false | 0.039474 | 0.036888 | 1.070095 | [
"s099881819",
"s018400784"
] |
u745514010 | p02861 | python | s696905418 | s071253994 | 439 | 304 | 3,064 | 9,368 | Accepted | Accepted | 30.75 | import itertools, math
n = int(eval(input()))
xy = []
kai = 1
for i in range(n):
xy.append(list(map(int, input().split())))
kai *= (i + 1)
cost = 0
for lst in itertools.permutations(list(range(n)), n):
x = xy[lst[0]][0]
y = xy[lst[0]][1]
for num in lst:
dx = xy[num][0] - ... | import itertools
n = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(n)]
def fact(n):
if n == 1:
return 1
else:
return n * fact(n - 1)
ans = 0
div = fact(n)
for lst in itertools.permutations(list(range(n)), n):
start = xy[lst[0]]
for pos in lst:
... | 20 | 22 | 451 | 461 | import itertools, math
n = int(eval(input()))
xy = []
kai = 1
for i in range(n):
xy.append(list(map(int, input().split())))
kai *= i + 1
cost = 0
for lst in itertools.permutations(list(range(n)), n):
x = xy[lst[0]][0]
y = xy[lst[0]][1]
for num in lst:
dx = xy[num][0] - x
dy = xy[num... | import itertools
n = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(n)]
def fact(n):
if n == 1:
return 1
else:
return n * fact(n - 1)
ans = 0
div = fact(n)
for lst in itertools.permutations(list(range(n)), n):
start = xy[lst[0]]
for pos in lst:
dx = ... | false | 9.090909 | [
"-import itertools, math",
"+import itertools",
"-xy = []",
"-kai = 1",
"-for i in range(n):",
"- xy.append(list(map(int, input().split())))",
"- kai *= i + 1",
"-cost = 0",
"+xy = [list(map(int, input().split())) for _ in range(n)]",
"+",
"+",
"+def fact(n):",
"+ if n == 1:",
"+ ... | false | 0.042688 | 0.03392 | 1.258465 | [
"s696905418",
"s071253994"
] |
u297574184 | p03006 | python | s291449418 | s267070333 | 1,117 | 30 | 3,064 | 3,828 | Accepted | Accepted | 97.31 | N = int(eval(input()))
balls = [tuple(map(int, input().split())) for _ in range(N)]
ans = N
for i in range(N):
for j in range(i+1, N):
p, q = balls[j][0]-balls[i][0], balls[j][1]-balls[i][1]
cost = N
for a in range(N):
x1, y1 = balls[a]
for b in range(N):
... | from collections import Counter
N = int(eval(input()))
balls = [tuple(map(int, input().split())) for _ in range(N)]
if N == 1:
ans = 1
else:
diffs = Counter()
for i in range(N):
x1, y1 = balls[i]
for j in range(N):
if i == j: continue
x2, y2 = balls[j]
... | 18 | 18 | 496 | 414 | N = int(eval(input()))
balls = [tuple(map(int, input().split())) for _ in range(N)]
ans = N
for i in range(N):
for j in range(i + 1, N):
p, q = balls[j][0] - balls[i][0], balls[j][1] - balls[i][1]
cost = N
for a in range(N):
x1, y1 = balls[a]
for b in range(N):
... | from collections import Counter
N = int(eval(input()))
balls = [tuple(map(int, input().split())) for _ in range(N)]
if N == 1:
ans = 1
else:
diffs = Counter()
for i in range(N):
x1, y1 = balls[i]
for j in range(N):
if i == j:
continue
x2, y2 = balls[j... | false | 0 | [
"+from collections import Counter",
"+",
"-ans = N",
"-for i in range(N):",
"- for j in range(i + 1, N):",
"- p, q = balls[j][0] - balls[i][0], balls[j][1] - balls[i][1]",
"- cost = N",
"- for a in range(N):",
"- x1, y1 = balls[a]",
"- for b in range(N... | false | 0.08192 | 0.034854 | 2.350363 | [
"s291449418",
"s267070333"
] |
u879870653 | p03037 | python | s242176514 | s010505844 | 331 | 299 | 27,332 | 11,016 | Accepted | Accepted | 9.67 | N,M = list(map(int,input().split()))
A = [list(map(int,input().split())) for i in range(M)]
l = -1
r = float("inf")
for x,y in A :
if l < x :
l = x
if y < r :
r = y
print((max(0,r-l+1)))
| N,M = list(map(int,input().split()))
L = []
R = []
for i in range(M) :
l,r = list(map(int,input().split()))
L.append(l)
R.append(r)
left = max(L)
right = min(R)
ans = max(0, right-left+1)
print(ans) | 12 | 16 | 216 | 218 | N, M = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(M)]
l = -1
r = float("inf")
for x, y in A:
if l < x:
l = x
if y < r:
r = y
print((max(0, r - l + 1)))
| N, M = list(map(int, input().split()))
L = []
R = []
for i in range(M):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
left = max(L)
right = min(R)
ans = max(0, right - left + 1)
print(ans)
| false | 25 | [
"-A = [list(map(int, input().split())) for i in range(M)]",
"-l = -1",
"-r = float(\"inf\")",
"-for x, y in A:",
"- if l < x:",
"- l = x",
"- if y < r:",
"- r = y",
"-print((max(0, r - l + 1)))",
"+L = []",
"+R = []",
"+for i in range(M):",
"+ l, r = list(map(int, inpu... | false | 0.037228 | 0.090204 | 0.412715 | [
"s242176514",
"s010505844"
] |
u219417113 | p03593 | python | s569820638 | s738130015 | 173 | 22 | 38,640 | 3,316 | Accepted | Accepted | 87.28 | from collections import defaultdict
from sys import exit
H, W = list(map(int, input().split()))
char_counter = defaultdict(int)
for _ in range(H):
for s in eval(input()):
char_counter[s] += 1
if H % 2 == 0 and W % 2 == 0:
for k, v in list(char_counter.items()):
if v % 4 != 0:
... | def main():
import sys
input = sys.stdin.readline
from collections import defaultdict
H, W = list(map(int, input().split()))
counter = defaultdict(int)
for _ in range(H):
for s in input().rstrip():
counter[s] += 1
if H % 2 == 0 and W % 2 == 0:
for cnt in... | 68 | 64 | 1,804 | 1,726 | from collections import defaultdict
from sys import exit
H, W = list(map(int, input().split()))
char_counter = defaultdict(int)
for _ in range(H):
for s in eval(input()):
char_counter[s] += 1
if H % 2 == 0 and W % 2 == 0:
for k, v in list(char_counter.items()):
if v % 4 != 0:
print(... | def main():
import sys
input = sys.stdin.readline
from collections import defaultdict
H, W = list(map(int, input().split()))
counter = defaultdict(int)
for _ in range(H):
for s in input().rstrip():
counter[s] += 1
if H % 2 == 0 and W % 2 == 0:
for cnt in list(co... | false | 5.882353 | [
"-from collections import defaultdict",
"-from sys import exit",
"+def main():",
"+ import sys",
"-H, W = list(map(int, input().split()))",
"-char_counter = defaultdict(int)",
"-for _ in range(H):",
"- for s in eval(input()):",
"- char_counter[s] += 1",
"-if H % 2 == 0 and W % 2 == 0:... | false | 0.035171 | 0.03509 | 1.002325 | [
"s569820638",
"s738130015"
] |
u393512980 | p02973 | python | s827641824 | s122084739 | 1,464 | 606 | 98,008 | 53,336 | Accepted | Accepted | 58.61 | from heapq import *
from bisect import bisect_right, bisect_left
from collections import deque
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
lb, ub = 0, N
while lb + 1 < ub:
mid = (lb+ub)//2
cnt, ms, flag = 1, deque(), 1
ms.append(A[0])
for a in A[1:]:
if a <= ms[0... | from bisect import bisect_left
from collections import deque
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
cnt, ms, flag = 1, deque(), 1
ms.append(A[0])
for a in A[1:]:
if a <= ms[0]:
ms.appendleft(a)
cnt += 1
else:
i = bisect_left(ms, a)-1
ms[i] =... | 40 | 14 | 884 | 323 | from heapq import *
from bisect import bisect_right, bisect_left
from collections import deque
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
lb, ub = 0, N
while lb + 1 < ub:
mid = (lb + ub) // 2
cnt, ms, flag = 1, deque(), 1
ms.append(A[0])
for a in A[1:]:
if a <= ms[0]:
... | from bisect import bisect_left
from collections import deque
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
cnt, ms, flag = 1, deque(), 1
ms.append(A[0])
for a in A[1:]:
if a <= ms[0]:
ms.appendleft(a)
cnt += 1
else:
i = bisect_left(ms, a) - 1
ms[i] = a
print(... | false | 65 | [
"-from heapq import *",
"-from bisect import bisect_right, bisect_left",
"+from bisect import bisect_left",
"-lb, ub = 0, N",
"-while lb + 1 < ub:",
"- mid = (lb + ub) // 2",
"- cnt, ms, flag = 1, deque(), 1",
"- ms.append(A[0])",
"- for a in A[1:]:",
"- if a <= ms[0]:",
"- ... | false | 0.034441 | 0.034937 | 0.985823 | [
"s827641824",
"s122084739"
] |
u191214791 | p03611 | python | s538274725 | s749846797 | 1,072 | 235 | 18,460 | 18,460 | Accepted | Accepted | 78.08 | # encoding: "utf-8"
from collections import defaultdict
class Stdin:
@staticmethod
def read_line(converter=str):
return [converter(x) for x in input().split()]
@staticmethod
def read_lines(n, converter=str):
result = list()
for _ in range(n):
resul... | # encoding: "utf-8"
from collections import defaultdict
class Stdin:
@staticmethod
def read_line(converter=str):
return [converter(x) for x in input().split()]
@staticmethod
def read_lines(n, converter=str):
result = list()
for _ in range(n):
resul... | 54 | 54 | 1,213 | 1,213 | # encoding: "utf-8"
from collections import defaultdict
class Stdin:
@staticmethod
def read_line(converter=str):
return [converter(x) for x in input().split()]
@staticmethod
def read_lines(n, converter=str):
result = list()
for _ in range(n):
result.append(Stdin.re... | # encoding: "utf-8"
from collections import defaultdict
class Stdin:
@staticmethod
def read_line(converter=str):
return [converter(x) for x in input().split()]
@staticmethod
def read_lines(n, converter=str):
result = list()
for _ in range(n):
result.append(Stdin.re... | false | 0 | [
"- fst = xs[0]",
"- # cnt = xs.count(fst)",
"- for x in xs:",
"+ fst = xs[-1]",
"+ for x in reversed(xs):",
"- del xs[:cnt]",
"+ del xs[-cnt:]",
"- xs.sort()",
"+ xs.sort(reverse=True)",
"- key = xs[0]",
"+ key = xs[-1]"
] | false | 0.039439 | 0.038995 | 1.011404 | [
"s538274725",
"s749846797"
] |
u046158516 | p02852 | python | s479631203 | s727264387 | 241 | 71 | 48,416 | 73,356 | Accepted | Accepted | 70.54 | n,m=list(map(int,input().split()))
s=eval(input())
ans=[]
cursor=n
actualfail=0
while cursor!=0:
if cursor<=m:
ans.append(cursor)
break
failflag=1
for i in range(m):
if s[cursor-m+i]=='0':
failflag=0
ans.append(m-i)
cursor-=m-i
break
if failflag==1:
actua... | import sys
n,m=list(map(int,input().split()))
s=eval(input())
ans=[]
current=n
while current>0:
for i in range(m):
if current-(m-i)<0:
continue
if s[current-(m-i)]=='0':
current-=(m-i)
ans.append(str(m-i))
break
if i==m-1:
print((-1))
sys.exit()
ans.reve... | 25 | 18 | 413 | 333 | n, m = list(map(int, input().split()))
s = eval(input())
ans = []
cursor = n
actualfail = 0
while cursor != 0:
if cursor <= m:
ans.append(cursor)
break
failflag = 1
for i in range(m):
if s[cursor - m + i] == "0":
failflag = 0
ans.append(m - i)
curs... | import sys
n, m = list(map(int, input().split()))
s = eval(input())
ans = []
current = n
while current > 0:
for i in range(m):
if current - (m - i) < 0:
continue
if s[current - (m - i)] == "0":
current -= m - i
ans.append(str(m - i))
break
if ... | false | 28 | [
"+import sys",
"+",
"-cursor = n",
"-actualfail = 0",
"-while cursor != 0:",
"- if cursor <= m:",
"- ans.append(cursor)",
"- break",
"- failflag = 1",
"+current = n",
"+while current > 0:",
"- if s[cursor - m + i] == \"0\":",
"- failflag = 0",
"- ... | false | 0.040946 | 0.039898 | 1.02627 | [
"s479631203",
"s727264387"
] |
u102461423 | p03044 | python | s814894409 | s081485508 | 692 | 414 | 76,380 | 52,080 | Accepted | Accepted | 40.17 | import sys
sys.setrecursionlimit(10**6)
N = int(eval(input()))
edge = [[] for _ in range(N+1)]
for _ in range(N-1):
v1,v2,w = [int(x) for x in input().split()]
if w&1:
edge[v1].append((v2,-1))
edge[v2].append((v1,-1))
else:
edge[v1].append((v2,1))
edge[v2].append((v1,1))
colo... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
m = list(map(int,read().split()))
UVW = list(zip(m,m,m))
# 木が保証されているので、必ず実現できる
graph = [[] for _ in range(N+1)]
for u,v,w in UVW:
graph[u].append((v,w))
graph[... | 29 | 29 | 514 | 616 | import sys
sys.setrecursionlimit(10**6)
N = int(eval(input()))
edge = [[] for _ in range(N + 1)]
for _ in range(N - 1):
v1, v2, w = [int(x) for x in input().split()]
if w & 1:
edge[v1].append((v2, -1))
edge[v2].append((v1, -1))
else:
edge[v1].append((v2, 1))
edge[v2].append(... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
m = list(map(int, read().split()))
UVW = list(zip(m, m, m))
# 木が保証されているので、必ず実現できる
graph = [[] for _ in range(N + 1)]
for u, v, w in UVW:
graph[u].append((v, w))
graph[v].appen... | false | 0 | [
"-sys.setrecursionlimit(10**6)",
"-N = int(eval(input()))",
"-edge = [[] for _ in range(N + 1)]",
"-for _ in range(N - 1):",
"- v1, v2, w = [int(x) for x in input().split()]",
"- if w & 1:",
"- edge[v1].append((v2, -1))",
"- edge[v2].append((v1, -1))",
"- else:",
"- e... | false | 0.038533 | 0.048007 | 0.80266 | [
"s814894409",
"s081485508"
] |
u312025627 | p02972 | python | s765340926 | s295660934 | 409 | 308 | 90,568 | 69,724 | Accepted | Accepted | 24.69 |
n = int(eval(input()))
a = [0] + [int(i) for i in input().split()]
retval = [0] * (n+1)
for i in range(n,0,-1):
p = sum([retval[x] for x in range(i+i,n+1,i)])
retval[i] = (p%2) ^ a[i]
print((sum(retval)))
print((" ".join(str(i) for i in range(1,n+1) if retval[i])))
| def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [0]*N
for i in range(N)[::-1]:
cur_sum = -B[i]
for j in range(i, N, i+1):
cur_sum += B[j]
if cur_sum % 2 != A[i] % 2:
B[i] = 1
# print(B)
ans = [i+1 for i, b in... | 11 | 19 | 277 | 433 | n = int(eval(input()))
a = [0] + [int(i) for i in input().split()]
retval = [0] * (n + 1)
for i in range(n, 0, -1):
p = sum([retval[x] for x in range(i + i, n + 1, i)])
retval[i] = (p % 2) ^ a[i]
print((sum(retval)))
print((" ".join(str(i) for i in range(1, n + 1) if retval[i])))
| def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [0] * N
for i in range(N)[::-1]:
cur_sum = -B[i]
for j in range(i, N, i + 1):
cur_sum += B[j]
if cur_sum % 2 != A[i] % 2:
B[i] = 1
# print(B)
ans = [i + 1 for i, b in enum... | false | 42.105263 | [
"-n = int(eval(input()))",
"-a = [0] + [int(i) for i in input().split()]",
"-retval = [0] * (n + 1)",
"-for i in range(n, 0, -1):",
"- p = sum([retval[x] for x in range(i + i, n + 1, i)])",
"- retval[i] = (p % 2) ^ a[i]",
"-print((sum(retval)))",
"-print((\" \".join(str(i) for i in range(1, n + ... | false | 0.037839 | 0.04016 | 0.942209 | [
"s765340926",
"s295660934"
] |
u753803401 | p02948 | python | s671181669 | s746597229 | 1,690 | 1,560 | 106,588 | 95,196 | Accepted | Accepted | 7.69 | def slove():
import sys, heapq
input = sys.stdin.readline
n, m = list(map(int, input().rstrip('\n').split()))
ab = [list(map(int, input().rstrip('\n').split())) for _ in range(n)]
heapq.heapify(ab)
s_q = []
heapq.heapify(s_q)
r = 0
for d in range(1, m + 1):
while Tr... | def slove():
import sys
import heapq
input = sys.stdin.readline
n, m = list(map(int, input().rstrip('\n').split()))
l = [list(map(int, input().rstrip('\n').split())) for _ in range(n)]
r = []
heapq.heapify(l)
heapq.heapify(r)
t = 0
for i in range(m + 1):
while ... | 29 | 28 | 768 | 726 | def slove():
import sys, heapq
input = sys.stdin.readline
n, m = list(map(int, input().rstrip("\n").split()))
ab = [list(map(int, input().rstrip("\n").split())) for _ in range(n)]
heapq.heapify(ab)
s_q = []
heapq.heapify(s_q)
r = 0
for d in range(1, m + 1):
while True:
... | def slove():
import sys
import heapq
input = sys.stdin.readline
n, m = list(map(int, input().rstrip("\n").split()))
l = [list(map(int, input().rstrip("\n").split())) for _ in range(n)]
r = []
heapq.heapify(l)
heapq.heapify(r)
t = 0
for i in range(m + 1):
while True:
... | false | 3.448276 | [
"- import sys, heapq",
"+ import sys",
"+ import heapq",
"- ab = [list(map(int, input().rstrip(\"\\n\").split())) for _ in range(n)]",
"- heapq.heapify(ab)",
"- s_q = []",
"- heapq.heapify(s_q)",
"- r = 0",
"- for d in range(1, m + 1):",
"+ l = [list(map(int, input().... | false | 0.035109 | 0.032653 | 1.075198 | [
"s671181669",
"s746597229"
] |
u738898077 | p02803 | python | s470040750 | s788378769 | 930 | 773 | 12,440 | 12,440 | Accepted | Accepted | 16.88 | import numpy as np
from collections import deque
h,w = list(map(int,input().split()))
s =["#"*(w+2)] + ["#" + str(eval(input())) + "#" for i in range(h)] + ["#"*(w+2)]
s = np.array(s)
opt = [(1,0),(0,1),(-1,0),(0,-1)]
ans = 0
for i in range(h+2):
for j in range(w+2):
temp = [[0]*(w+2) for i in ra... | import numpy as np
from collections import deque
h,w = list(map(int,input().split()))
s =["#"*(w+2)] + ["#" + str(eval(input())) + "#" for i in range(h)] + ["#"*(w+2)]
s = np.array(s)
opt = [(1,0),(0,1),(-1,0),(0,-1)]
ans = 0
for i in range(h+2):
for j in range(w+2):
if s[i][j] == ".":
... | 29 | 24 | 955 | 775 | import numpy as np
from collections import deque
h, w = list(map(int, input().split()))
s = (
["#" * (w + 2)]
+ ["#" + str(eval(input())) + "#" for i in range(h)]
+ ["#" * (w + 2)]
)
s = np.array(s)
opt = [(1, 0), (0, 1), (-1, 0), (0, -1)]
ans = 0
for i in range(h + 2):
for j in range(w + 2):
t... | import numpy as np
from collections import deque
h, w = list(map(int, input().split()))
s = (
["#" * (w + 2)]
+ ["#" + str(eval(input())) + "#" for i in range(h)]
+ ["#" * (w + 2)]
)
s = np.array(s)
opt = [(1, 0), (0, 1), (-1, 0), (0, -1)]
ans = 0
for i in range(h + 2):
for j in range(w + 2):
i... | false | 17.241379 | [
"- temp = [[0] * (w + 2) for i in range(h + 2)]",
"- temp[i][j] = 1",
"- dq = deque([(i, j)])",
"- while dq:",
"- x, y = dq.popleft()",
"- if s[x][y] == \".\":",
"+ if s[i][j] == \".\":",
"+ temp = [[0] * (w + 2) for i in range(h + 2)... | false | 0.207945 | 0.208875 | 0.995548 | [
"s470040750",
"s788378769"
] |
u720483676 | p03107 | python | s559461784 | s681696551 | 32 | 20 | 3,188 | 3,188 | Accepted | Accepted | 37.5 | s=eval(input())
zero=0
one=0
for i in s:
if(i=='0'):
zero+=1
elif(i=='1'):
one+=1
print((min(one,zero)*2)) | s=eval(input())
print((min(s.count("1"),s.count("0"))*2)) | 9 | 2 | 118 | 50 | s = eval(input())
zero = 0
one = 0
for i in s:
if i == "0":
zero += 1
elif i == "1":
one += 1
print((min(one, zero) * 2))
| s = eval(input())
print((min(s.count("1"), s.count("0")) * 2))
| false | 77.777778 | [
"-zero = 0",
"-one = 0",
"-for i in s:",
"- if i == \"0\":",
"- zero += 1",
"- elif i == \"1\":",
"- one += 1",
"-print((min(one, zero) * 2))",
"+print((min(s.count(\"1\"), s.count(\"0\")) * 2))"
] | false | 0.116197 | 0.04 | 2.904962 | [
"s559461784",
"s681696551"
] |
u165394332 | p02687 | python | s972818832 | s256892513 | 23 | 21 | 8,952 | 9,028 | Accepted | Accepted | 8.7 | S = eval(input())
print(("ABC" if S == "ARC" else "ARC"))
| S = eval(input())
if S == "ABC":
print("ARC")
else:
print("ABC")
| 2 | 5 | 51 | 67 | S = eval(input())
print(("ABC" if S == "ARC" else "ARC"))
| S = eval(input())
if S == "ABC":
print("ARC")
else:
print("ABC")
| false | 60 | [
"-print((\"ABC\" if S == \"ARC\" else \"ARC\"))",
"+if S == \"ABC\":",
"+ print(\"ARC\")",
"+else:",
"+ print(\"ABC\")"
] | false | 0.084052 | 0.043474 | 1.933369 | [
"s972818832",
"s256892513"
] |
u923668099 | p02363 | python | s706223961 | s727710285 | 730 | 520 | 8,596 | 8,532 | Accepted | Accepted | 28.77 | import sys
from operator import itemgetter
inf = 1<<60
def solve():
N, M = list(map(int, sys.stdin.readline().split()))
cost = [[inf]*N for i in range(N)]
for u in range(N):
cost[u][u] = 0
for i in range(M):
si, ti, di = list(map(int, sys.stdin.readline().split()))
... | import sys
inf = float('inf')
def solve():
N, M = list(map(int, sys.stdin.readline().split()))
cost = [[inf]*N for i in range(N)]
for u in range(N):
cost[u][u] = 0
for i in range(M):
si, ti, di = list(map(int, sys.stdin.readline().split()))
cost[si][ti] = di
... | 45 | 43 | 1,070 | 981 | import sys
from operator import itemgetter
inf = 1 << 60
def solve():
N, M = list(map(int, sys.stdin.readline().split()))
cost = [[inf] * N for i in range(N)]
for u in range(N):
cost[u][u] = 0
for i in range(M):
si, ti, di = list(map(int, sys.stdin.readline().split()))
cost[si... | import sys
inf = float("inf")
def solve():
N, M = list(map(int, sys.stdin.readline().split()))
cost = [[inf] * N for i in range(N)]
for u in range(N):
cost[u][u] = 0
for i in range(M):
si, ti, di = list(map(int, sys.stdin.readline().split()))
cost[si][ti] = di
res = Warsha... | false | 4.444444 | [
"-from operator import itemgetter",
"-inf = 1 << 60",
"+inf = float(\"inf\")",
"- if dist[i][k] < inf and dist[k][j] < inf:",
"- dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])",
"+ dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])"
] | false | 0.044308 | 0.049701 | 0.8915 | [
"s706223961",
"s727710285"
] |
u145950990 | p03721 | python | s648301186 | s560409130 | 874 | 480 | 61,528 | 32,476 | Accepted | Accepted | 45.08 | n,k = list(map(int,input().split()))
x = sorted([list(map(int,input().split())) for i in range(n)])
for i,j in x:
k -= j
if k<=0:
print(i)
exit() | n,k = list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(n)]
ab.sort()
b = [0]
for i in ab:
b.append(b[-1]+i[1])
i = 0
while b[i]<k:
i += 1
print((ab[i-1][0])) | 7 | 10 | 169 | 200 | n, k = list(map(int, input().split()))
x = sorted([list(map(int, input().split())) for i in range(n)])
for i, j in x:
k -= j
if k <= 0:
print(i)
exit()
| n, k = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort()
b = [0]
for i in ab:
b.append(b[-1] + i[1])
i = 0
while b[i] < k:
i += 1
print((ab[i - 1][0]))
| false | 30 | [
"-x = sorted([list(map(int, input().split())) for i in range(n)])",
"-for i, j in x:",
"- k -= j",
"- if k <= 0:",
"- print(i)",
"- exit()",
"+ab = [list(map(int, input().split())) for i in range(n)]",
"+ab.sort()",
"+b = [0]",
"+for i in ab:",
"+ b.append(b[-1] + i[1])",
... | false | 0.04515 | 0.03621 | 1.246898 | [
"s648301186",
"s560409130"
] |
u585482323 | p04017 | python | s271091820 | s678961892 | 1,743 | 701 | 43,936 | 120,728 | Accepted | Accepted | 59.78 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
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 sys.stdin.readline()... | 94 | 65 | 1,852 | 1,494 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(m... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
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 sys.stdin... | false | 30.851064 | [
"-from collections import defaultdict",
"-from collections import deque",
"+from collections import defaultdict, deque",
"- return list(map(int, sys.stdin.readline().split()))",
"+ return [int(x) for x in sys.stdin.readline().split()]",
"- return list(map(list, sys.stdin.readline().split()))",
... | false | 0.039926 | 0.039095 | 1.021261 | [
"s271091820",
"s678961892"
] |
u537782349 | p03962 | python | s181101745 | s966891421 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | a = list(map(int, ("0 " + eval(input())).split()))
b = 0
a.sort()
for i in range(1, 4):
if a[i] != a[i-1]:
b += 1
print(b)
| a = {}
for i in list(map(int, input().split())):
a[i] = 1
print((len(a)))
| 7 | 4 | 135 | 79 | a = list(map(int, ("0 " + eval(input())).split()))
b = 0
a.sort()
for i in range(1, 4):
if a[i] != a[i - 1]:
b += 1
print(b)
| a = {}
for i in list(map(int, input().split())):
a[i] = 1
print((len(a)))
| false | 42.857143 | [
"-a = list(map(int, (\"0 \" + eval(input())).split()))",
"-b = 0",
"-a.sort()",
"-for i in range(1, 4):",
"- if a[i] != a[i - 1]:",
"- b += 1",
"-print(b)",
"+a = {}",
"+for i in list(map(int, input().split())):",
"+ a[i] = 1",
"+print((len(a)))"
] | false | 0.063545 | 0.046633 | 1.362649 | [
"s181101745",
"s966891421"
] |
u179169725 | p03178 | python | s841763687 | s404476735 | 1,424 | 913 | 131,660 | 131,140 | Accepted | Accepted | 35.88 | import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline # 文字列読み込む時はこっち
import numpy as np
from functools import partial
array = partial(np.array, dtype=np.int64)
zeros = partial(np.zeros, dtype=np.int64)
full = partial(np.full, dtype=np.int64)
ra = range
e... | import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline # 文字列読み込む時はこっち
import numpy as np
from functools import partial
array = partial(np.array, dtype=np.int64)
zeros = partial(np.zeros, dtype=np.int64)
full = partial(np.full, dtype=np.int64)
ra = range
e... | 71 | 71 | 1,951 | 1,941 | import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline # 文字列読み込む時はこっち
import numpy as np
from functools import partial
array = partial(np.array, dtype=np.int64)
zeros = partial(np.zeros, dtype=np.int64)
full = partial(np.full, dtype=np.int64)
ra = range
enu = enumera... | import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline # 文字列読み込む時はこっち
import numpy as np
from functools import partial
array = partial(np.array, dtype=np.int64)
zeros = partial(np.zeros, dtype=np.int64)
full = partial(np.full, dtype=np.int64)
ra = range
enu = enumera... | false | 0 | [
"- dp[i + 1, 0, (k + l) % D] += dp[i, 1, k] # 1~9を考慮可能",
"+ dp[i + 1, 0, (k + l) % D] += dp[i, 1, k]",
"- dp[i + 1, 1, (k + K[i]) % D] %= MOD",
"+ # dp[i + 1, 1, (k + K[i]) % D] %= MOD"
] | false | 0.586824 | 0.192512 | 3.048255 | [
"s841763687",
"s404476735"
] |
u498487134 | p02918 | python | s172519298 | s758136516 | 179 | 70 | 39,408 | 67,212 | Accepted | Accepted | 60.89 | N, K = list(map(int, input().split()))
S=eval(input())
ch=0
for i in range(N-1):
if S[i]!=S[i+1]:
ch+=1
print((min(N-1,N-ch-1+2*K))) |
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N,K=MI()
S=eval(input())
ans=0
now="A"
for i in range(N):
if S[i]==now:
ans+=1
now=S[i]
... | 8 | 22 | 138 | 371 | N, K = list(map(int, input().split()))
S = eval(input())
ch = 0
for i in range(N - 1):
if S[i] != S[i + 1]:
ch += 1
print((min(N - 1, N - ch - 1 + 2 * K)))
| def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N, K = MI()
S = eval(input())
ans = 0
now = "A"
for i in range(N):
if S[i] == now:
ans += 1
... | false | 63.636364 | [
"-N, K = list(map(int, input().split()))",
"-S = eval(input())",
"-ch = 0",
"-for i in range(N - 1):",
"- if S[i] != S[i + 1]:",
"- ch += 1",
"-print((min(N - 1, N - ch - 1 + 2 * K)))",
"+def I():",
"+ return int(eval(input()))",
"+",
"+",
"+def MI():",
"+ return list(map(int... | false | 0.037429 | 0.037719 | 0.992305 | [
"s172519298",
"s758136516"
] |
u708255304 | p02623 | python | s789333675 | s966644026 | 358 | 198 | 47,344 | 132,780 | Accepted | Accepted | 44.69 | import bisect
# listのpopを使う
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
# 純粋に小さい方を読んでいく
ans = 0
# 1番上しか読めない
# while K >= A[0] or K >= B[0]:
# if A[0]
cumulative_sum_of_A = [0]
cumulative_sum_of_B = [0]
for i in range(N):
cumulati... | from bisect import bisect_left, bisect_right
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ruisekiwa_of_A = [0]
ruisekiwa_of_B = [0]
for a in A:
ruisekiwa_of_A.append(ruisekiwa_of_A[-1]+a)
for b in B:
ruisekiwa_of_B.append(ruisekiwa_... | 32 | 22 | 853 | 563 | import bisect
# listのpopを使う
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
# 純粋に小さい方を読んでいく
ans = 0
# 1番上しか読めない
# while K >= A[0] or K >= B[0]:
# if A[0]
cumulative_sum_of_A = [0]
cumulative_sum_of_B = [0]
for i in range(N):
cumulative_sum_of_A.... | from bisect import bisect_left, bisect_right
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ruisekiwa_of_A = [0]
ruisekiwa_of_B = [0]
for a in A:
ruisekiwa_of_A.append(ruisekiwa_of_A[-1] + a)
for b in B:
ruisekiwa_of_B.append(ruisekiwa_of_B[-1]... | false | 31.25 | [
"-import bisect",
"+from bisect import bisect_left, bisect_right",
"-# listのpopを使う",
"-# 純粋に小さい方を読んでいく",
"-ans = 0",
"-# 1番上しか読めない",
"-# while K >= A[0] or K >= B[0]:",
"-# if A[0]",
"-cumulative_sum_of_A = [0]",
"-cumulative_sum_of_B = [0]",
"-for i in range(N):",
"- cumulative_sum_of_... | false | 0.039179 | 0.048006 | 0.81612 | [
"s789333675",
"s966644026"
] |
u945181840 | p03682 | python | s898957555 | s901004225 | 1,869 | 1,404 | 70,416 | 71,516 | Accepted | Accepted | 24.88 | import sys
import numpy as np
read = sys.stdin.read
class UnionFind():
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
def __init__(self, n):
self.n = n
# root[x]<0ならそのノードが根かつその値が木の要素数
# rootノードでその木の要素数を記録する
self.root = [-1]*(n+1)
# 木をくっつける時にアンバランスにならないように調整する
... | import sys
import numpy as np
read = sys.stdin.read
class UnionFind():
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
def __init__(self, n):
self.n = n
# root[x]<0ならそのノードが根かつその値が木の要素数
# rootノードでその木の要素数を記録する
self.root = [-1]*(n+1)
# 木をくっつける時にアンバランスにならないように調整する
... | 80 | 83 | 1,996 | 2,062 | import sys
import numpy as np
read = sys.stdin.read
class UnionFind:
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
def __init__(self, n):
self.n = n
# root[x]<0ならそのノードが根かつその値が木の要素数
# rootノードでその木の要素数を記録する
self.root = [-1] * (n + 1)
# 木をくっつける時にアンバランスにならないように調整する
self.rnk... | import sys
import numpy as np
read = sys.stdin.read
class UnionFind:
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
def __init__(self, n):
self.n = n
# root[x]<0ならそのノードが根かつその値が木の要素数
# rootノードでその木の要素数を記録する
self.root = [-1] * (n + 1)
# 木をくっつける時にアンバランスにならないように調整する
self.rnk... | false | 3.614458 | [
"-edges_x = xy[arg_x[1:], 0] - xy[arg_x[:-1], 0]",
"-town_x = list(zip(town[arg_x[1:]], town[arg_x[:-1]]))",
"-edges_y = xy[arg_y[1:], 1] - xy[arg_y[:-1], 1]",
"-town_y = list(zip(town[arg_y[1:]], town[arg_y[:-1]]))",
"+edges_x = (xy[arg_x[1:], 0] - xy[arg_x[:-1], 0]).tolist()",
"+town_x = town[arg_x].tol... | false | 0.245288 | 0.252352 | 0.972008 | [
"s898957555",
"s901004225"
] |
u422291726 | p03078 | python | s196344169 | s371228266 | 113 | 39 | 7,828 | 4,340 | Accepted | Accepted | 65.49 | from heapq import heappush, heappop
X, Y, Z, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)
cake_heap = []
for i in range(len(A)):
if i + 1 > ... | from heapq import heappush, heappop
X, Y, Z, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)
h = []
minus_value = -(A[0] + B[0] + C[0])
heappush(h,... | 20 | 25 | 628 | 823 | from heapq import heappush, heappop
X, Y, Z, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)
cake_heap = []
for i in range(len(A)):
if i + 1 > K:
... | from heapq import heappush, heappop
X, Y, Z, K = list(map(int, input().split()))
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)
h = []
minus_value = -(A[0] + B[0] + C[0])
heappush(h, (minus_va... | false | 20 | [
"-cake_heap = []",
"-for i in range(len(A)):",
"- if i + 1 > K:",
"- break",
"- for j in range(len(B)):",
"- if (i + 1) * (j + 1) > K:",
"- break",
"- for k in range(len(C)):",
"- if (i + 1) * (j + 1) * (k + 1) > K:",
"- break",
"- ... | false | 0.055614 | 0.03697 | 1.504288 | [
"s196344169",
"s371228266"
] |
u359856428 | p03146 | python | s304359873 | s298096071 | 1,782 | 17 | 3,864 | 2,940 | Accepted | Accepted | 99.05 | nums = []
nums.append(int(eval(input())))
for i in range(1,100000):
if nums[i - 1] % 2 == 0:
nums.append(nums[i - 1] // 2)
else:
nums.append(nums[i - 1] * 3 + 1)
for i in range(100000):
for j in range(i + 1,100000):
if nums[i] == nums[j]:
print((j + 1))
... | def f(n):
return n // 2 if n % 2 == 0 else n * 3 + 1
s = int(eval(input()))
count = 1
while True:
if s == 1 or s == 2 or s == 4:
print((count + 3))
break
else:
s = f(s)
count += 1
| 17 | 13 | 366 | 230 | nums = []
nums.append(int(eval(input())))
for i in range(1, 100000):
if nums[i - 1] % 2 == 0:
nums.append(nums[i - 1] // 2)
else:
nums.append(nums[i - 1] * 3 + 1)
for i in range(100000):
for j in range(i + 1, 100000):
if nums[i] == nums[j]:
print((j + 1))
brea... | def f(n):
return n // 2 if n % 2 == 0 else n * 3 + 1
s = int(eval(input()))
count = 1
while True:
if s == 1 or s == 2 or s == 4:
print((count + 3))
break
else:
s = f(s)
count += 1
| false | 23.529412 | [
"-nums = []",
"-nums.append(int(eval(input())))",
"-for i in range(1, 100000):",
"- if nums[i - 1] % 2 == 0:",
"- nums.append(nums[i - 1] // 2)",
"+def f(n):",
"+ return n // 2 if n % 2 == 0 else n * 3 + 1",
"+",
"+",
"+s = int(eval(input()))",
"+count = 1",
"+while True:",
"+ ... | false | 0.984785 | 0.05125 | 19.215365 | [
"s304359873",
"s298096071"
] |
u373047809 | p03558 | python | s739522326 | s709332583 | 237 | 153 | 30,580 | 24,316 | Accepted | Accepted | 35.44 | #!/usr/bin/env python3
from collections import deque
INF = 10**9
k = int(eval(input()))
# (辺の伸びる先, コスト)
G = [((10 * i % k, 0), ((i + 1) % k, 1)) for i in range(k)]
s = 1
# 01 - BFS
dist = [INF] * k
S = deque([s])
T = deque()
dist[s] = 0
d = 0
while S:
while S:
v = S.popleft()
... | from collections import*
q=deque([(1,1)])
k=int(eval(input()))
m={}
while q:
n,s=q.pop()
if(n in m)-1:m[n]=s;q+=(n*10%k,s),;q.appendleft((-~n%k,s+1))
print((m[0])) | 31 | 8 | 561 | 164 | #!/usr/bin/env python3
from collections import deque
INF = 10**9
k = int(eval(input()))
# (辺の伸びる先, コスト)
G = [((10 * i % k, 0), ((i + 1) % k, 1)) for i in range(k)]
s = 1
# 01 - BFS
dist = [INF] * k
S = deque([s])
T = deque()
dist[s] = 0
d = 0
while S:
while S:
v = S.popleft()
for w, c in G[v]:
... | from collections import *
q = deque([(1, 1)])
k = int(eval(input()))
m = {}
while q:
n, s = q.pop()
if (n in m) - 1:
m[n] = s
q += ((n * 10 % k, s),)
q.appendleft((-~n % k, s + 1))
print((m[0]))
| false | 74.193548 | [
"-#!/usr/bin/env python3",
"-from collections import deque",
"+from collections import *",
"-INF = 10**9",
"+q = deque([(1, 1)])",
"-# (辺の伸びる先, コスト)",
"-G = [((10 * i % k, 0), ((i + 1) % k, 1)) for i in range(k)]",
"-s = 1",
"-# 01 - BFS",
"-dist = [INF] * k",
"-S = deque([s])",
"-T = deque()"... | false | 0.061286 | 0.051003 | 1.201611 | [
"s739522326",
"s709332583"
] |
u658288444 | p02711 | python | s871854966 | s164815322 | 29 | 26 | 8,992 | 9,088 | Accepted | Accepted | 10.34 | def resolve():
n = eval(input())
if n[0] == '7' or n[1] == '7' or n[2] == '7':
print('Yes')
else:
print('No')
resolve() | n = eval(input())
if '7' in n:
print('Yes')
else:
print('No') | 7 | 5 | 147 | 63 | def resolve():
n = eval(input())
if n[0] == "7" or n[1] == "7" or n[2] == "7":
print("Yes")
else:
print("No")
resolve()
| n = eval(input())
if "7" in n:
print("Yes")
else:
print("No")
| false | 28.571429 | [
"-def resolve():",
"- n = eval(input())",
"- if n[0] == \"7\" or n[1] == \"7\" or n[2] == \"7\":",
"- print(\"Yes\")",
"- else:",
"- print(\"No\")",
"-",
"-",
"-resolve()",
"+n = eval(input())",
"+if \"7\" in n:",
"+ print(\"Yes\")",
"+else:",
"+ print(\"No\")"... | false | 0.048242 | 0.19283 | 0.25018 | [
"s871854966",
"s164815322"
] |
u752906728 | p03447 | python | s065700855 | s253233461 | 1,712 | 918 | 3,056 | 3,056 | Accepted | Accepted | 46.38 | from time import sleep
x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
ans = (x - a) % b
sleep(ans * 0.002)
print(ans) | from time import sleep
x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
ans = (x - a) % b
sleep((a%10) * 0.1)
print(ans) | 11 | 11 | 135 | 136 | from time import sleep
x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
ans = (x - a) % b
sleep(ans * 0.002)
print(ans)
| from time import sleep
x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
ans = (x - a) % b
sleep((a % 10) * 0.1)
print(ans)
| false | 0 | [
"-sleep(ans * 0.002)",
"+sleep((a % 10) * 0.1)"
] | false | 0.334513 | 0.507575 | 0.659041 | [
"s065700855",
"s253233461"
] |
u929569377 | p03495 | python | s914356303 | s923369203 | 151 | 128 | 35,616 | 35,616 | Accepted | Accepted | 15.23 | N, K = list(map(int, input().split()))
A = input().split()
D = {}
for i in range(N):
if A[i] in list(D.keys()):
D[A[i]] += 1
else:
D[A[i]] = 1
ans = 0
if len(D) > K:
D = sorted(D.values())
for i in range(len(D) - K):
ans += D[i]
print(ans) | N, K = list(map(int, input().split()))
A = input().split()
D = {}
for i in range(N):
if A[i] in list(D.keys()):
D[A[i]] += 1
else:
D[A[i]] = 1
ans = 0
if len(D) > K:
D = sorted(list(D.values()),reverse = True)
ans = sum(D[K:])
print(ans) | 17 | 16 | 256 | 245 | N, K = list(map(int, input().split()))
A = input().split()
D = {}
for i in range(N):
if A[i] in list(D.keys()):
D[A[i]] += 1
else:
D[A[i]] = 1
ans = 0
if len(D) > K:
D = sorted(D.values())
for i in range(len(D) - K):
ans += D[i]
print(ans)
| N, K = list(map(int, input().split()))
A = input().split()
D = {}
for i in range(N):
if A[i] in list(D.keys()):
D[A[i]] += 1
else:
D[A[i]] = 1
ans = 0
if len(D) > K:
D = sorted(list(D.values()), reverse=True)
ans = sum(D[K:])
print(ans)
| false | 5.882353 | [
"- D = sorted(D.values())",
"- for i in range(len(D) - K):",
"- ans += D[i]",
"+ D = sorted(list(D.values()), reverse=True)",
"+ ans = sum(D[K:])"
] | false | 0.045514 | 0.047276 | 0.962717 | [
"s914356303",
"s923369203"
] |
u243535639 | p03290 | python | s710641918 | s169227873 | 1,297 | 202 | 42,504 | 41,456 | Accepted | Accepted | 84.43 | import math
import itertools
import sys
input = sys.stdin.readline
def main():
D, G = list(map(int, input().split()))
spc_list = [[(i+1) * 100] + [int(v) for v in input().split()] for i in range(D)]
max_scores = [spc[0] * spc[1] + spc[2] for spc in spc_list]
min_q = float("inf")
for q_lis... | import math
def dfs(i, sum, count, remain, d, g, pc):
global ans
if i == d:
if sum < g:
q = max(remain)
n = min(pc[q][0] - 1, math.ceil((g - sum) / (100 * (q + 1))))
#n = min(pc[q][0], -(-(g - sum) // ((q + 1) * 100)))
count += n
sum... | 37 | 27 | 1,141 | 822 | import math
import itertools
import sys
input = sys.stdin.readline
def main():
D, G = list(map(int, input().split()))
spc_list = [[(i + 1) * 100] + [int(v) for v in input().split()] for i in range(D)]
max_scores = [spc[0] * spc[1] + spc[2] for spc in spc_list]
min_q = float("inf")
for q_list in i... | import math
def dfs(i, sum, count, remain, d, g, pc):
global ans
if i == d:
if sum < g:
q = max(remain)
n = min(pc[q][0] - 1, math.ceil((g - sum) / (100 * (q + 1))))
# n = min(pc[q][0], -(-(g - sum) // ((q + 1) * 100)))
count += n
sum += 100 ... | false | 27.027027 | [
"-import itertools",
"-import sys",
"-",
"-input = sys.stdin.readline",
"-def main():",
"- D, G = list(map(int, input().split()))",
"- spc_list = [[(i + 1) * 100] + [int(v) for v in input().split()] for i in range(D)]",
"- max_scores = [spc[0] * spc[1] + spc[2] for spc in spc_list]",
"- ... | false | 0.042841 | 0.042556 | 1.006698 | [
"s710641918",
"s169227873"
] |
u934442292 | p02861 | python | s812388387 | s428911512 | 455 | 18 | 3,188 | 3,064 | Accepted | Accepted | 96.04 | import itertools
N = int(eval(input()))
xy = [[0.0, 0.0]] * N
for i in range(N):
xy[i] = list(map(int, input().split()))
def distance(a, b):
res = (a[0]-b[0])**2 + (a[1]-b[1])**2
return res ** 0.5
ans = 0.0
cnt = 0
perms = itertools.permutations(list(range(N)))
for perm in perms:
cnt += 1
... | import itertools
N = int(eval(input()))
xy = [[0.0, 0.0]] * N
for i in range(N):
xy[i] = list(map(int, input().split()))
def distance(a, b):
res = (a[0]-b[0])**2 + (a[1]-b[1])**2
return res ** 0.5
ans = 0.0
combs = itertools.combinations(list(range(N)), 2)
for comb in combs:
ans += distance(x... | 23 | 18 | 427 | 366 | import itertools
N = int(eval(input()))
xy = [[0.0, 0.0]] * N
for i in range(N):
xy[i] = list(map(int, input().split()))
def distance(a, b):
res = (a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2
return res**0.5
ans = 0.0
cnt = 0
perms = itertools.permutations(list(range(N)))
for perm in perms:
cnt += 1
... | import itertools
N = int(eval(input()))
xy = [[0.0, 0.0]] * N
for i in range(N):
xy[i] = list(map(int, input().split()))
def distance(a, b):
res = (a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2
return res**0.5
ans = 0.0
combs = itertools.combinations(list(range(N)), 2)
for comb in combs:
ans += distance(x... | false | 21.73913 | [
"-cnt = 0",
"-perms = itertools.permutations(list(range(N)))",
"-for perm in perms:",
"- cnt += 1",
"- for j in range(N - 1):",
"- a = perm[j]",
"- b = perm[j + 1]",
"- ans += distance(xy[a], xy[b])",
"-ans /= cnt",
"+combs = itertools.combinations(list(range(N)), 2)",
... | false | 0.03401 | 0.039291 | 0.865596 | [
"s812388387",
"s428911512"
] |
u461454424 | p02910 | python | s319551868 | s245823424 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | S = eval(input())
S1 = S[0::2]
S2 = S[1::2]
if ("R" in S2) or ("L" in S1):
print("No")
else:
print("Yes") | #input
S = eval(input())
#output
if ("L" in S[0::2]) or ("R" in S[1::2]):
print("No")
else:
print("Yes") | 9 | 8 | 117 | 114 | S = eval(input())
S1 = S[0::2]
S2 = S[1::2]
if ("R" in S2) or ("L" in S1):
print("No")
else:
print("Yes")
| # input
S = eval(input())
# output
if ("L" in S[0::2]) or ("R" in S[1::2]):
print("No")
else:
print("Yes")
| false | 11.111111 | [
"+# input",
"-S1 = S[0::2]",
"-S2 = S[1::2]",
"-if (\"R\" in S2) or (\"L\" in S1):",
"+# output",
"+if (\"L\" in S[0::2]) or (\"R\" in S[1::2]):"
] | false | 0.034454 | 0.036332 | 0.948314 | [
"s319551868",
"s245823424"
] |
u933341648 | p03240 | python | s446803603 | s037548023 | 112 | 29 | 3,064 | 3,064 | Accepted | Accepted | 74.11 | import sys
n = int(eval(input()))
point = [tuple(map(int, input().split())) for i in range(n)]
for p in range(101):
for q in range(101):
for x, y, h in point:
if h > 0:
H = h + abs(x-p) + abs(y-q)
break
for x, y, h in point:
... | import sys
n = int(eval(input()))
data = [tuple(map(int, input().split())) for i in range(n)]
for d in data:
if d[2] != 0:
_x = d[0]
_y = d[1]
_h = d[2]
for x in range(101):
for y in range(101):
h = _h + abs(_x-x) + abs(_y-y)
for d in data:
t... | 18 | 23 | 448 | 535 | import sys
n = int(eval(input()))
point = [tuple(map(int, input().split())) for i in range(n)]
for p in range(101):
for q in range(101):
for x, y, h in point:
if h > 0:
H = h + abs(x - p) + abs(y - q)
break
for x, y, h in point:
if max(H - abs... | import sys
n = int(eval(input()))
data = [tuple(map(int, input().split())) for i in range(n)]
for d in data:
if d[2] != 0:
_x = d[0]
_y = d[1]
_h = d[2]
for x in range(101):
for y in range(101):
h = _h + abs(_x - x) + abs(_y - y)
for d in data:
tmp_x = d[0]
... | false | 21.73913 | [
"-point = [tuple(map(int, input().split())) for i in range(n)]",
"-for p in range(101):",
"- for q in range(101):",
"- for x, y, h in point:",
"- if h > 0:",
"- H = h + abs(x - p) + abs(y - q)",
"- break",
"- for x, y, h in point:",
"- ... | false | 0.084161 | 0.041092 | 2.048124 | [
"s446803603",
"s037548023"
] |
u744920373 | p03409 | python | s698604945 | s322816596 | 33 | 29 | 9,208 | 9,192 | Accepted | Accepted | 12.12 | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): ret... | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): ret... | 96 | 34 | 2,303 | 990 | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
de... | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
de... | false | 64.583333 | [
"-\"\"\"",
"-A = sorted(A, key=lambda x:x[0])",
"-B = sorted(B, key=lambda x:x[0])",
"-a_ind = 0",
"-b_ind = 0",
"-cnt = 0",
"-while b_ind < N:",
"- if A[a_ind][0] < B[b_ind][0] and A[a_ind][1] < B[b_ind][1]:",
"- cnt += 1",
"- a_ind += 1",
"- b_ind += 1",
"- else:"... | false | 0.046986 | 0.035775 | 1.31336 | [
"s698604945",
"s322816596"
] |
u562935282 | p03227 | python | s053235668 | s271448474 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | s = eval(input())
if len(s) == 2:
print(s)
else:
t = ''
for i in range(1, len(s) + 1):
t += s[(-1) * i]
print(t)
| s = eval(input())
print((s if len(s) == 2 else s[::-1])) | 8 | 2 | 138 | 49 | s = eval(input())
if len(s) == 2:
print(s)
else:
t = ""
for i in range(1, len(s) + 1):
t += s[(-1) * i]
print(t)
| s = eval(input())
print((s if len(s) == 2 else s[::-1]))
| false | 75 | [
"-if len(s) == 2:",
"- print(s)",
"-else:",
"- t = \"\"",
"- for i in range(1, len(s) + 1):",
"- t += s[(-1) * i]",
"- print(t)",
"+print((s if len(s) == 2 else s[::-1]))"
] | false | 0.039349 | 0.043764 | 0.899115 | [
"s053235668",
"s271448474"
] |
u241159583 | p03607 | python | s182598661 | s216595331 | 188 | 171 | 19,468 | 20,568 | Accepted | Accepted | 9.04 | N = int(eval(input()))
A = [eval(input()) for _ in range(N)]
a = {}
for i in range(N):
if A[i] in a:
a[A[i]] += 1
else:
a[A[i]] = 1
ans = 0
for i in list(a.values()):
if i % 2 != 0:
ans += 1
print(ans) | n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
p = {}
for a in A:
if a in p:
if p[a] == 1:
p[a] = 0
continue
p[a] = 1
ans = 0
for i in list(p.values()):ans += i
print(ans) | 14 | 13 | 215 | 225 | N = int(eval(input()))
A = [eval(input()) for _ in range(N)]
a = {}
for i in range(N):
if A[i] in a:
a[A[i]] += 1
else:
a[A[i]] = 1
ans = 0
for i in list(a.values()):
if i % 2 != 0:
ans += 1
print(ans)
| n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
p = {}
for a in A:
if a in p:
if p[a] == 1:
p[a] = 0
continue
p[a] = 1
ans = 0
for i in list(p.values()):
ans += i
print(ans)
| false | 7.142857 | [
"-N = int(eval(input()))",
"-A = [eval(input()) for _ in range(N)]",
"-a = {}",
"-for i in range(N):",
"- if A[i] in a:",
"- a[A[i]] += 1",
"- else:",
"- a[A[i]] = 1",
"+n = int(eval(input()))",
"+A = [int(eval(input())) for _ in range(n)]",
"+p = {}",
"+for a in A:",
"+ ... | false | 0.041253 | 0.035663 | 1.156753 | [
"s182598661",
"s216595331"
] |
u539367121 | p02779 | python | s001292253 | s592510555 | 110 | 88 | 40,740 | 31,220 | Accepted | Accepted | 20 | N=int(eval(input()))
A=input().split()
S={}
for a in A:
if a in list(S.keys()):
print('NO')
break
S[a]=1
else:
print('YES') | n=int(eval(input()))
a=list(map(int,input().split()))
print(('YES' if len(a)==len(set(a)) else 'NO'))
| 10 | 3 | 134 | 97 | N = int(eval(input()))
A = input().split()
S = {}
for a in A:
if a in list(S.keys()):
print("NO")
break
S[a] = 1
else:
print("YES")
| n = int(eval(input()))
a = list(map(int, input().split()))
print(("YES" if len(a) == len(set(a)) else "NO"))
| false | 70 | [
"-N = int(eval(input()))",
"-A = input().split()",
"-S = {}",
"-for a in A:",
"- if a in list(S.keys()):",
"- print(\"NO\")",
"- break",
"- S[a] = 1",
"-else:",
"- print(\"YES\")",
"+n = int(eval(input()))",
"+a = list(map(int, input().split()))",
"+print((\"YES\" if l... | false | 0.036333 | 0.037239 | 0.975675 | [
"s001292253",
"s592510555"
] |
u148981246 | p03212 | python | s041611467 | s044872405 | 46 | 41 | 9,292 | 9,144 | Accepted | Accepted | 10.87 | import sys
sys.setrecursionlimit(10**7)
n = int(eval(input()))
def search(x, use, cnt):
if x > n:
return
if use == 0b111:
cnt.append(1)
search(x * 10 + 3, use | 0b100, cnt)
search(x * 10 + 5, use | 0b010, cnt)
search(x * 10 + 7, use | 0b001, cnt)
res = []
... | import sys
sys.setrecursionlimit(10**7)
n = int(eval(input()))
cnt = []
def search(x, use):
if x > n:
return
if use == 0b111:
cnt.append(1)
search(x * 10 + 3, use | 0b100)
search(x * 10 + 5, use | 0b010)
search(x * 10 + 7, use | 0b001)
search(0, 0)
print(... | 18 | 18 | 348 | 323 | import sys
sys.setrecursionlimit(10**7)
n = int(eval(input()))
def search(x, use, cnt):
if x > n:
return
if use == 0b111:
cnt.append(1)
search(x * 10 + 3, use | 0b100, cnt)
search(x * 10 + 5, use | 0b010, cnt)
search(x * 10 + 7, use | 0b001, cnt)
res = []
search(0, 0, res)
print... | import sys
sys.setrecursionlimit(10**7)
n = int(eval(input()))
cnt = []
def search(x, use):
if x > n:
return
if use == 0b111:
cnt.append(1)
search(x * 10 + 3, use | 0b100)
search(x * 10 + 5, use | 0b010)
search(x * 10 + 7, use | 0b001)
search(0, 0)
print((sum(cnt)))
| false | 0 | [
"+cnt = []",
"-def search(x, use, cnt):",
"+def search(x, use):",
"- search(x * 10 + 3, use | 0b100, cnt)",
"- search(x * 10 + 5, use | 0b010, cnt)",
"- search(x * 10 + 7, use | 0b001, cnt)",
"+ search(x * 10 + 3, use | 0b100)",
"+ search(x * 10 + 5, use | 0b010)",
"+ search(x * 10... | false | 0.043534 | 0.042918 | 1.014365 | [
"s041611467",
"s044872405"
] |
u558242240 | p03126 | python | s916195839 | s288185429 | 180 | 18 | 38,384 | 3,060 | Accepted | Accepted | 90 | n, m = list(map(int, input().split()))
aa = [0] * m
for _ in range(n):
tmp = list(map(int , input().split()))
for ai in tmp[1:]:
aa[ai-1] += 1
ans = 0
for i in aa:
if i == n:
ans += 1
print(ans) | n, m = list(map(int, input().split()))
like = [0] * m
for _ in range(n):
ka = list(map(int , input().split()))
for i in range(1, ka[0]+1):
like[ka[i]-1] += 1
ans = 0
for li in like:
if li == n:
ans += 1
print(ans) | 12 | 12 | 228 | 247 | n, m = list(map(int, input().split()))
aa = [0] * m
for _ in range(n):
tmp = list(map(int, input().split()))
for ai in tmp[1:]:
aa[ai - 1] += 1
ans = 0
for i in aa:
if i == n:
ans += 1
print(ans)
| n, m = list(map(int, input().split()))
like = [0] * m
for _ in range(n):
ka = list(map(int, input().split()))
for i in range(1, ka[0] + 1):
like[ka[i] - 1] += 1
ans = 0
for li in like:
if li == n:
ans += 1
print(ans)
| false | 0 | [
"-aa = [0] * m",
"+like = [0] * m",
"- tmp = list(map(int, input().split()))",
"- for ai in tmp[1:]:",
"- aa[ai - 1] += 1",
"+ ka = list(map(int, input().split()))",
"+ for i in range(1, ka[0] + 1):",
"+ like[ka[i] - 1] += 1",
"-for i in aa:",
"- if i == n:",
"+for l... | false | 0.121688 | 0.046335 | 2.626298 | [
"s916195839",
"s288185429"
] |
u350248178 | p03165 | python | s466148982 | s726743704 | 609 | 468 | 120,924 | 113,500 | Accepted | Accepted | 23.15 | s=eval(input())
t=eval(input())
dp=[[0 for j in range(len(t)+1)] for i in range(len(s)+1)]
for i in range(1,len(s)+1):
for j in range(1,len(t)+1):
if s[i-1]==t[j-1]:
dp[i][j]=dp[i-1][j-1]+1
else:
dp[i][j]=max(dp[i][j-1],dp[i-1][j])
i=len(s)
j=len(t... | s=eval(input())
t=eval(input())
n,m=len(s),len(t)
dp=[[0]*(m+1) for i in range(n+1)]
dp[0][0]=1
for i in range(n+1):
for j in range(m+1):
dp[i][j]=max(dp[i][j-1],dp[i-1][j])
if i*j!=0 and s[i-1]==t[j-1]:
dp[i][j]=max(dp[i-1][j-1]+1,dp[i][j])
ans=""
i,j=n,m
while 0<i and 0... | 32 | 28 | 525 | 488 | s = eval(input())
t = eval(input())
dp = [[0 for j in range(len(t) + 1)] for i in range(len(s) + 1)]
for i in range(1, len(s) + 1):
for j in range(1, len(t) + 1):
if s[i - 1] == t[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j] = max(dp[i][j - 1], dp[i - 1][j])
i = len... | s = eval(input())
t = eval(input())
n, m = len(s), len(t)
dp = [[0] * (m + 1) for i in range(n + 1)]
dp[0][0] = 1
for i in range(n + 1):
for j in range(m + 1):
dp[i][j] = max(dp[i][j - 1], dp[i - 1][j])
if i * j != 0 and s[i - 1] == t[j - 1]:
dp[i][j] = max(dp[i - 1][j - 1] + 1, dp[i][j]... | false | 12.5 | [
"-dp = [[0 for j in range(len(t) + 1)] for i in range(len(s) + 1)]",
"-for i in range(1, len(s) + 1):",
"- for j in range(1, len(t) + 1):",
"- if s[i - 1] == t[j - 1]:",
"- dp[i][j] = dp[i - 1][j - 1] + 1",
"- else:",
"- dp[i][j] = max(dp[i][j - 1], dp[i - 1][j])",... | false | 0.036594 | 0.042043 | 0.870396 | [
"s466148982",
"s726743704"
] |
u261103969 | p02571 | python | s057149875 | s270647638 | 76 | 66 | 67,480 | 73,444 | Accepted | Accepted | 13.16 | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
S = eval(input())
T = eval(input())
ls = len(S)
lt = len(T)
ans = INF
for i in range(ls - lt + 1):
cur = 0
for j in range(lt):
... | S = eval(input())
T = eval(input())
ans = 1000000 # 適当に1001以上を初期値にしておきます
# Tが1文字のときlen(S)回、2文字のときlen(S) - 1回 …… なので、
# len(S) - len(T) + 1 パターンあります
for i in range(len(S) - len(T) + 1):
score = 0
U = S[i:i + len(T)] # Sのi文字目から連続するlen(T)文字を、Uとします
for j in range(len(T)):
if U[j] != T[j... | 27 | 17 | 448 | 376 | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
S = eval(input())
T = eval(input())
ls = len(S)
lt = len(T)
ans = INF
for i in range(ls - lt + 1):
cur = 0
for j in range(lt):
if S[i + j] != T[j]:
... | S = eval(input())
T = eval(input())
ans = 1000000 # 適当に1001以上を初期値にしておきます
# Tが1文字のときlen(S)回、2文字のときlen(S) - 1回 …… なので、
# len(S) - len(T) + 1 パターンあります
for i in range(len(S) - len(T) + 1):
score = 0
U = S[i : i + len(T)] # Sのi文字目から連続するlen(T)文字を、Uとします
for j in range(len(T)):
if U[j] != T[j]:
... | false | 37.037037 | [
"-import sys",
"-",
"-readline = sys.stdin.readline",
"-MOD = 10**9 + 7",
"-INF = float(\"INF\")",
"-sys.setrecursionlimit(10**5)",
"-",
"-",
"-def main():",
"- S = eval(input())",
"- T = eval(input())",
"- ls = len(S)",
"- lt = len(T)",
"- ans = INF",
"- for i in range... | false | 0.039965 | 0.036202 | 1.103966 | [
"s057149875",
"s270647638"
] |
u229478139 | p02396 | python | s949795391 | s869916567 | 160 | 140 | 5,608 | 5,560 | Accepted | Accepted | 12.5 | def testcase(num, x):
print(("Case {}: {}".format(str(num),str(x))))
cnt=0
while True:
num = int(eval(input()))
cnt+=1
if num !=0:
testcase(cnt,num)
elif num == 0:
break
| i = 1
while True:
tmp = eval(input())
if tmp == '0':
break
print(('Case {}: {}'.format(i, tmp)))
i += 1
| 11 | 8 | 213 | 128 | def testcase(num, x):
print(("Case {}: {}".format(str(num), str(x))))
cnt = 0
while True:
num = int(eval(input()))
cnt += 1
if num != 0:
testcase(cnt, num)
elif num == 0:
break
| i = 1
while True:
tmp = eval(input())
if tmp == "0":
break
print(("Case {}: {}".format(i, tmp)))
i += 1
| false | 27.272727 | [
"-def testcase(num, x):",
"- print((\"Case {}: {}\".format(str(num), str(x))))",
"-",
"-",
"-cnt = 0",
"+i = 1",
"- num = int(eval(input()))",
"- cnt += 1",
"- if num != 0:",
"- testcase(cnt, num)",
"- elif num == 0:",
"+ tmp = eval(input())",
"+ if tmp == \"0\":"... | false | 0.067758 | 0.042598 | 1.590644 | [
"s949795391",
"s869916567"
] |
u348868667 | p03160 | python | s876032835 | s075924243 | 148 | 111 | 13,976 | 13,976 | Accepted | Accepted | 25 | N = int(eval(input()))
h = list(map(int,input().split()))
INF = 10**9
dp = [INF]*N
dp[0] = 0
dp[1] = abs(h[0]-h[1])
for i in range(2,N):
dp1 = abs(h[i]-h[i-1])+dp[i-1]
dp2 = abs(h[i]-h[i-2])+dp[i-2]
dp[i] = min([dp1,dp2])
print((dp[N-1])) | def main():
INF = 10**9
N = int(eval(input()))
h = list(map(int,input().split()))
dp = [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[N-1]))
if __name__ == '__main__':
main() | 11 | 13 | 252 | 311 | N = int(eval(input()))
h = list(map(int, input().split()))
INF = 10**9
dp = [INF] * N
dp[0] = 0
dp[1] = abs(h[0] - h[1])
for i in range(2, N):
dp1 = abs(h[i] - h[i - 1]) + dp[i - 1]
dp2 = abs(h[i] - h[i - 2]) + dp[i - 2]
dp[i] = min([dp1, dp2])
print((dp[N - 1]))
| def main():
INF = 10**9
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [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[N - 1]))
if __name__ == "__main__... | false | 15.384615 | [
"-N = int(eval(input()))",
"-h = list(map(int, input().split()))",
"-INF = 10**9",
"-dp = [INF] * N",
"-dp[0] = 0",
"-dp[1] = abs(h[0] - h[1])",
"-for i in range(2, N):",
"- dp1 = abs(h[i] - h[i - 1]) + dp[i - 1]",
"- dp2 = abs(h[i] - h[i - 2]) + dp[i - 2]",
"- dp[i] = min([dp1, dp2])",
... | false | 0.045105 | 0.126107 | 0.357675 | [
"s876032835",
"s075924243"
] |
u319818856 | p03078 | python | s746345518 | s106591239 | 73 | 45 | 6,744 | 5,316 | Accepted | Accepted | 38.36 | import heapq
class PriorityQueue:
def __init__(self):
self.__heap = []
self.__count = 0
def empty(self) -> bool:
return self.__count == 0
def dequeue(self):
if self.empty():
raise Exception('empty')
self.__count -= 1
return heapq... | import heapq
class PriorityQueue:
def __init__(self):
self.__heap = []
self.__count = 0
def empty(self) -> bool:
return self.__count == 0
def dequeue(self):
if self.empty():
raise Exception('empty')
self.__count -= 1
return heapq... | 75 | 67 | 2,100 | 1,659 | import heapq
class PriorityQueue:
def __init__(self):
self.__heap = []
self.__count = 0
def empty(self) -> bool:
return self.__count == 0
def dequeue(self):
if self.empty():
raise Exception("empty")
self.__count -= 1
return heapq.heappop(self._... | import heapq
class PriorityQueue:
def __init__(self):
self.__heap = []
self.__count = 0
def empty(self) -> bool:
return self.__count == 0
def dequeue(self):
if self.empty():
raise Exception("empty")
self.__count -= 1
return heapq.heappop(self._... | false | 10.666667 | [
"- if ai + 1 < X and bi + 1 < Y:",
"- q.enqueue((sA[ai + 1] + sB[bi + 1] + sC[ci], ai + 1, bi + 1, ci))",
"- if ai + 1 < X and ci + 1 < Z:",
"- q.enqueue((sA[ai + 1] + sB[bi] + sC[ci + 1], ai + 1, bi, ci + 1))",
"- if bi + 1 < Y and ci + 1 < Z:",
"- q.... | false | 0.045373 | 0.039017 | 1.162917 | [
"s746345518",
"s106591239"
] |
u267325300 | p03212 | python | s283144813 | s545677783 | 114 | 99 | 4,364 | 4,364 | Accepted | Accepted | 13.16 | import itertools
N = int(eval(input()))
p = 3
digits = [3, 5, 7]
A = []
flag = False
while True:
for tup in itertools.product(digits, repeat=p):
a = int("".join(list(map(str, tup))))
if a > N:
flag = True
break
A.append(a)
if flag:
break
... | import itertools
N = int(eval(input()))
digits = [3, 5, 7]
def get_A_product(digits, N):
A = []
flag = False
p = 3
while True:
for tup in itertools.product(digits, repeat=p):
a = int("".join(list(map(str, tup))))
if a > N:
flag = True
... | 21 | 28 | 439 | 574 | import itertools
N = int(eval(input()))
p = 3
digits = [3, 5, 7]
A = []
flag = False
while True:
for tup in itertools.product(digits, repeat=p):
a = int("".join(list(map(str, tup))))
if a > N:
flag = True
break
A.append(a)
if flag:
break
p += 1
count ... | import itertools
N = int(eval(input()))
digits = [3, 5, 7]
def get_A_product(digits, N):
A = []
flag = False
p = 3
while True:
for tup in itertools.product(digits, repeat=p):
a = int("".join(list(map(str, tup))))
if a > N:
flag = True
br... | false | 25 | [
"-p = 3",
"-A = []",
"-flag = False",
"-while True:",
"- for tup in itertools.product(digits, repeat=p):",
"- a = int(\"\".join(list(map(str, tup))))",
"- if a > N:",
"- flag = True",
"+",
"+",
"+def get_A_product(digits, N):",
"+ A = []",
"+ flag = False",
... | false | 0.07025 | 0.007402 | 9.490296 | [
"s283144813",
"s545677783"
] |
u145231176 | p03732 | python | s693239041 | s271325966 | 312 | 226 | 109,524 | 109,520 | Accepted | Accepted | 27.56 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | 85 | 87 | 2,168 | 2,240 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | false | 2.298851 | [
"-N, W = getNM()",
"+N, great_W = getNM()",
"+# 下限の数字て引く(あとで足し合わせた数 * wei_minを使う)",
"+ # 足し合わせN個でvalができる",
"- if i * wei_min <= (W - j):",
"+ if i * wei_min <= (great_W - j):"
] | false | 0.095576 | 0.232389 | 0.411276 | [
"s693239041",
"s271325966"
] |
u143509139 | p03378 | python | s795182861 | s610831938 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | import bisect
N, M, X = list(map(int, input().split()))
a = list(map(int, input().split()))
p = bisect.bisect_left(a, X)
print((min(p, M - p))) | n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(m):
if x < a[i]:
break
else:
i += 1
print((min(i, m - i))) | 5 | 8 | 139 | 158 | import bisect
N, M, X = list(map(int, input().split()))
a = list(map(int, input().split()))
p = bisect.bisect_left(a, X)
print((min(p, M - p)))
| n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(m):
if x < a[i]:
break
else:
i += 1
print((min(i, m - i)))
| false | 37.5 | [
"-import bisect",
"-",
"-N, M, X = list(map(int, input().split()))",
"+n, m, x = list(map(int, input().split()))",
"-p = bisect.bisect_left(a, X)",
"-print((min(p, M - p)))",
"+for i in range(m):",
"+ if x < a[i]:",
"+ break",
"+else:",
"+ i += 1",
"+print((min(i, m - i)))"
] | false | 0.046115 | 0.042237 | 1.091828 | [
"s795182861",
"s610831938"
] |
u761320129 | p03854 | python | s670927724 | s464476648 | 139 | 35 | 3,316 | 3,188 | Accepted | Accepted | 74.82 | S = eval(input())
N = len(S)
R = S[::-1]
dic = ['maerd','remaerd','esare','resare']
i = 0
while i < N:
for w in dic:
if R[i:].startswith(w):
i += len(w)
break
else:
print('NO')
exit()
print('YES')
| S = eval(input())
S = S[::-1]
kws = ['dream','dreamer','erase','eraser']
kws = [kw[::-1] for kw in kws]
i = 0
while i < len(S):
for kw in kws:
if S[i:i+len(kw)] == kw:
i += len(kw)
break
else:
print('NO')
exit()
print('YES')
| 14 | 15 | 260 | 290 | S = eval(input())
N = len(S)
R = S[::-1]
dic = ["maerd", "remaerd", "esare", "resare"]
i = 0
while i < N:
for w in dic:
if R[i:].startswith(w):
i += len(w)
break
else:
print("NO")
exit()
print("YES")
| S = eval(input())
S = S[::-1]
kws = ["dream", "dreamer", "erase", "eraser"]
kws = [kw[::-1] for kw in kws]
i = 0
while i < len(S):
for kw in kws:
if S[i : i + len(kw)] == kw:
i += len(kw)
break
else:
print("NO")
exit()
print("YES")
| false | 6.666667 | [
"-N = len(S)",
"-R = S[::-1]",
"-dic = [\"maerd\", \"remaerd\", \"esare\", \"resare\"]",
"+S = S[::-1]",
"+kws = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]",
"+kws = [kw[::-1] for kw in kws]",
"-while i < N:",
"- for w in dic:",
"- if R[i:].startswith(w):",
"- i += len(w)... | false | 0.046715 | 0.084114 | 0.555372 | [
"s670927724",
"s464476648"
] |
u353797797 | p03163 | python | s779758550 | s201954628 | 1,668 | 172 | 7,664 | 14,624 | Accepted | Accepted | 89.69 | import sys
input=sys.stdin.readline
def f(n,W):
wv = [list(map(int, input().split())) for _ in range(n)]
dp = [-1] * (W + 1)
dp[0] = 0
for w, v in wv:
for i in range(W - w, -1, -1):
if dp[i] == -1: continue
nv = dp[i] + v
if nv > dp[i + w]:
... | import numpy as np
import sys
input=sys.stdin.readline
n,W=list(map(int,input().split()))
wv=[list(map(int,input().split())) for _ in range(n)]
dp=np.zeros(W+1,dtype="i8")
for w,v in wv:
np.maximum(dp[w:],dp[:W+1-w]+v,out=dp[w:])
print((dp[-1]))
| 17 | 10 | 405 | 252 | import sys
input = sys.stdin.readline
def f(n, W):
wv = [list(map(int, input().split())) for _ in range(n)]
dp = [-1] * (W + 1)
dp[0] = 0
for w, v in wv:
for i in range(W - w, -1, -1):
if dp[i] == -1:
continue
nv = dp[i] + v
if nv > dp[i + w... | import numpy as np
import sys
input = sys.stdin.readline
n, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
dp = np.zeros(W + 1, dtype="i8")
for w, v in wv:
np.maximum(dp[w:], dp[: W + 1 - w] + v, out=dp[w:])
print((dp[-1]))
| false | 41.176471 | [
"+import numpy as np",
"-",
"-",
"-def f(n, W):",
"- wv = [list(map(int, input().split())) for _ in range(n)]",
"- dp = [-1] * (W + 1)",
"- dp[0] = 0",
"- for w, v in wv:",
"- for i in range(W - w, -1, -1):",
"- if dp[i] == -1:",
"- continue",
"- ... | false | 0.043461 | 0.226005 | 0.1923 | [
"s779758550",
"s201954628"
] |
u724687935 | p02728 | python | s161327703 | s622385788 | 2,830 | 2,521 | 183,028 | 176,396 | Accepted | Accepted | 10.92 | import sys
sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
def prepare(n):
global MOD
modFacts = [0] * (n + 1)
modFacts[0] = 1
for i in range(n):
modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD
invs = [1] * (n + 1)
invs[n] = pow(modFacts[n], MOD - 2, MOD)
for i ... | import sys
sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
def prepare(n):
global MOD
modFacts = [0] * (n + 1)
modFacts[0] = 1
for i in range(n):
modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD
invs = [1] * (n + 1)
invs[n] = pow(modFacts[n], MOD - 2, MOD)
for i ... | 83 | 79 | 1,735 | 1,685 | import sys
sys.setrecursionlimit(10**6)
MOD = 10**9 + 7
def prepare(n):
global MOD
modFacts = [0] * (n + 1)
modFacts[0] = 1
for i in range(n):
modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD
invs = [1] * (n + 1)
invs[n] = pow(modFacts[n], MOD - 2, MOD)
for i in range(n, 1, -1):
... | import sys
sys.setrecursionlimit(10**6)
MOD = 10**9 + 7
def prepare(n):
global MOD
modFacts = [0] * (n + 1)
modFacts[0] = 1
for i in range(n):
modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD
invs = [1] * (n + 1)
invs[n] = pow(modFacts[n], MOD - 2, MOD)
for i in range(n, 1, -1):
... | false | 4.819277 | [
"+ dp[v] = (childs, var)",
"-def dfs2(v):",
"+def dfs2(v, pn, pVar):",
"- tNodes = 0",
"- tVar = 1",
"- for n, var in V[v].values():",
"- tNodes += n",
"- tVar *= var",
"- tVar %= MOD",
"- tVar *= invs[n]",
"- tVar %= MOD",
"- tVar *= modFacts[... | false | 0.092316 | 0.044186 | 2.089262 | [
"s161327703",
"s622385788"
] |
u586577600 | p03814 | python | s368627230 | s181832267 | 95 | 47 | 3,516 | 3,516 | Accepted | Accepted | 50.53 | s = eval(input())
isAdd = False
l = -1
r = -1
for i in range(len(s)):
if s[i] == 'A' and l == -1: l = i
if s[len(s)-1-i] == 'Z' and r == -1: r = len(s)-1-i
print((r-l+1))
| s = eval(input())
r = len(s) - 1
l = 0
while (s[l] != 'A'): l+=1
while (s[r] != 'Z'): r-=1
print((r-l+1))
| 9 | 6 | 180 | 103 | s = eval(input())
isAdd = False
l = -1
r = -1
for i in range(len(s)):
if s[i] == "A" and l == -1:
l = i
if s[len(s) - 1 - i] == "Z" and r == -1:
r = len(s) - 1 - i
print((r - l + 1))
| s = eval(input())
r = len(s) - 1
l = 0
while s[l] != "A":
l += 1
while s[r] != "Z":
r -= 1
print((r - l + 1))
| false | 33.333333 | [
"-isAdd = False",
"-l = -1",
"-r = -1",
"-for i in range(len(s)):",
"- if s[i] == \"A\" and l == -1:",
"- l = i",
"- if s[len(s) - 1 - i] == \"Z\" and r == -1:",
"- r = len(s) - 1 - i",
"+r = len(s) - 1",
"+l = 0",
"+while s[l] != \"A\":",
"+ l += 1",
"+while s[r] != \... | false | 0.039816 | 0.048838 | 0.815265 | [
"s368627230",
"s181832267"
] |
u197615397 | p02363 | python | s365747591 | s814653324 | 950 | 790 | 8,260 | 8,496 | Accepted | Accepted | 16.84 | import sys
readline = sys.stdin.readline
V, E = list(map(int, readline().split()))
inf = 10**10
vertices = [[inf if i!=j else 0 for j in range(V)] for i in range(V)]
for _ in [None]*E:
s, t, d = list(map(int, readline().split()))
vertices[s][t] = d
for k in range(V):
for i in range(V):
... | import sys
readline = sys.stdin.readline
V, E = list(map(int, readline().split()))
inf = float("inf")
vertices = [[inf if i!=j else 0 for j in range(V)] for i in range(V)]
for _ in [None]*E:
s, t, d = list(map(int, readline().split()))
vertices[s][t] = d
for k in range(V):
for i in range(V):
... | 26 | 25 | 742 | 682 | import sys
readline = sys.stdin.readline
V, E = list(map(int, readline().split()))
inf = 10**10
vertices = [[inf if i != j else 0 for j in range(V)] for i in range(V)]
for _ in [None] * E:
s, t, d = list(map(int, readline().split()))
vertices[s][t] = d
for k in range(V):
for i in range(V):
for j in... | import sys
readline = sys.stdin.readline
V, E = list(map(int, readline().split()))
inf = float("inf")
vertices = [[inf if i != j else 0 for j in range(V)] for i in range(V)]
for _ in [None] * E:
s, t, d = list(map(int, readline().split()))
vertices[s][t] = d
for k in range(V):
for i in range(V):
fo... | false | 3.846154 | [
"-inf = 10**10",
"+inf = float(\"inf\")",
"- if c2 != inf and c3 != inf: # for Negative Edge",
"- vertices[i][j] = c1 if c1 < c2 + c3 else c2 + c3",
"+ vertices[i][j] = c1 if c1 < c2 + c3 else c2 + c3"
] | false | 0.044578 | 0.037574 | 1.186398 | [
"s365747591",
"s814653324"
] |
u150984829 | p00003 | python | s707152447 | s228967488 | 40 | 30 | 5,608 | 5,640 | Accepted | Accepted | 25 | for _ in[0]*int(eval(input())):
a,b,c=sorted(map(int,input().split()))
print((['NO','YES'][a*a+b*b==c*c]))
| import sys
eval(input())
for a,b,c in [sorted(map(int,x.split())) for x in sys.stdin]:
print((['NO','YES'][a*a+b*b==c*c]))
| 3 | 4 | 103 | 122 | for _ in [0] * int(eval(input())):
a, b, c = sorted(map(int, input().split()))
print((["NO", "YES"][a * a + b * b == c * c]))
| import sys
eval(input())
for a, b, c in [sorted(map(int, x.split())) for x in sys.stdin]:
print((["NO", "YES"][a * a + b * b == c * c]))
| false | 25 | [
"-for _ in [0] * int(eval(input())):",
"- a, b, c = sorted(map(int, input().split()))",
"+import sys",
"+",
"+eval(input())",
"+for a, b, c in [sorted(map(int, x.split())) for x in sys.stdin]:"
] | false | 0.05654 | 0.099525 | 0.568097 | [
"s707152447",
"s228967488"
] |
u585482323 | p03013 | python | s730327164 | s620101355 | 105 | 78 | 28,116 | 8,640 | Accepted | Accepted | 25.71 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | 90 | 87 | 1,651 | 1,611 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(m... | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(m... | false | 3.333333 | [
"- f = defaultdict(lambda: 1)",
"+ f = [1 for i in range(n + 1)]",
"- dp = defaultdict(lambda: 0)",
"+ dp = [0 for i in range(n + 1)]",
"- else:",
"- dp[i] = 0"
] | false | 0.045919 | 0.103245 | 0.444755 | [
"s730327164",
"s620101355"
] |
u995062424 | p03295 | python | s792703229 | s786407930 | 435 | 373 | 29,848 | 18,980 | Accepted | Accepted | 14.25 | def main():
N, M = list(map(int, input().split()))
y = []
for i in range(M):
y.append(list(map(int, input().split())))
youbou = sorted(y, key = lambda x:x[1])
cnt = 0
k = 0
for i in range(M):
if(youbou[i][0] >= k):
cnt += 1
k = youbou[... | def main():
N, M = list(map(int, input().split()))
island = []
for i in range(M):
a, b = list(map(int, input().split()))
island.append(tuple((a, b)))
s = sorted(island, key=lambda x:x[1])
base = s[0][1]
cnt = 1
for i in range(1, len(s)):
if(s[i][... | 15 | 18 | 343 | 400 | def main():
N, M = list(map(int, input().split()))
y = []
for i in range(M):
y.append(list(map(int, input().split())))
youbou = sorted(y, key=lambda x: x[1])
cnt = 0
k = 0
for i in range(M):
if youbou[i][0] >= k:
cnt += 1
k = youbou[i][1]
print(cnt... | def main():
N, M = list(map(int, input().split()))
island = []
for i in range(M):
a, b = list(map(int, input().split()))
island.append(tuple((a, b)))
s = sorted(island, key=lambda x: x[1])
base = s[0][1]
cnt = 1
for i in range(1, len(s)):
if s[i][0] >= base:
... | false | 16.666667 | [
"- y = []",
"+ island = []",
"- y.append(list(map(int, input().split())))",
"- youbou = sorted(y, key=lambda x: x[1])",
"- cnt = 0",
"- k = 0",
"- for i in range(M):",
"- if youbou[i][0] >= k:",
"+ a, b = list(map(int, input().split()))",
"+ island.app... | false | 0.041924 | 0.042826 | 0.978945 | [
"s792703229",
"s786407930"
] |
u823044869 | p03738 | python | s185503623 | s201618776 | 150 | 17 | 12,396 | 3,064 | Accepted | Accepted | 88.67 |
import numpy as np
import math
a=int(eval(input()))
b=int(eval(input()))
if(a<b):
print("LESS")
elif(a==b):
print("EQUAL")
else:
print("GREATER")
| a = int(eval(input()))
b = int(eval(input()))
if a<b:
print("LESS")
elif a>b:
print("GREATER")
else:
print("EQUAL")
| 13 | 9 | 161 | 119 | import numpy as np
import math
a = int(eval(input()))
b = int(eval(input()))
if a < b:
print("LESS")
elif a == b:
print("EQUAL")
else:
print("GREATER")
| a = int(eval(input()))
b = int(eval(input()))
if a < b:
print("LESS")
elif a > b:
print("GREATER")
else:
print("EQUAL")
| false | 30.769231 | [
"-import numpy as np",
"-import math",
"-",
"-elif a == b:",
"+elif a > b:",
"+ print(\"GREATER\")",
"+else:",
"-else:",
"- print(\"GREATER\")"
] | false | 0.085075 | 0.037194 | 2.287292 | [
"s185503623",
"s201618776"
] |
u368249389 | p02720 | python | s219929958 | s892007644 | 1,226 | 256 | 46,940 | 45,660 | Accepted | Accepted | 79.12 | # Problem D - Lunlun Number
# input
K = int(eval(input()))
# initialization
num_queue = []
k = 1
# count
while True:
if k>=1 and k<=9: # 1桁の場合
num_queue.append(k)
k += 1
else: # 2桁以降の場合
min_num = str(num_queue.pop(0))
keta_1 = int(min_num[-1])
if keta_... | # Problem D - Lunlun Number
from collections import deque
# input
K = int(eval(input()))
# initialization
num_queue = deque()
k = 1
# count
while True:
if k>=1 and k<=9:
num_queue.append(k)
k += 1
else:
num = str(num_queue.popleft())
num_str = int(num[-1])
... | 43 | 46 | 1,032 | 1,040 | # Problem D - Lunlun Number
# input
K = int(eval(input()))
# initialization
num_queue = []
k = 1
# count
while True:
if k >= 1 and k <= 9: # 1桁の場合
num_queue.append(k)
k += 1
else: # 2桁以降の場合
min_num = str(num_queue.pop(0))
keta_1 = int(min_num[-1])
if keta_1 == 0:
... | # Problem D - Lunlun Number
from collections import deque
# input
K = int(eval(input()))
# initialization
num_queue = deque()
k = 1
# count
while True:
if k >= 1 and k <= 9:
num_queue.append(k)
k += 1
else:
num = str(num_queue.popleft())
num_str = int(num[-1])
if num_str... | false | 6.521739 | [
"+from collections import deque",
"+",
"-num_queue = []",
"+num_queue = deque()",
"- if k >= 1 and k <= 9: # 1桁の場合",
"+ if k >= 1 and k <= 9:",
"- else: # 2桁以降の場合",
"- min_num = str(num_queue.pop(0))",
"- keta_1 = int(min_num[-1])",
"- if keta_1 == 0:",
"+ else... | false | 0.084868 | 0.060245 | 1.408723 | [
"s219929958",
"s892007644"
] |
u832039789 | p03759 | python | s930682011 | s750947838 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a,b,c=list(map(int,input().split()))
print(('YES' if a+c==b*2 else 'NO')) | a,b,c = list(map(int,input().split()))
if b - a == c -b:
print('YES')
else:
print('NO') | 2 | 5 | 66 | 93 | a, b, c = list(map(int, input().split()))
print(("YES" if a + c == b * 2 else "NO"))
| a, b, c = list(map(int, input().split()))
if b - a == c - b:
print("YES")
else:
print("NO")
| false | 60 | [
"-print((\"YES\" if a + c == b * 2 else \"NO\"))",
"+if b - a == c - b:",
"+ print(\"YES\")",
"+else:",
"+ print(\"NO\")"
] | false | 0.045573 | 0.045817 | 0.994673 | [
"s930682011",
"s750947838"
] |
u622045059 | p03329 | python | s940121331 | s580145945 | 780 | 705 | 91,888 | 6,060 | Accepted | Accepted | 9.62 | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b... | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b... | 67 | 65 | 2,260 | 2,175 | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
INF = float("inf") # 無限大
def gcd(a, b):
return fractions.gcd(a, b) # 最大公約数
def lcm(... | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
INF = float("inf") # 無限大
def gcd(a, b):
return fractions.gcd(a, b) # 最大公約数
def lcm(... | false | 2.985075 | [
"-memo = [-1 for _ in range(N + 1)]",
"-",
"-",
"-def rec(n):",
"- if n == 0:",
"- return 0",
"- if memo[n] != -1:",
"- return memo[n]",
"- res = n",
"+dp = [INF for _ in range(N + 1)]",
"+dp[0] = 0",
"+for i in range(1, N + 1):",
"- while pow6 <= n:",
"- r... | false | 0.194173 | 0.179162 | 1.083785 | [
"s940121331",
"s580145945"
] |
u353895424 | p02780 | python | s248694410 | s032652371 | 380 | 202 | 33,924 | 33,724 | Accepted | Accepted | 46.84 | import numpy as np
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
"""
各pの期待値を算出
p期待値について累積和を出す
最大部分和を出す
"""
p_ex = [0] * n
for i in range(n):
p_ex[i] = (1 + p[i])/2
p_ruiseki = np.cumsum(p_ex)
maxsum = p_ruiseki[k-1]
for i in range(k, n):
if maxsum < p_ruiseki[i... | n, k = list(map(int, input().split()))
P = list(map(int, input().split()))
ans = 0
E = []
for p in P:
E.append(p*(p+1)/(2*p))
cumsumE = [0]
for e in E:
cumsumE.append(cumsumE[-1] + e)
for i in range(0, n+1-k):
ans = max(ans, cumsumE[i+k]-cumsumE[i])
print(ans) | 68 | 15 | 1,360 | 283 | import numpy as np
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
"""
各pの期待値を算出
p期待値について累積和を出す
最大部分和を出す
"""
p_ex = [0] * n
for i in range(n):
p_ex[i] = (1 + p[i]) / 2
p_ruiseki = np.cumsum(p_ex)
maxsum = p_ruiseki[k - 1]
for i in range(k, n):
if maxsum < p_ruiseki[i] - p_ruiseki[i -... | n, k = list(map(int, input().split()))
P = list(map(int, input().split()))
ans = 0
E = []
for p in P:
E.append(p * (p + 1) / (2 * p))
cumsumE = [0]
for e in E:
cumsumE.append(cumsumE[-1] + e)
for i in range(0, n + 1 - k):
ans = max(ans, cumsumE[i + k] - cumsumE[i])
print(ans)
| false | 77.941176 | [
"-import numpy as np",
"-",
"-p = list(map(int, input().split()))",
"-\"\"\"",
"-各pの期待値を算出",
"-p期待値について累積和を出す",
"-最大部分和を出す",
"-\"\"\"",
"-p_ex = [0] * n",
"-for i in range(n):",
"- p_ex[i] = (1 + p[i]) / 2",
"-p_ruiseki = np.cumsum(p_ex)",
"-maxsum = p_ruiseki[k - 1]",
"-for i in range(... | false | 0.342316 | 0.053136 | 6.442305 | [
"s248694410",
"s032652371"
] |
u098012509 | p02628 | python | s049445790 | s946726545 | 30 | 27 | 9,232 | 9,128 | Accepted | Accepted | 10 | import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
N, K = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]
P.sort()
ans = 0
for i in range(K):
ans += P[i]
print(ans)
if __name__ == '__main__... | import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
N, K = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]
P.sort()
print((sum(P[:K])))
if __name__ == '__main__':
main()
| 25 | 21 | 337 | 272 | import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
N, K = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]
P.sort()
ans = 0
for i in range(K):
ans += P[i]
print(ans)
if __name__ == "__main__":
main()
| import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
N, K = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]
P.sort()
print((sum(P[:K])))
if __name__ == "__main__":
main()
| false | 16 | [
"- ans = 0",
"- for i in range(K):",
"- ans += P[i]",
"- print(ans)",
"+ print((sum(P[:K])))"
] | false | 0.045864 | 0.044773 | 1.024384 | [
"s049445790",
"s946726545"
] |
u652569315 | p02802 | python | s481330536 | s933214085 | 194 | 123 | 10,100 | 4,596 | Accepted | Accepted | 36.6 | def main():
import sys
input = sys.stdin.readline
n,m=list(map(int,input().split()))
ac,wa,l=0,0,[0]*n
for _ in [0]*m:
p,s=input().split()
if type(l[int(p)-1])==int:
if s=='AC':
ac+=1
wa+= l[int(p)-1]
l[int(p)-1]=str(l[int(p)-1])
else:
l[int(p)-... | def main():
import sys
input = sys.stdin.buffer.readline
n,m=list(map(int,input().split()))
ac,wa,l,k=0,0,[0]*n,[0]*m
for _ in k:
p,s=input().split()
p=int(p)
if type(l[p-1])==int:
if s==b'AC':
ac+=1
wa+=l[p-1]
l[p-1]=''
else:
l[p-1]+=1
... | 18 | 19 | 379 | 370 | def main():
import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
ac, wa, l = 0, 0, [0] * n
for _ in [0] * m:
p, s = input().split()
if type(l[int(p) - 1]) == int:
if s == "AC":
ac += 1
wa += l[int(p) - 1]
... | def main():
import sys
input = sys.stdin.buffer.readline
n, m = list(map(int, input().split()))
ac, wa, l, k = 0, 0, [0] * n, [0] * m
for _ in k:
p, s = input().split()
p = int(p)
if type(l[p - 1]) == int:
if s == b"AC":
ac += 1
wa... | false | 5.263158 | [
"- input = sys.stdin.readline",
"+ input = sys.stdin.buffer.readline",
"- ac, wa, l = 0, 0, [0] * n",
"- for _ in [0] * m:",
"+ ac, wa, l, k = 0, 0, [0] * n, [0] * m",
"+ for _ in k:",
"- if type(l[int(p) - 1]) == int:",
"- if s == \"AC\":",
"+ p = int(p)",... | false | 0.007571 | 0.036853 | 0.205437 | [
"s481330536",
"s933214085"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.