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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u977490411 | p03861 | python | s947737016 | s774404993 | 152 | 17 | 12,488 | 2,940 | Accepted | Accepted | 88.82 | import numpy as np
a, b, x = list(map(int, input().split()))
upper = b // x
lower = (a-1)//x
ans = upper - lower
print(ans) | a, b, x = list(map(int, input().split()))
upper = b // x
lower = (a-1)//x
ans = upper - lower
print(ans) | 8 | 7 | 126 | 106 | import numpy as np
a, b, x = list(map(int, input().split()))
upper = b // x
lower = (a - 1) // x
ans = upper - lower
print(ans)
| a, b, x = list(map(int, input().split()))
upper = b // x
lower = (a - 1) // x
ans = upper - lower
print(ans)
| false | 12.5 | [
"-import numpy as np",
"-"
] | false | 0.044049 | 0.03777 | 1.166238 | [
"s947737016",
"s774404993"
] |
u476386869 | p02596 | python | s546264356 | s636632581 | 700 | 109 | 9,180 | 9,192 | Accepted | Accepted | 84.43 | import sys
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
def main():
K = i2n()
if K%2==0:
print((-1))
return
if K % 7:
L = 9*K
else:
L = 9*K//7
a = 1
for i in range(1,L+1):
a = (a * 10) % L
if a... | import sys
input = sys.stdin.readline
def main():
K = int(eval(input()))
if K%2==0:
print((-1))
return
if K % 7:
L = 9*K
else:
L = 9*K//7
a = 1
for i in range(1,K+10):
a = (a * 10) % L
if a == 1:
print(i)
... | 24 | 22 | 389 | 352 | import sys
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
def main():
K = i2n()
if K % 2 == 0:
print((-1))
return
if K % 7:
L = 9 * K
else:
L = 9 * K // 7
a = 1
for i in range(1, L + 1):
a = (a * 10) % L
if a == 1:
... | import sys
input = sys.stdin.readline
def main():
K = int(eval(input()))
if K % 2 == 0:
print((-1))
return
if K % 7:
L = 9 * K
else:
L = 9 * K // 7
a = 1
for i in range(1, K + 10):
a = (a * 10) % L
if a == 1:
print(i)
ret... | false | 8.333333 | [
"-i2s = lambda: sys.stdin.readline().rstrip()",
"-i2n = lambda: int(i2s())",
"+input = sys.stdin.readline",
"- K = i2n()",
"+ K = int(eval(input()))",
"- for i in range(1, L + 1):",
"+ for i in range(1, K + 10):"
] | false | 0.091066 | 0.050515 | 1.802737 | [
"s546264356",
"s636632581"
] |
u687574784 | p03231 | python | s238434456 | s537022676 | 70 | 26 | 19,360 | 9,280 | Accepted | Accepted | 62.86 | n,m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
import math
# 良い文字列が作れるなら、答えはLCM(n, m)となる
lcm = n * m // math.gcd(n, m)
x = {}
for i,c in enumerate(s):
# (pos, char)
x[lcm//n*i] = c
for i,c in enumerate(t):
# (pos, char)
pos, char = lcm//m*i, c
if pos in ... | n,m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
import math
# 良い文字列が作れるなら、答えはLCM(n, m)となる
gcd = math.gcd(n, m)
if s[::n//gcd] == t[::m//gcd]:
print((n * m // gcd))
else:
print((-1)) | 21 | 11 | 378 | 210 | n, m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
import math
# 良い文字列が作れるなら、答えはLCM(n, m)となる
lcm = n * m // math.gcd(n, m)
x = {}
for i, c in enumerate(s):
# (pos, char)
x[lcm // n * i] = c
for i, c in enumerate(t):
# (pos, char)
pos, char = lcm // m * i, c
if pos in x and x... | n, m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
import math
# 良い文字列が作れるなら、答えはLCM(n, m)となる
gcd = math.gcd(n, m)
if s[:: n // gcd] == t[:: m // gcd]:
print((n * m // gcd))
else:
print((-1))
| false | 47.619048 | [
"-lcm = n * m // math.gcd(n, m)",
"-x = {}",
"-for i, c in enumerate(s):",
"- # (pos, char)",
"- x[lcm // n * i] = c",
"-for i, c in enumerate(t):",
"- # (pos, char)",
"- pos, char = lcm // m * i, c",
"- if pos in x and x[pos] != char:",
"- print((-1))",
"- exit()",
... | false | 0.045415 | 0.044433 | 1.022109 | [
"s238434456",
"s537022676"
] |
u562935282 | p03244 | python | s535752616 | s334887302 | 137 | 85 | 17,564 | 18,656 | Accepted | Accepted | 37.96 | n = int(eval(input()))
v = list(map(int, input().split()))
cnt_arr = [dict() for _ in range(2)]
for i in range(n):
cnt_arr[i % 2][v[i]] = cnt_arr[i % 2].get(v[i], 0) + 1
v_even = sorted(list(cnt_arr[0].items()), key=lambda x: x[1], reverse=True)[:2] # [value, 出現数] * 2(上位2)
v_odd = sorted(list(cnt_arr[1... | from collections import Counter
n = int(eval(input()))
v = list(map(int, input().split()))
evens = Counter(v[::2])
odds = Counter(v[1::2])
evens[0] = 0 # 一種類の数値しか含まれないときの対策
odds[0] = 0
keep = 0
for even in evens.most_common(2):
for odd in odds.most_common(2):
if even[0] != odd[0]:
... | 21 | 18 | 651 | 373 | n = int(eval(input()))
v = list(map(int, input().split()))
cnt_arr = [dict() for _ in range(2)]
for i in range(n):
cnt_arr[i % 2][v[i]] = cnt_arr[i % 2].get(v[i], 0) + 1
v_even = sorted(list(cnt_arr[0].items()), key=lambda x: x[1], reverse=True)[
:2
] # [value, 出現数] * 2(上位2)
v_odd = sorted(list(cnt_arr[1].item... | from collections import Counter
n = int(eval(input()))
v = list(map(int, input().split()))
evens = Counter(v[::2])
odds = Counter(v[1::2])
evens[0] = 0 # 一種類の数値しか含まれないときの対策
odds[0] = 0
keep = 0
for even in evens.most_common(2):
for odd in odds.most_common(2):
if even[0] != odd[0]:
keep = max(k... | false | 14.285714 | [
"+from collections import Counter",
"+",
"-cnt_arr = [dict() for _ in range(2)]",
"-for i in range(n):",
"- cnt_arr[i % 2][v[i]] = cnt_arr[i % 2].get(v[i], 0) + 1",
"-v_even = sorted(list(cnt_arr[0].items()), key=lambda x: x[1], reverse=True)[",
"- :2",
"-] # [value, 出現数] * 2(上位2)",
"-v_odd =... | false | 0.04445 | 0.038124 | 1.165928 | [
"s535752616",
"s334887302"
] |
u391731808 | p03044 | python | s359869911 | s252996398 | 710 | 631 | 75,524 | 75,392 | Accepted | Accepted | 11.13 | import heapq
N = int(input())
UVW = [list(map(int,input().split())) for _ in [0]*(N-1)]
E = [{} for _ in [0]*N]
for u,v,c in UVW:
E[u-1][v-1] = c
E[v-1][u-1] = c
def Dijkstra(N,E,start):
d = [-1]*N
q = [(0,start)]
while q:
ci,i = heapq.heappop(q)
if d[i]!= -1:continue... | #DFS
N = int(input())
UVW = [list(map(int,input().split())) for _ in [0]*(N-1)]
E = [{} for _ in [0]*N]
for u,v,c in UVW:
E[u-1][v-1] = c
E[v-1][u-1] = c
def dist_dfs_tree(N,E,start):
d = [-1]*N
d[start] = 0
q = [start]
while q:
i = q.pop()
ci = d[i]
for... | 23 | 24 | 521 | 505 | import heapq
N = int(input())
UVW = [list(map(int, input().split())) for _ in [0] * (N - 1)]
E = [{} for _ in [0] * N]
for u, v, c in UVW:
E[u - 1][v - 1] = c
E[v - 1][u - 1] = c
def Dijkstra(N, E, start):
d = [-1] * N
q = [(0, start)]
while q:
ci, i = heapq.heappop(q)
if d[i] != ... | # DFS
N = int(input())
UVW = [list(map(int, input().split())) for _ in [0] * (N - 1)]
E = [{} for _ in [0] * N]
for u, v, c in UVW:
E[u - 1][v - 1] = c
E[v - 1][u - 1] = c
def dist_dfs_tree(N, E, start):
d = [-1] * N
d[start] = 0
q = [start]
while q:
i = q.pop()
ci = d[i]
... | false | 4.166667 | [
"-import heapq",
"-",
"+# DFS",
"-def Dijkstra(N, E, start):",
"+def dist_dfs_tree(N, E, start):",
"- q = [(0, start)]",
"+ d[start] = 0",
"+ q = [start]",
"- ci, i = heapq.heappop(q)",
"- if d[i] != -1:",
"- continue",
"- d[i] = ci",
"+ i = q.... | false | 0.051389 | 0.038921 | 1.320329 | [
"s359869911",
"s252996398"
] |
u883621917 | p03290 | python | s878538274 | s056276299 | 22 | 18 | 3,188 | 3,064 | Accepted | Accepted | 18.18 | d, g = [int(i) for i in input().split()]
p = [0] + [[int(i) for i in input().split()] for _ in range(d)]
def recursive(d, g):
if d == 0:
return 10 ** 9
n = min(g // (100 * d), p[d][0])
t = 100 * d * n
# Full
if n == p[d][0]:
t += p[d][1]
# Partial
if t < g:
... | d, g = [int(i) for i in input().split()]
p = [0] + [[int(i) for i in input().split()] for _ in range(d)]
def recursive(d, g):
if d == 0:
return 10 ** 9
n = min(g // (100 * d), p[d][0])
t = 100 * d * n
# Full
if n == p[d][0]:
t += p[d][1]
# Partial
if t < g:
... | 46 | 46 | 1,255 | 1,255 | d, g = [int(i) for i in input().split()]
p = [0] + [[int(i) for i in input().split()] for _ in range(d)]
def recursive(d, g):
if d == 0:
return 10**9
n = min(g // (100 * d), p[d][0])
t = 100 * d * n
# Full
if n == p[d][0]:
t += p[d][1]
# Partial
if t < g:
n += recur... | d, g = [int(i) for i in input().split()]
p = [0] + [[int(i) for i in input().split()] for _ in range(d)]
def recursive(d, g):
if d == 0:
return 10**9
n = min(g // (100 * d), p[d][0])
t = 100 * d * n
# Full
if n == p[d][0]:
t += p[d][1]
# Partial
if t < g:
n += recur... | false | 0 | [
"-# solve = recursive",
"-solve = bit",
"+solve = recursive",
"+# solve = bit"
] | false | 0.041124 | 0.098376 | 0.418034 | [
"s878538274",
"s056276299"
] |
u186838327 | p03786 | python | s468135231 | s348131127 | 437 | 114 | 14,360 | 84,900 | Accepted | Accepted | 73.91 | n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
from itertools import accumulate
C = [0]+A
C = list(accumulate(C))
def is_ok(x):
if x == n-1:
return True
y = C[x+1]
flag = True
for i in range(x+1, n):
if A[i] > 2*y:
flag = False
y... | n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
from itertools import accumulate
C = [0]+A
C = list(accumulate(C))
def is_ok(x):
if x < 0:
return False
cur = C[x+1]
for i in range(x+1, n):
if A[i] <= 2*cur:
cur += A[i]
else:
... | 35 | 31 | 556 | 516 | n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
from itertools import accumulate
C = [0] + A
C = list(accumulate(C))
def is_ok(x):
if x == n - 1:
return True
y = C[x + 1]
flag = True
for i in range(x + 1, n):
if A[i] > 2 * y:
flag = False
y += A... | n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
from itertools import accumulate
C = [0] + A
C = list(accumulate(C))
def is_ok(x):
if x < 0:
return False
cur = C[x + 1]
for i in range(x + 1, n):
if A[i] <= 2 * cur:
cur += A[i]
else:
brea... | false | 11.428571 | [
"- if x == n - 1:",
"+ if x < 0:",
"+ return False",
"+ cur = C[x + 1]",
"+ for i in range(x + 1, n):",
"+ if A[i] <= 2 * cur:",
"+ cur += A[i]",
"+ else:",
"+ break",
"+ else:",
"- y = C[x + 1]",
"- flag = True",
"- for i in... | false | 0.079681 | 0.008288 | 9.613653 | [
"s468135231",
"s348131127"
] |
u581022379 | p03252 | python | s123730841 | s757302603 | 116 | 57 | 20,168 | 12,520 | Accepted | Accepted | 50.86 | S = eval(input())
T = eval(input())
a_idx = ord('a')
S_Lis = {0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [], 10: [], 11: [], 12: [],
13: [], 14: [], 15: [], 16: [], 17: [], 18: [], 19: [], 20: [], 21: [], 22: [], 23: [], 24: [], 25: []}
T_Lis = {0: [], 1: [], 2: [], 3: [], 4: [], 5:... | import collections
S = list(eval(input()))
T = list(eval(input()))
if sorted(collections.Counter(S).values()) == sorted(collections.Counter(T).values()):
print("Yes")
else:
print("No") | 15 | 7 | 692 | 186 | S = eval(input())
T = eval(input())
a_idx = ord("a")
S_Lis = {
0: [],
1: [],
2: [],
3: [],
4: [],
5: [],
6: [],
7: [],
8: [],
9: [],
10: [],
11: [],
12: [],
13: [],
14: [],
15: [],
16: [],
17: [],
18: [],
19: [],
20: [],
21: [],
... | import collections
S = list(eval(input()))
T = list(eval(input()))
if sorted(collections.Counter(S).values()) == sorted(collections.Counter(T).values()):
print("Yes")
else:
print("No")
| false | 53.333333 | [
"-S = eval(input())",
"-T = eval(input())",
"-a_idx = ord(\"a\")",
"-S_Lis = {",
"- 0: [],",
"- 1: [],",
"- 2: [],",
"- 3: [],",
"- 4: [],",
"- 5: [],",
"- 6: [],",
"- 7: [],",
"- 8: [],",
"- 9: [],",
"- 10: [],",
"- 11: [],",
"- 12: [],",
"- ... | false | 0.100178 | 0.062836 | 1.594271 | [
"s123730841",
"s757302603"
] |
u626337957 | p02959 | python | s810325092 | s134426173 | 177 | 162 | 18,476 | 18,476 | Accepted | Accepted | 8.47 | N = int(eval(input()))
M = list(map(int, input().split()))
H = list(map(int, input().split()))
sum_m = 0
killed = 0
rest = 0
for i in range(0, N):
killed = min(H[i]+rest, M[i])
rest = max(0, min(H[i]+rest-killed, H[i]))
sum_m += killed
sum_m += min(rest, M[-1])
print(sum_m)
| N = int(eval(input()))
M = list(map(int, input().split()))
H = list(map(int, input().split()))
sum_m = 0
killed = 0
rest = 0
for i in range(0, N):
killed = min(H[i]+rest, M[i])
rest = min(H[i]+rest-killed, H[i])
sum_m += killed
sum_m += min(rest, M[-1])
print(sum_m)
| 13 | 13 | 288 | 280 | N = int(eval(input()))
M = list(map(int, input().split()))
H = list(map(int, input().split()))
sum_m = 0
killed = 0
rest = 0
for i in range(0, N):
killed = min(H[i] + rest, M[i])
rest = max(0, min(H[i] + rest - killed, H[i]))
sum_m += killed
sum_m += min(rest, M[-1])
print(sum_m)
| N = int(eval(input()))
M = list(map(int, input().split()))
H = list(map(int, input().split()))
sum_m = 0
killed = 0
rest = 0
for i in range(0, N):
killed = min(H[i] + rest, M[i])
rest = min(H[i] + rest - killed, H[i])
sum_m += killed
sum_m += min(rest, M[-1])
print(sum_m)
| false | 0 | [
"- rest = max(0, min(H[i] + rest - killed, H[i]))",
"+ rest = min(H[i] + rest - killed, H[i])"
] | false | 0.04131 | 0.031826 | 1.298008 | [
"s810325092",
"s134426173"
] |
u546285759 | p00062 | python | s160580730 | s534455446 | 40 | 30 | 7,620 | 7,740 | Accepted | Accepted | 25 | import sys
for line in sys.stdin:
line = [int(v) for v in line.strip()]
while len(line) > 1:
line = [line[i]+line[i+1] for i in range(len(line)-1)]
print((str(line[0])[len(str(line[0]))-1])) | while True:
try:
nums = eval(input())
except:
break
a = list(map(int, list(nums)))
while len(a) > 1:
a = list(map(int, [str(a[i]+a[i+1])[-1] for i in range(len(a)-1)]))
print((*a)) | 7 | 9 | 215 | 224 | import sys
for line in sys.stdin:
line = [int(v) for v in line.strip()]
while len(line) > 1:
line = [line[i] + line[i + 1] for i in range(len(line) - 1)]
print((str(line[0])[len(str(line[0])) - 1]))
| while True:
try:
nums = eval(input())
except:
break
a = list(map(int, list(nums)))
while len(a) > 1:
a = list(map(int, [str(a[i] + a[i + 1])[-1] for i in range(len(a) - 1)]))
print((*a))
| false | 22.222222 | [
"-import sys",
"-",
"-for line in sys.stdin:",
"- line = [int(v) for v in line.strip()]",
"- while len(line) > 1:",
"- line = [line[i] + line[i + 1] for i in range(len(line) - 1)]",
"- print((str(line[0])[len(str(line[0])) - 1]))",
"+while True:",
"+ try:",
"+ nums = eval... | false | 0.127228 | 0.035207 | 3.613739 | [
"s160580730",
"s534455446"
] |
u077291787 | p03289 | python | s311448477 | s360513357 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | # ABC104B - AcCepted
s = input().rstrip()
if (
s[0] == "A"
and s[2:-1].count("C") == 1
and s.translate(str.maketrans({"A": None, "C": None})).islower()
):
print("AC")
else:
print("WA") | # ABC104B - AcCepted
def main():
S = input().rstrip()
flags = [S[0] == "A", S[2:-1].count("C") == 1, S.translate(str.maketrans({"A": None, "C": None})).islower()]
print(("AC" if all(flags) else "WA"))
if __name__ == "__main__":
main()
| 10 | 9 | 213 | 259 | # ABC104B - AcCepted
s = input().rstrip()
if (
s[0] == "A"
and s[2:-1].count("C") == 1
and s.translate(str.maketrans({"A": None, "C": None})).islower()
):
print("AC")
else:
print("WA")
| # ABC104B - AcCepted
def main():
S = input().rstrip()
flags = [
S[0] == "A",
S[2:-1].count("C") == 1,
S.translate(str.maketrans({"A": None, "C": None})).islower(),
]
print(("AC" if all(flags) else "WA"))
if __name__ == "__main__":
main()
| false | 10 | [
"-s = input().rstrip()",
"-if (",
"- s[0] == \"A\"",
"- and s[2:-1].count(\"C\") == 1",
"- and s.translate(str.maketrans({\"A\": None, \"C\": None})).islower()",
"-):",
"- print(\"AC\")",
"-else:",
"- print(\"WA\")",
"+def main():",
"+ S = input().rstrip()",
"+ flags = [",... | false | 0.0365 | 0.037432 | 0.975105 | [
"s311448477",
"s360513357"
] |
u067227603 | p02837 | python | s043741953 | s688173725 | 981 | 75 | 9,328 | 9,132 | Accepted | Accepted | 92.35 | N = int(eval(input()))
A = []
XY = []
honest_count = []
for i in range (N):
a = int(eval(input()))
A.append(a)
inter = []
for x in range(a):
xy = list(map(int, input().split()))
inter.append(xy)
XY.append(inter)
for i in range(2 ** N):
pt = [0] * N
ck = 1
... | import itertools
n = int(eval(input()))
l = []
for i in range(n):
d = int(eval(input()))
for dd in range(d):
x, y = list(map(int, input().split()))
l.append([i, x-1, y])
ans = 0
for p in itertools.product([0, 1], repeat=n):
for ll in l:
if p[ll[0]] == 1 and p[ll[1]] != l... | 31 | 17 | 657 | 382 | N = int(eval(input()))
A = []
XY = []
honest_count = []
for i in range(N):
a = int(eval(input()))
A.append(a)
inter = []
for x in range(a):
xy = list(map(int, input().split()))
inter.append(xy)
XY.append(inter)
for i in range(2**N):
pt = [0] * N
ck = 1
for j in range(N):
... | import itertools
n = int(eval(input()))
l = []
for i in range(n):
d = int(eval(input()))
for dd in range(d):
x, y = list(map(int, input().split()))
l.append([i, x - 1, y])
ans = 0
for p in itertools.product([0, 1], repeat=n):
for ll in l:
if p[ll[0]] == 1 and p[ll[1]] != ll[2]:
... | false | 45.16129 | [
"-N = int(eval(input()))",
"-A = []",
"-XY = []",
"-honest_count = []",
"-for i in range(N):",
"- a = int(eval(input()))",
"- A.append(a)",
"- inter = []",
"- for x in range(a):",
"- xy = list(map(int, input().split()))",
"- inter.append(xy)",
"- XY.append(inter)",... | false | 0.045729 | 0.037227 | 1.228384 | [
"s043741953",
"s688173725"
] |
u317779196 | p02623 | python | s749520665 | s690126984 | 831 | 237 | 53,232 | 53,460 | Accepted | Accepted | 71.48 | '''ABC172 C'''
import numpy as np
n,m,k = list(map(int,input().split()))
a = np.array([int(i) for i in input().split()], dtype='int64')
b = np.array([int(i) for i in input().split()], dtype='int64')
a_c = np.zeros(n+1,dtype='int64')
a_c[1:] = np.cumsum(a)
b_c = np.zeros(m+1,dtype='int64')
b_c[1:] = np.cumsu... | import numpy as np
n,m,k = list(map(int,input().split()))
a = np.array([int(i) for i in input().split()], dtype='int64')
b = np.array([int(i) for i in input().split()], dtype='int64')
# 読まないという選択肢を先頭に入れておく
a_c = np.zeros(n+1,dtype='int64')
a_c[1:] = np.cumsum(a)
b_c = np.zeros(m+1,dtype='int64')
b_c[1:] = n... | 19 | 18 | 495 | 478 | """ABC172 C"""
import numpy as np
n, m, k = list(map(int, input().split()))
a = np.array([int(i) for i in input().split()], dtype="int64")
b = np.array([int(i) for i in input().split()], dtype="int64")
a_c = np.zeros(n + 1, dtype="int64")
a_c[1:] = np.cumsum(a)
b_c = np.zeros(m + 1, dtype="int64")
b_c[1:] = np.cumsum(... | import numpy as np
n, m, k = list(map(int, input().split()))
a = np.array([int(i) for i in input().split()], dtype="int64")
b = np.array([int(i) for i in input().split()], dtype="int64")
# 読まないという選択肢を先頭に入れておく
a_c = np.zeros(n + 1, dtype="int64")
a_c[1:] = np.cumsum(a)
b_c = np.zeros(m + 1, dtype="int64")
b_c[1:] = np.... | false | 5.263158 | [
"-\"\"\"ABC172 C\"\"\"",
"+# 読まないという選択肢を先頭に入れておく",
"-ans = 0",
"-for i, ai in enumerate(a_c):",
"- n = np.searchsorted(b_c, k - ai, side=\"right\")",
"- ans = max(i + n - 1, ans)",
"-print(ans)",
"+ans_l = np.searchsorted(b_c, k - a_c, side=\"right\") - 1",
"+ans_l += np.arange(len(a_c))",
"... | false | 0.173839 | 0.182979 | 0.950052 | [
"s749520665",
"s690126984"
] |
u606045429 | p02889 | python | s390715574 | s903608276 | 861 | 769 | 40,856 | 40,776 | Accepted | Accepted | 10.69 | from scipy.sparse.csgraph import floyd_warshall
N, M, L, *I = list(map(int, open(0).read().split()))
ABC, ST = I[:3 * M], I[3 * M + 1:]
E = [[0] * N for _ in range(N)]
for a, b, c in zip(*[iter(ABC)] * 3):
E[a - 1][b - 1] = E[b - 1][a - 1] = c
E = floyd_warshall(E)
for i in range(N):
for j in ra... | from scipy.sparse.csgraph import floyd_warshall
N, M, L, *I = list(map(int, open(0).read().split()))
ABC, ST = I[:3 * M], I[3 * M + 1:]
E = [[0] * N for _ in range(N)]
for a, b, c in zip(*[iter(ABC)] * 3):
E[a - 1][b - 1] = E[b - 1][a - 1] = c
E = floyd_warshall(E)
for i in range(N):
for j in ra... | 22 | 25 | 508 | 548 | from scipy.sparse.csgraph import floyd_warshall
N, M, L, *I = list(map(int, open(0).read().split()))
ABC, ST = I[: 3 * M], I[3 * M + 1 :]
E = [[0] * N for _ in range(N)]
for a, b, c in zip(*[iter(ABC)] * 3):
E[a - 1][b - 1] = E[b - 1][a - 1] = c
E = floyd_warshall(E)
for i in range(N):
for j in range(N):
... | from scipy.sparse.csgraph import floyd_warshall
N, M, L, *I = list(map(int, open(0).read().split()))
ABC, ST = I[: 3 * M], I[3 * M + 1 :]
E = [[0] * N for _ in range(N)]
for a, b, c in zip(*[iter(ABC)] * 3):
E[a - 1][b - 1] = E[b - 1][a - 1] = c
E = floyd_warshall(E)
for i in range(N):
for j in range(N):
... | false | 12 | [
"+A = []",
"- print((-1 if a == INF else int(a)))",
"+ A.append(\"-1\" if a == INF else str(int(a)))",
"+print((\"\\n\".join(A)))"
] | false | 0.776715 | 0.369282 | 2.103312 | [
"s390715574",
"s903608276"
] |
u864197622 | p03181 | python | s923945360 | s606157503 | 575 | 531 | 85,556 | 80,424 | Accepted | Accepted | 7.65 | import sys
input = sys.stdin.readline
from collections import deque
nn = 200200
mod = 10**9+7
fa = [1] * (nn+1)
fainv = [1] * (nn+1)
for i in range(nn):
fa[i+1] = fa[i] * (i+1) % mod
fainv[-1] = pow(fa[-1], mod-2, mod)
for i in range(nn)[::-1]:
fainv[i] = fainv[i+1] * (i+1) % mod
inv = lambda ... | import sys
input = sys.stdin.readline
from collections import deque
N, M = map(int, input().split())
X = [[] for i in range(N)]
for i in range(N-1):
x, y = map(int, input().split())
X[x-1].append(y-1)
X[y-1].append(x-1)
P = [-1] * N
Q = deque([0])
R = []
while Q:
i = deque.popleft(Q)
... | 71 | 51 | 1,493 | 1,080 | import sys
input = sys.stdin.readline
from collections import deque
nn = 200200
mod = 10**9 + 7
fa = [1] * (nn + 1)
fainv = [1] * (nn + 1)
for i in range(nn):
fa[i + 1] = fa[i] * (i + 1) % mod
fainv[-1] = pow(fa[-1], mod - 2, mod)
for i in range(nn)[::-1]:
fainv[i] = fainv[i + 1] * (i + 1) % mod
inv = lambda ... | import sys
input = sys.stdin.readline
from collections import deque
N, M = map(int, input().split())
X = [[] for i in range(N)]
for i in range(N - 1):
x, y = map(int, input().split())
X[x - 1].append(y - 1)
X[y - 1].append(x - 1)
P = [-1] * N
Q = deque([0])
R = []
while Q:
i = deque.popleft(Q)
R.a... | false | 28.169014 | [
"-nn = 200200",
"-mod = 10**9 + 7",
"-fa = [1] * (nn + 1)",
"-fainv = [1] * (nn + 1)",
"-for i in range(nn):",
"- fa[i + 1] = fa[i] * (i + 1) % mod",
"-fainv[-1] = pow(fa[-1], mod - 2, mod)",
"-for i in range(nn)[::-1]:",
"- fainv[i] = fainv[i + 1] * (i + 1) % mod",
"-inv = lambda i: fainv[i... | false | 0.391961 | 0.088806 | 4.413684 | [
"s923945360",
"s606157503"
] |
u133936772 | p02983 | python | s901635596 | s604150031 | 34 | 18 | 2,940 | 3,060 | Accepted | Accepted | 47.06 | L,R=list(map(int,input().split()))
M=2019;l=L%M;r=R%M
print((0 if l>r or R-L>671 else min(i*j%M for i in range(l,r) for j in range(i+1,r+1)))) | M=2019;L,R=list(map(int,input().split()))
l=L%M;r=R%M;a=M-1
if l<r and R-L<672:
for i in range(l,r):
for j in range(i+1,r+1):
a=min(a,i*j%M)
if a<2: break
if a<2: break
else: a=0
print(a) | 3 | 10 | 136 | 212 | L, R = list(map(int, input().split()))
M = 2019
l = L % M
r = R % M
print(
(
0
if l > r or R - L > 671
else min(i * j % M for i in range(l, r) for j in range(i + 1, r + 1))
)
)
| M = 2019
L, R = list(map(int, input().split()))
l = L % M
r = R % M
a = M - 1
if l < r and R - L < 672:
for i in range(l, r):
for j in range(i + 1, r + 1):
a = min(a, i * j % M)
if a < 2:
break
if a < 2:
break
else:
a = 0
print(a)
| false | 70 | [
"+M = 2019",
"-M = 2019",
"-print(",
"- (",
"- 0",
"- if l > r or R - L > 671",
"- else min(i * j % M for i in range(l, r) for j in range(i + 1, r + 1))",
"- )",
"-)",
"+a = M - 1",
"+if l < r and R - L < 672:",
"+ for i in range(l, r):",
"+ for j in rang... | false | 0.032367 | 0.036124 | 0.895987 | [
"s901635596",
"s604150031"
] |
u893063840 | p03480 | python | s792538413 | s762497019 | 57 | 29 | 3,188 | 3,188 | Accepted | Accepted | 49.12 | s = eval(input())
l = len(s)
ans = l
for i, (e1, e2) in enumerate(zip(s, s[1:]), 1):
if e1 != e2:
ans = min(ans, max(i, l - i))
print(ans)
| s = eval(input())
l = len(s)
center = s[l // 2]
cnt = l % 2
for e1, e2 in zip(s[:l//2][::-1], s[l//2+l%2:]):
if center == e1 == e2:
cnt += 2
else:
break
ans = (l + cnt) // 2
print(ans)
| 9 | 13 | 155 | 217 | s = eval(input())
l = len(s)
ans = l
for i, (e1, e2) in enumerate(zip(s, s[1:]), 1):
if e1 != e2:
ans = min(ans, max(i, l - i))
print(ans)
| s = eval(input())
l = len(s)
center = s[l // 2]
cnt = l % 2
for e1, e2 in zip(s[: l // 2][::-1], s[l // 2 + l % 2 :]):
if center == e1 == e2:
cnt += 2
else:
break
ans = (l + cnt) // 2
print(ans)
| false | 30.769231 | [
"-ans = l",
"-for i, (e1, e2) in enumerate(zip(s, s[1:]), 1):",
"- if e1 != e2:",
"- ans = min(ans, max(i, l - i))",
"+center = s[l // 2]",
"+cnt = l % 2",
"+for e1, e2 in zip(s[: l // 2][::-1], s[l // 2 + l % 2 :]):",
"+ if center == e1 == e2:",
"+ cnt += 2",
"+ else:",
"... | false | 0.006088 | 0.052699 | 0.115524 | [
"s792538413",
"s762497019"
] |
u352394527 | p00501 | python | s386055148 | s610875754 | 90 | 60 | 5,616 | 5,616 | Accepted | Accepted | 33.33 | n = int(eval(input()))
name = eval(input())
length = len(name)
def check(ss):
ind = 0
end = len(ss)
while ind < end:
while ind < end and ss[ind] != name[0]:
ind += 1
for i in range(100):
j1 = ind
j2 = 0
while j1 < end and j2 < length and ss[j1] == name[j2]:
... | def main():
n = int(eval(input()))
name = eval(input())
length = len(name)
def check(ss):
ind = 0
end = len(ss)
while ind < end:
while ind < end and ss[ind] != name[0]:
ind += 1
for i in range(100):
j1 = ind
j2 = 0
while j1 < end and j... | 22 | 24 | 461 | 526 | n = int(eval(input()))
name = eval(input())
length = len(name)
def check(ss):
ind = 0
end = len(ss)
while ind < end:
while ind < end and ss[ind] != name[0]:
ind += 1
for i in range(100):
j1 = ind
j2 = 0
while j1 < end and j2 < length and ss[j... | def main():
n = int(eval(input()))
name = eval(input())
length = len(name)
def check(ss):
ind = 0
end = len(ss)
while ind < end:
while ind < end and ss[ind] != name[0]:
ind += 1
for i in range(100):
j1 = ind
... | false | 8.333333 | [
"-n = int(eval(input()))",
"-name = eval(input())",
"-length = len(name)",
"+def main():",
"+ n = int(eval(input()))",
"+ name = eval(input())",
"+ length = len(name)",
"+",
"+ def check(ss):",
"+ ind = 0",
"+ end = len(ss)",
"+ while ind < end:",
"+ ... | false | 0.048106 | 0.048863 | 0.984512 | [
"s386055148",
"s610875754"
] |
u641082901 | p02414 | python | s473627577 | s407154624 | 570 | 140 | 7,048 | 7,000 | Accepted | Accepted | 75.44 | n, m, l = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(m)]
ans = [[0 for _ in range(l)] for _ in range(n)]
for i in range(n) :
for j in range(l) :
for k in range(m) :
ans[i][j] += a[i][k] * b[k][j]
... | n, m, l = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(m)]
[print(*x) for x in [[sum(j*k for j,k in zip(x,y)) for y in zip(*b)] for x in a]]
| 9 | 4 | 349 | 233 | n, m, l = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(m)]
ans = [[0 for _ in range(l)] for _ in range(n)]
for i in range(n):
for j in range(l):
for k in range(m):
ans[i][j] += a[i][k] * b[k][j]
print(*a... | n, m, l = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(m)]
[print(*x) for x in [[sum(j * k for j, k in zip(x, y)) for y in zip(*b)] for x in a]]
| false | 55.555556 | [
"-ans = [[0 for _ in range(l)] for _ in range(n)]",
"-for i in range(n):",
"- for j in range(l):",
"- for k in range(m):",
"- ans[i][j] += a[i][k] * b[k][j]",
"- print(*ans[i], sep=\" \")",
"+[print(*x) for x in [[sum(j * k for j, k in zip(x, y)) for y in zip(*b)] for x in a]]"
] | false | 0.098765 | 0.083906 | 1.177093 | [
"s473627577",
"s407154624"
] |
u645250356 | p03095 | python | s605901415 | s952867449 | 291 | 47 | 65,516 | 10,392 | Accepted | Accepted | 83.85 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.std... | 18 | 20 | 514 | 490 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.read... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map... | false | 10 | [
"-from heapq import heappop, heappush, heapify",
"-import sys, bisect, math, itertools, fractions, pprint",
"+from heapq import heappop, heappush",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions",
"-def inpln(n):",
"- return list(int(sys.stdin.readline()) fo... | false | 0.04154 | 0.064305 | 0.645992 | [
"s605901415",
"s952867449"
] |
u994521204 | p02910 | python | s306980432 | s670630089 | 168 | 17 | 38,384 | 2,940 | Accepted | Accepted | 89.88 | s=eval(input())
flag=0
for i in range(len(s)):
if i%2==0:
if s[i]=='L':
flag+=1
if i%2==1:
if s[i]=='R':
flag+=1
print(('Yes' if flag==0 else 'No'))
| s = eval(input())
n = len(s)
kisu = ["R", "U", "D"]
gusu = ["L", "U", "D"]
for i in range(n):
if i % 2 == 0:
if s[i] in kisu:
continue
else:
if s[i] in gusu:
continue
print("No")
exit()
print("Yes")
| 11 | 14 | 181 | 262 | s = eval(input())
flag = 0
for i in range(len(s)):
if i % 2 == 0:
if s[i] == "L":
flag += 1
if i % 2 == 1:
if s[i] == "R":
flag += 1
print(("Yes" if flag == 0 else "No"))
| s = eval(input())
n = len(s)
kisu = ["R", "U", "D"]
gusu = ["L", "U", "D"]
for i in range(n):
if i % 2 == 0:
if s[i] in kisu:
continue
else:
if s[i] in gusu:
continue
print("No")
exit()
print("Yes")
| false | 21.428571 | [
"-flag = 0",
"-for i in range(len(s)):",
"+n = len(s)",
"+kisu = [\"R\", \"U\", \"D\"]",
"+gusu = [\"L\", \"U\", \"D\"]",
"+for i in range(n):",
"- if s[i] == \"L\":",
"- flag += 1",
"- if i % 2 == 1:",
"- if s[i] == \"R\":",
"- flag += 1",
"-print((\"Yes... | false | 0.037697 | 0.038402 | 0.981634 | [
"s306980432",
"s670630089"
] |
u044632922 | p03631 | python | s306622887 | s589226164 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a=eval(input())
print(('YNeos'[1-(a==a[::-1])::2])) | n=eval(input())
print(('Yes' if n[0]==n[2] else 'No')) | 2 | 2 | 44 | 47 | a = eval(input())
print(("YNeos"[1 - (a == a[::-1]) :: 2]))
| n = eval(input())
print(("Yes" if n[0] == n[2] else "No"))
| false | 0 | [
"-a = eval(input())",
"-print((\"YNeos\"[1 - (a == a[::-1]) :: 2]))",
"+n = eval(input())",
"+print((\"Yes\" if n[0] == n[2] else \"No\"))"
] | false | 0.041033 | 0.040759 | 1.006727 | [
"s306622887",
"s589226164"
] |
u886878171 | p03494 | python | s686868984 | s104994894 | 181 | 28 | 39,664 | 9,160 | Accepted | Accepted | 84.53 | N = eval(input())
A = list(map(int,input().split()))
count = 0
exist_odd = False
while (exist_odd == False):
for x in A:
if x % 2 != 0:
exist_odd = True
if exist_odd == True:
break
else:
A = [x/2 for x in A]
count += 1
print(count)
| N = int(eval(input()))
A = list(map(int,input().split()))
count = 0
flag = True
while(flag):
for i in range(N):
if A[i] % 2 == 0:
A[i] = A[i]/2
else:
flag = False
break
if flag == True:
count+=1
print(count) | 17 | 14 | 284 | 282 | N = eval(input())
A = list(map(int, input().split()))
count = 0
exist_odd = False
while exist_odd == False:
for x in A:
if x % 2 != 0:
exist_odd = True
if exist_odd == True:
break
else:
A = [x / 2 for x in A]
count += 1
print(count)
| N = int(eval(input()))
A = list(map(int, input().split()))
count = 0
flag = True
while flag:
for i in range(N):
if A[i] % 2 == 0:
A[i] = A[i] / 2
else:
flag = False
break
if flag == True:
count += 1
print(count)
| false | 17.647059 | [
"-N = eval(input())",
"+N = int(eval(input()))",
"-exist_odd = False",
"-while exist_odd == False:",
"- for x in A:",
"- if x % 2 != 0:",
"- exist_odd = True",
"- if exist_odd == True:",
"- break",
"- else:",
"- A = [x / 2 for x in A]",
"- count += 1... | false | 0.03699 | 0.041187 | 0.8981 | [
"s686868984",
"s104994894"
] |
u119982001 | p02690 | python | s233278744 | s761984261 | 1,143 | 42 | 9,160 | 9,160 | Accepted | Accepted | 96.33 | X=int(eval(input()))
for i in range(-1000,1000):
for j in range(-1000,1000):
if X == (i**5-j**5):
print((i, j))
exit()
| X=int(eval(input()))
for i in range(200):
for j in range(-200,200):
if X == (i**5-j**5):
print((i, j))
exit()
| 7 | 7 | 154 | 145 | X = int(eval(input()))
for i in range(-1000, 1000):
for j in range(-1000, 1000):
if X == (i**5 - j**5):
print((i, j))
exit()
| X = int(eval(input()))
for i in range(200):
for j in range(-200, 200):
if X == (i**5 - j**5):
print((i, j))
exit()
| false | 0 | [
"-for i in range(-1000, 1000):",
"- for j in range(-1000, 1000):",
"+for i in range(200):",
"+ for j in range(-200, 200):"
] | false | 2.684478 | 0.007485 | 358.62935 | [
"s233278744",
"s761984261"
] |
u409064224 | p03013 | python | s573217699 | s697310925 | 474 | 180 | 460,020 | 6,900 | Accepted | Accepted | 62.03 | n,m = list(map(int,input().split()))
l = [1]*(n+1)
#kubaru_dp = [1]*n
for i in range(m):
a = int(eval(input()))
l[a] = 0
# l = [1,1,1,0,1,1,1]
for i in range(2,n+1):
if l[i]==0:
continue
l[i] = l[i-1]+l[i-2]
else:
print((l[-1]%(10**9+7)))
| n,m = list(map(int,input().split()))
l = [1]*(n+1)
#kubaru_dp = [1]*n
for i in range(m):
a = int(eval(input()))
l[a] = 0
# l = [1,1,1,0,1,1,1]
for i in range(2,n+1):
if l[i]==0:
continue
l[i] = (l[i-1]+l[i-2])%(10**9+7)
else:
print((l[-1]%(10**9+7)))
| 15 | 15 | 269 | 281 | n, m = list(map(int, input().split()))
l = [1] * (n + 1)
# kubaru_dp = [1]*n
for i in range(m):
a = int(eval(input()))
l[a] = 0
# l = [1,1,1,0,1,1,1]
for i in range(2, n + 1):
if l[i] == 0:
continue
l[i] = l[i - 1] + l[i - 2]
else:
print((l[-1] % (10**9 + 7)))
| n, m = list(map(int, input().split()))
l = [1] * (n + 1)
# kubaru_dp = [1]*n
for i in range(m):
a = int(eval(input()))
l[a] = 0
# l = [1,1,1,0,1,1,1]
for i in range(2, n + 1):
if l[i] == 0:
continue
l[i] = (l[i - 1] + l[i - 2]) % (10**9 + 7)
else:
print((l[-1] % (10**9 + 7)))
| false | 0 | [
"- l[i] = l[i - 1] + l[i - 2]",
"+ l[i] = (l[i - 1] + l[i - 2]) % (10**9 + 7)"
] | false | 0.125848 | 0.035012 | 3.594443 | [
"s573217699",
"s697310925"
] |
u698916859 | p03610 | python | s183618691 | s100568113 | 29 | 25 | 9,036 | 9,020 | Accepted | Accepted | 13.79 | s = eval(input())
print((s[0:len(s)+1:2])) | s = str(eval(input()))
print((s[::2])) | 2 | 3 | 35 | 34 | s = eval(input())
print((s[0 : len(s) + 1 : 2]))
| s = str(eval(input()))
print((s[::2]))
| false | 33.333333 | [
"-s = eval(input())",
"-print((s[0 : len(s) + 1 : 2]))",
"+s = str(eval(input()))",
"+print((s[::2]))"
] | false | 0.046268 | 0.045117 | 1.025512 | [
"s183618691",
"s100568113"
] |
u098012509 | p03665 | python | s809163090 | s974958693 | 21 | 18 | 3,316 | 3,064 | Accepted | Accepted | 14.29 | N, P = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
import collections
import math
c = collections.Counter()
for a in A:
c[a % 2] += 1
ans = 0
if P == 0:
ans1 = 0
for i in range(0, c[1] + 1, 2):
ans1 += math.factorial(c[1]) / math.factorial(i) / math.fac... | import sys
import math
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
N, P = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
odd = 0
even = 0
ans = 0
def comb(n, r):
return math.factorial(n) // math.factorial(r) // math.... | 31 | 37 | 791 | 815 | N, P = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
import collections
import math
c = collections.Counter()
for a in A:
c[a % 2] += 1
ans = 0
if P == 0:
ans1 = 0
for i in range(0, c[1] + 1, 2):
ans1 += math.factorial(c[1]) / math.factorial(i) / math.factorial(c[1] - i)
... | import sys
import math
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
N, P = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
odd = 0
even = 0
ans = 0
def comb(n, r):
return math.factorial(n) // math.factorial(r) // math.factorial(n - r)
... | false | 16.216216 | [
"-N, P = [int(x) for x in input().split()]",
"-A = [int(x) for x in input().split()]",
"-import collections",
"+import sys",
"-c = collections.Counter()",
"-for a in A:",
"- c[a % 2] += 1",
"-ans = 0",
"-if P == 0:",
"- ans1 = 0",
"- for i in range(0, c[1] + 1, 2):",
"- ans1 +=... | false | 0.049857 | 0.046229 | 1.078482 | [
"s809163090",
"s974958693"
] |
u022407960 | p02319 | python | s446365686 | s796169115 | 670 | 610 | 19,508 | 19,392 | Accepted | Accepted | 8.96 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
2 20
5 9
4 10
output:
9
1 ??? N ??? 100
1 ??? vi ??? 100
1 ??? wi ??? 10,000,000
1 ??? W ??? 1,000,000,000
"""
import sys
from collections import namedtuple
MAX_N, MAX_V = 100, 100
def solve():
dp = [[float('inf')] * (MAX_N * M... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
2 20
5 9
4 10
output:
9
1 ??? N ??? 100
1 ??? vi ??? 100
1 ??? wi ??? 10,000,000
1 ??? W ??? 1,000,000,000
"""
import sys
from collections import namedtuple
MAX_V = 100
def solve():
dp = [[float('inf')] * (c_items * MAX_V + 1) ... | 52 | 52 | 1,084 | 1,088 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
2 20
5 9
4 10
output:
9
1 ??? N ??? 100
1 ??? vi ??? 100
1 ??? wi ??? 10,000,000
1 ??? W ??? 1,000,000,000
"""
import sys
from collections import namedtuple
MAX_N, MAX_V = 100, 100
def solve():
dp = [[float("inf")] * (MAX_N * MAX_V + 1) for _ in range(MAX_... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
2 20
5 9
4 10
output:
9
1 ??? N ??? 100
1 ??? vi ??? 100
1 ??? wi ??? 10,000,000
1 ??? W ??? 1,000,000,000
"""
import sys
from collections import namedtuple
MAX_V = 100
def solve():
dp = [[float("inf")] * (c_items * MAX_V + 1) for _ in range(c_items + 1)]
... | false | 0 | [
"-MAX_N, MAX_V = 100, 100",
"+MAX_V = 100",
"- dp = [[float(\"inf\")] * (MAX_N * MAX_V + 1) for _ in range(MAX_N + 1)]",
"+ dp = [[float(\"inf\")] * (c_items * MAX_V + 1) for _ in range(c_items + 1)]",
"- for j in range(MAX_N * MAX_V + 1):",
"+ for j in range(c_items * MAX_V + 1):",
... | false | 0.066418 | 0.039903 | 1.664501 | [
"s446365686",
"s796169115"
] |
u537976628 | p03220 | python | s406813076 | s438857329 | 29 | 24 | 9,212 | 9,140 | Accepted | Accepted | 17.24 | n = int(eval(input()))
t, a = list(map(int, input().split()))
H = list(map(int, input().split()))
ABS = []
for i in H:
ABS.append(abs((t-i*0.006) - a))
print((ABS.index(min(ABS)) + 1)) | n = int(eval(input()))
t, a = list(map(int, input().split()))
H = list(map(int, input().split()))
mtd = 1000
for i in range(n):
if abs(a - (t - (H[i] * 0.006))) < mtd:
mtd = abs(a - (t - (H[i] * 0.006)))
ans = i + 1
print(ans) | 7 | 9 | 180 | 242 | n = int(eval(input()))
t, a = list(map(int, input().split()))
H = list(map(int, input().split()))
ABS = []
for i in H:
ABS.append(abs((t - i * 0.006) - a))
print((ABS.index(min(ABS)) + 1))
| n = int(eval(input()))
t, a = list(map(int, input().split()))
H = list(map(int, input().split()))
mtd = 1000
for i in range(n):
if abs(a - (t - (H[i] * 0.006))) < mtd:
mtd = abs(a - (t - (H[i] * 0.006)))
ans = i + 1
print(ans)
| false | 22.222222 | [
"-ABS = []",
"-for i in H:",
"- ABS.append(abs((t - i * 0.006) - a))",
"-print((ABS.index(min(ABS)) + 1))",
"+mtd = 1000",
"+for i in range(n):",
"+ if abs(a - (t - (H[i] * 0.006))) < mtd:",
"+ mtd = abs(a - (t - (H[i] * 0.006)))",
"+ ans = i + 1",
"+print(ans)"
] | false | 0.047174 | 0.049101 | 0.960741 | [
"s406813076",
"s438857329"
] |
u764956288 | p02659 | python | s143601957 | s311036634 | 25 | 23 | 9,172 | 9,100 | Accepted | Accepted | 8 | # import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))
# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))
def solve():
N, M = input().split()
n = int(N)
f = float(M)
m = int(f * 10... | def solve():
N, M = input().split()
n = int(N)
m = int(M.replace('.', ''))
return n * m // 100
def main():
print((solve()))
if __name__ == "__main__":
main()
| 26 | 15 | 452 | 200 | # import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))
# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))
def solve():
N, M = input().split()
n = int(N)
f = float(M)
m = int(f * 100 + 0.1)
ans =... | def solve():
N, M = input().split()
n = int(N)
m = int(M.replace(".", ""))
return n * m // 100
def main():
print((solve()))
if __name__ == "__main__":
main()
| false | 42.307692 | [
"-# import sys",
"-# readline = sys.stdin.readline",
"-# generator = (readline().strip() for _ in range(N))",
"-# N, M = map(int, input().split())",
"-# As = list(map(int, input().split()))",
"-# queries = (input() for _ in range(N))",
"- f = float(M)",
"- m = int(f * 100 + 0.1)",
"- ans = ... | false | 0.045725 | 0.064792 | 0.705714 | [
"s143601957",
"s311036634"
] |
u535171899 | p02768 | python | s058013504 | s876308081 | 1,206 | 123 | 9,188 | 9,140 | Accepted | Accepted | 89.8 | def main():
#input data
import sys
input = lambda:sys.stdin.readline().strip()
N,A,B = list(map(int,input().split()))
mod=10**9+7
#solve
#二項係数の和=2**n
#2**n-1-nCa-nCb
def cmb(n, r, mod=10**9+7):
r = min(r, n-r)
res = 1
for i in range(r):
... | def main():
#input data
import sys
input = lambda:sys.stdin.readline().strip()
N,A,B = list(map(int,input().split()))
mod=10**9+7
#solve
#二項係数の和=2**n
#2**n-1-nCa-nCb
def cmb(n, r, mod=10**9+7):
c = 1
m = 1
r = min(n - r, r)
for... | 22 | 25 | 520 | 576 | def main():
# input data
import sys
input = lambda: sys.stdin.readline().strip()
N, A, B = list(map(int, input().split()))
mod = 10**9 + 7
# solve
# 二項係数の和=2**n
# 2**n-1-nCa-nCb
def cmb(n, r, mod=10**9 + 7):
r = min(r, n - r)
res = 1
for i in range(r):
... | def main():
# input data
import sys
input = lambda: sys.stdin.readline().strip()
N, A, B = list(map(int, input().split()))
mod = 10**9 + 7
# solve
# 二項係数の和=2**n
# 2**n-1-nCa-nCb
def cmb(n, r, mod=10**9 + 7):
c = 1
m = 1
r = min(n - r, r)
for i in rang... | false | 12 | [
"- r = min(r, n - r)",
"- res = 1",
"+ c = 1",
"+ m = 1",
"+ r = min(n - r, r)",
"- res = res * (n - i) * pow(i + 1, mod - 2, mod) % mod",
"- return res",
"+ c = c * (n - i) % mod",
"+ m = m * (i + 1) % mod",
"+ retu... | false | 0.518752 | 0.113431 | 4.573259 | [
"s058013504",
"s876308081"
] |
u709304134 | p02690 | python | s847137300 | s462724663 | 33 | 30 | 9,052 | 9,196 | Accepted | Accepted | 9.09 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
INF = 10**10
MOD = 10**9 + 7
X = int(eval(input()))
MAX_X = 10**9
n = 0
while(1):
n+=1
if n**5 - (n-1)**5 > MAX_X:
break
for i in range(n):
for j in range(-n+1,n-1):
if i**5 - j**5 == X:
print((i,j)... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
INF = 10**10
MOD = 10**9 + 7
X = int(eval(input()))
MAX_X = 10**9
n = 0
while(1):
n+=1
if n**5 - (n-1)**5 > MAX_X:
break
for i in range(n):
#for j in range(-n+1,n-1):
for j in range(-64,n-1):
if i**5 - j**5... | 18 | 19 | 339 | 370 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
INF = 10**10
MOD = 10**9 + 7
X = int(eval(input()))
MAX_X = 10**9
n = 0
while 1:
n += 1
if n**5 - (n - 1) ** 5 > MAX_X:
break
for i in range(n):
for j in range(-n + 1, n - 1):
if i**5 - j**5 == X:
print((i, j))
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
INF = 10**10
MOD = 10**9 + 7
X = int(eval(input()))
MAX_X = 10**9
n = 0
while 1:
n += 1
if n**5 - (n - 1) ** 5 > MAX_X:
break
for i in range(n):
# for j in range(-n+1,n-1):
for j in range(-64, n - 1):
if i**5 - j**5 == X... | false | 5.263158 | [
"- for j in range(-n + 1, n - 1):",
"+ # for j in range(-n+1,n-1):",
"+ for j in range(-64, n - 1):"
] | false | 0.039713 | 0.04946 | 0.802925 | [
"s847137300",
"s462724663"
] |
u716530146 | p02703 | python | s768605384 | s115583696 | 907 | 833 | 97,092 | 97,080 | Accepted | Accepted | 8.16 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect, heapq
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n,m,s0 = list(map(int,input().split()))
s0 = min(2500,s0)
G = [[] for i in range(n)]
for... | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect, heapq
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n,m,s0 = list(map(int,input().split()))
s0 = min(2500,s0)
G = [[] for i in range(n)]
for... | 46 | 38 | 1,144 | 1,081 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect, heapq
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n, m, s0 = list(map(int, input().split()))
s0 = min(2500, s0)
G = [[] for i in range(n)]
for i in r... | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect, heapq
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n, m, s0 = list(map(int, input().split()))
s0 = min(2500, s0)
G = [[] for i in range(n)]
for i in r... | false | 17.391304 | [
"-def ceil(x, y):",
"- return (x - 1) // y + 1",
"-",
"-",
"-# print(dist)"
] | false | 0.113632 | 0.114905 | 0.988919 | [
"s768605384",
"s115583696"
] |
u226108478 | p03231 | python | s184474604 | s445567826 | 86 | 43 | 5,716 | 5,588 | Accepted | Accepted | 50 | # -*- coding: utf-8 -*-
def lcm(x: int, y: int):
'''
See:
https://note.nkmk.me/python-gcd-lcm/
'''
from fractions import gcd
return (x * y) // gcd(x, y)
def main():
n, m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
size = lcm(n, m)
... | # -*- coding: utf-8 -*-
def lcm(x: int, y: int):
'''
See:
https://note.nkmk.me/python-gcd-lcm/
'''
from fractions import gcd
return (x * y) // gcd(x, y)
def main():
n, m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
size = lcm(n, m)
... | 38 | 30 | 675 | 575 | # -*- coding: utf-8 -*-
def lcm(x: int, y: int):
"""
See:
https://note.nkmk.me/python-gcd-lcm/
"""
from fractions import gcd
return (x * y) // gcd(x, y)
def main():
n, m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
size = lcm(n, m)
dn = size // n
... | # -*- coding: utf-8 -*-
def lcm(x: int, y: int):
"""
See:
https://note.nkmk.me/python-gcd-lcm/
"""
from fractions import gcd
return (x * y) // gcd(x, y)
def main():
n, m = list(map(int, input().split()))
s = eval(input())
t = eval(input())
size = lcm(n, m)
part_s = [s[i] f... | false | 21.052632 | [
"- dn = size // n",
"- dm = size // m",
"- part_s = list()",
"- part_t = list()",
"- for i in range(0, n, dm):",
"- part_s.append(s[i])",
"- for i in range(0, m, dn):",
"- part_t.append(t[i])",
"+ part_s = [s[i] for i in range(0, n, size // m)]",
"+ part_t = [... | false | 0.00737 | 0.036184 | 0.203666 | [
"s184474604",
"s445567826"
] |
u508732591 | p02315 | python | s579738388 | s495442410 | 950 | 850 | 25,940 | 25,932 | Accepted | Accepted | 10.53 | N,W = list(map(int, input().split()))
v = [0] * (N+1)
w = [0] * (N+1)
dp = [[0 for x in range(W+1)] for y in range(N+1)]
for i in range(1,N+1):
v[i], w[i] = list(map(int, input().split()))
for i in range(1,N+1):
for j in range(W+1):
if j < w[i]:
dp[i][j] = dp[i-1][j]
el... | N,W = list(map(int, input().split()))
dp = [[0 for x in range(W+1)] for y in range(N+1)]
for i in range(1,N+1):
v, w = list(map(int, input().split()))
for j in range(W+1):
if j < w:
dp[i][j] = dp[i-1][j]
else:
dp[i][j] = max(dp[i-1][j],dp[i-1][j-w]+v)
print((... | 16 | 12 | 391 | 316 | N, W = list(map(int, input().split()))
v = [0] * (N + 1)
w = [0] * (N + 1)
dp = [[0 for x in range(W + 1)] for y in range(N + 1)]
for i in range(1, N + 1):
v[i], w[i] = list(map(int, input().split()))
for i in range(1, N + 1):
for j in range(W + 1):
if j < w[i]:
dp[i][j] = dp[i - 1][j]
... | N, W = list(map(int, input().split()))
dp = [[0 for x in range(W + 1)] for y in range(N + 1)]
for i in range(1, N + 1):
v, w = list(map(int, input().split()))
for j in range(W + 1):
if j < w:
dp[i][j] = dp[i - 1][j]
else:
dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w] + v)... | false | 25 | [
"-v = [0] * (N + 1)",
"-w = [0] * (N + 1)",
"- v[i], w[i] = list(map(int, input().split()))",
"-for i in range(1, N + 1):",
"+ v, w = list(map(int, input().split()))",
"- if j < w[i]:",
"+ if j < w:",
"- dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i])",
"+ ... | false | 0.044996 | 0.045217 | 0.995118 | [
"s579738388",
"s495442410"
] |
u392319141 | p02728 | python | s003030392 | s165029034 | 2,511 | 1,569 | 258,372 | 128,920 | Accepted | Accepted | 37.51 | class Combination:
def __init__(self, size, mod=10**9 + 7):
self.size = size + 2
self.mod = mod
self.fact = [1, 1] + [0] * size
self.factInv = [1, 1] + [0] * size
self.inv = [0, 1] + [0] * size
for i in range(2, self.size):
self.fact[i] = self.fa... | class ReRooting:
def __init__(self, size, root, identDp=0, identCum=0):
self.size = size
self.edges = [[] for _ in range(self.size + 1)]
self.root = root
self.identDp = identDp
self.identCum = identCum
def addEdge(self, fr, to):
self.edges[fr].append(to)... | 91 | 107 | 2,669 | 3,324 | class Combination:
def __init__(self, size, mod=10**9 + 7):
self.size = size + 2
self.mod = mod
self.fact = [1, 1] + [0] * size
self.factInv = [1, 1] + [0] * size
self.inv = [0, 1] + [0] * size
for i in range(2, self.size):
self.fact[i] = self.fact[i - 1] ... | class ReRooting:
def __init__(self, size, root, identDp=0, identCum=0):
self.size = size
self.edges = [[] for _ in range(self.size + 1)]
self.root = root
self.identDp = identDp
self.identCum = identCum
def addEdge(self, fr, to):
self.edges[fr].append(to)
... | false | 14.953271 | [
"+class ReRooting:",
"+ def __init__(self, size, root, identDp=0, identCum=0):",
"+ self.size = size",
"+ self.edges = [[] for _ in range(self.size + 1)]",
"+ self.root = root",
"+ self.identDp = identDp",
"+ self.identCum = identCum",
"+",
"+ def addEdge(sel... | false | 0.036904 | 0.378349 | 0.097541 | [
"s003030392",
"s165029034"
] |
u146803137 | p03220 | python | s738379176 | s259333837 | 165 | 26 | 38,256 | 9,156 | Accepted | Accepted | 84.24 | import sys
n = int(eval(input()))
t,a = list(map(int,input().split()))
h = list(map(int,input().split()))
c = t - h[0] * 0.006
k = 1
for i in range(n):
if abs(a-c) > abs(a-(t - h[i] * 0.006)):
c = t - h[i] * 0.006
k = i + 1
print(k) | n = int(eval(input()))
t,a = list(map(int,input().split()))
h = list(map(int,input().split()))
mi = 1000000000
for i in range(n):
if mi > abs(a-(t-h[i]*0.006)):
mi = abs(a-(t-h[i]*0.006))
ans = i+1
print(ans)
| 11 | 9 | 250 | 225 | import sys
n = int(eval(input()))
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))
c = t - h[0] * 0.006
k = 1
for i in range(n):
if abs(a - c) > abs(a - (t - h[i] * 0.006)):
c = t - h[i] * 0.006
k = i + 1
print(k)
| n = int(eval(input()))
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))
mi = 1000000000
for i in range(n):
if mi > abs(a - (t - h[i] * 0.006)):
mi = abs(a - (t - h[i] * 0.006))
ans = i + 1
print(ans)
| false | 18.181818 | [
"-import sys",
"-",
"-c = t - h[0] * 0.006",
"-k = 1",
"+mi = 1000000000",
"- if abs(a - c) > abs(a - (t - h[i] * 0.006)):",
"- c = t - h[i] * 0.006",
"- k = i + 1",
"-print(k)",
"+ if mi > abs(a - (t - h[i] * 0.006)):",
"+ mi = abs(a - (t - h[i] * 0.006))",
"+ ... | false | 0.04137 | 0.120904 | 0.342173 | [
"s738379176",
"s259333837"
] |
u022407960 | p02469 | python | s962379835 | s181041555 | 40 | 30 | 8,304 | 8,304 | Accepted | Accepted | 25 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
4
1 2 3 5
output:
30
"""
import sys
from functools import reduce
def gcd(x, y):
if x < y:
x, y = y, x
while y > 0:
r = x % y
x = y
y = r
return x
def lcm(a, b):
return a * b // ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
4
1 2 3 5
output:
30
"""
import sys
from functools import reduce
def gcd(x, y):
if x < y:
x, y = y, x
while y > 0:
r = x % y
x = y
y = r
return x
def lcm(a, b):
return a * b // ... | 41 | 41 | 555 | 556 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
4
1 2 3 5
output:
30
"""
import sys
from functools import reduce
def gcd(x, y):
if x < y:
x, y = y, x
while y > 0:
r = x % y
x = y
y = r
return x
def lcm(a, b):
return a * b // gcd(a, b)
def solve(_n_list):
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
4
1 2 3 5
output:
30
"""
import sys
from functools import reduce
def gcd(x, y):
if x < y:
x, y = y, x
while y > 0:
r = x % y
x = y
y = r
return x
def lcm(a, b):
return a * b // gcd(a, b)
def solve(_n_list):
... | false | 0 | [
"- n_list = list(map(int, _input[1].split()))",
"+ n_list = tuple(map(int, _input[1].split()))"
] | false | 0.03763 | 0.038504 | 0.97731 | [
"s962379835",
"s181041555"
] |
u844005364 | p03127 | python | s135771540 | s045239020 | 88 | 80 | 15,020 | 16,204 | Accepted | Accepted | 9.09 | n = int(eval(input()))
a = list(map(int, input().split()))
from fractions import gcd
M = a[0]
for x in a[1:]:
M = gcd(M, x)
print(M) | import functools,fractions
_=eval(input())
a=list(map(int,input().split()))
print((functools.reduce(fractions.gcd,a))) | 11 | 4 | 153 | 113 | n = int(eval(input()))
a = list(map(int, input().split()))
from fractions import gcd
M = a[0]
for x in a[1:]:
M = gcd(M, x)
print(M)
| import functools, fractions
_ = eval(input())
a = list(map(int, input().split()))
print((functools.reduce(fractions.gcd, a)))
| false | 63.636364 | [
"-n = int(eval(input()))",
"+import functools, fractions",
"+",
"+_ = eval(input())",
"-from fractions import gcd",
"-",
"-M = a[0]",
"-for x in a[1:]:",
"- M = gcd(M, x)",
"-print(M)",
"+print((functools.reduce(fractions.gcd, a)))"
] | false | 0.062086 | 0.059125 | 1.050078 | [
"s135771540",
"s045239020"
] |
u327466606 | p03291 | python | s701191097 | s241993345 | 118 | 90 | 9,148 | 9,100 | Accepted | Accepted | 23.73 | MOD = 10**9 + 7
S = eval(input())
res = 0
dp0 = 1 # ''
dp1 = 0 # 'a'
dp2 = 0 # 'ab'
dp3 = 0 # 'abc'
for c in S:
if c == 'A':
dp1 += dp0
elif c == 'B':
dp2 += dp1
elif c == 'C':
dp3 += dp2
else:
dp0,dp1,dp2,dp3 = dp0*3,dp1*3+dp0,dp2*3+dp1,dp3*3+dp2
dp... | MOD = 10**9 + 7
S = eval(input())
res = 0
dp0 = 1 # ''
dp1 = 0 # 'a'
dp2 = 0 # 'ab'
dp3 = 0 # 'abc'
for c in S:
if c == 'A':
dp1 = (dp0+dp1)%MOD
elif c == 'B':
dp2 = (dp1+dp2)%MOD
elif c == 'C':
dp3 = (dp2+dp3)%MOD
else:
dp3 = (dp3*3+dp2)%MOD
dp2... | 22 | 21 | 383 | 403 | MOD = 10**9 + 7
S = eval(input())
res = 0
dp0 = 1 # ''
dp1 = 0 # 'a'
dp2 = 0 # 'ab'
dp3 = 0 # 'abc'
for c in S:
if c == "A":
dp1 += dp0
elif c == "B":
dp2 += dp1
elif c == "C":
dp3 += dp2
else:
dp0, dp1, dp2, dp3 = dp0 * 3, dp1 * 3 + dp0, dp2 * 3 + dp1, dp3 * 3 + dp2
... | MOD = 10**9 + 7
S = eval(input())
res = 0
dp0 = 1 # ''
dp1 = 0 # 'a'
dp2 = 0 # 'ab'
dp3 = 0 # 'abc'
for c in S:
if c == "A":
dp1 = (dp0 + dp1) % MOD
elif c == "B":
dp2 = (dp1 + dp2) % MOD
elif c == "C":
dp3 = (dp2 + dp3) % MOD
else:
dp3 = (dp3 * 3 + dp2) % MOD
... | false | 4.545455 | [
"- dp1 += dp0",
"+ dp1 = (dp0 + dp1) % MOD",
"- dp2 += dp1",
"+ dp2 = (dp1 + dp2) % MOD",
"- dp3 += dp2",
"+ dp3 = (dp2 + dp3) % MOD",
"- dp0, dp1, dp2, dp3 = dp0 * 3, dp1 * 3 + dp0, dp2 * 3 + dp1, dp3 * 3 + dp2",
"- dp0 %= MOD",
"- dp1 %= MOD",... | false | 0.03416 | 0.118838 | 0.287447 | [
"s701191097",
"s241993345"
] |
u503228842 | p02703 | python | s503423004 | s837157500 | 973 | 577 | 145,548 | 120,804 | Accepted | Accepted | 40.7 | N,M,S = list(map(int,input().split()))
edges = [[] for _ in range(2500*50 + 100)]
def indexer(city,coin):
return 50*coin + city
for _ in range(M):
u,v,a,b = list(map(int,input().split()))
u -= 1
v -= 1
for scoin in range(a,2501):
edges[indexer(u,scoin)].append((b,indexer(v,scoin-a... | N,M,S = list(map(int,input().split()))
edges = [[] for _ in range(2500*50 + 100)]
def indexer(city,coin):
return 50*coin + city
for _ in range(M):
u,v,a,b = list(map(int,input().split()))
u -= 1
v -= 1
for scoin in range(a,2501):
edges[indexer(u,scoin)].append((b,indexer(v,scoin-a... | 46 | 41 | 1,259 | 1,116 | N, M, S = list(map(int, input().split()))
edges = [[] for _ in range(2500 * 50 + 100)]
def indexer(city, coin):
return 50 * coin + city
for _ in range(M):
u, v, a, b = list(map(int, input().split()))
u -= 1
v -= 1
for scoin in range(a, 2501):
edges[indexer(u, scoin)].append((b, indexer(v... | N, M, S = list(map(int, input().split()))
edges = [[] for _ in range(2500 * 50 + 100)]
def indexer(city, coin):
return 50 * coin + city
for _ in range(M):
u, v, a, b = list(map(int, input().split()))
u -= 1
v -= 1
for scoin in range(a, 2501):
edges[indexer(u, scoin)].append((b, indexer(v... | false | 10.869565 | [
"- dist = [float(\"inf\")] * n",
"- fixed = [False] * n",
"- dist[s] = 0",
"- fixed[s] = True",
"- priority_que = []",
"- for e in edges[s]:",
"- heapq.heappush(priority_que, e)",
"- while len(priority_que):",
"- edge = heapq.heappop(priority_que)",
"- if ... | false | 0.816426 | 0.185911 | 4.3915 | [
"s503423004",
"s837157500"
] |
u368796742 | p02684 | python | s039816580 | s000892714 | 227 | 165 | 32,568 | 32,224 | Accepted | Accepted | 27.31 | n,k = list(map(int,input().split()))
l = list(map(int,input().split()))
s = set()
loop = []
ls = set()
pas1 = []
pas2 = []
now = 1
count = 0
if k == 1:
print((l[0]))
exit()
for i in range(2*n):
a = l[now-1]
if a in s:
if a in ls:
k -= count+1
print((loop[... | n,k = list(map(int,input().split()))
l = list(map(int,input().split()))
s = set()
s.add(1)
pas1 = [1]
pas2 = []
now = 1
count = 0
if k == 1:
print((l[0]))
exit()
for i in range(2*n):
a = l[now-1]
if a in s:
index = pas1.index(a)
k -= index
le = len(pas1)-index
... | 40 | 30 | 740 | 540 | n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
s = set()
loop = []
ls = set()
pas1 = []
pas2 = []
now = 1
count = 0
if k == 1:
print((l[0]))
exit()
for i in range(2 * n):
a = l[now - 1]
if a in s:
if a in ls:
k -= count + 1
print((loop[k % len(... | n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
s = set()
s.add(1)
pas1 = [1]
pas2 = []
now = 1
count = 0
if k == 1:
print((l[0]))
exit()
for i in range(2 * n):
a = l[now - 1]
if a in s:
index = pas1.index(a)
k -= index
le = len(pas1) - index
pr... | false | 25 | [
"-loop = []",
"-ls = set()",
"-pas1 = []",
"+s.add(1)",
"+pas1 = [1]",
"- if a in ls:",
"- k -= count + 1",
"- print((loop[k % len(loop)]))",
"- exit()",
"- else:",
"- ls.add(a)",
"- loop.append(a)",
"- now = a",... | false | 0.038343 | 0.038547 | 0.9947 | [
"s039816580",
"s000892714"
] |
u868701750 | p02779 | python | s067922789 | s642509704 | 75 | 63 | 30,288 | 31,156 | Accepted | Accepted | 16 | N = eval(input())
A = input().split()
_A = set(A)
if len(A) == len(_A):
print('YES')
else:
print('NO')
| def main():
N = eval(input())
A = input().split()
_A = set(A)
if len(A) == len(_A):
print('YES')
else:
print('NO')
if __name__ == '__main__':
main()
| 9 | 13 | 115 | 198 | N = eval(input())
A = input().split()
_A = set(A)
if len(A) == len(_A):
print("YES")
else:
print("NO")
| def main():
N = eval(input())
A = input().split()
_A = set(A)
if len(A) == len(_A):
print("YES")
else:
print("NO")
if __name__ == "__main__":
main()
| false | 30.769231 | [
"-N = eval(input())",
"-A = input().split()",
"-_A = set(A)",
"-if len(A) == len(_A):",
"- print(\"YES\")",
"-else:",
"- print(\"NO\")",
"+def main():",
"+ N = eval(input())",
"+ A = input().split()",
"+ _A = set(A)",
"+ if len(A) == len(_A):",
"+ print(\"YES\")",
... | false | 0.044736 | 0.040486 | 1.104961 | [
"s067922789",
"s642509704"
] |
u536017058 | p03386 | python | s140713247 | s226822188 | 72 | 63 | 62,464 | 62,128 | Accepted | Accepted | 12.5 | a,b,k = list(map(int, input().split()))
ans=[b-i for i in range(k) if b-i>=a]
ans.extend([a+i for i in range(k) if a+k<=b])
ans.sort()
ans=set(ans)
for item in ans:
print(item) | a,b,k = list(map(int, input().split()))
ans=[b-i for i in range(k) if b-i>=a]
ans.extend([a+i for i in range(k) if a+k<=b])
ans.sort()
ans=set(ans)
print(*ans,sep="\n")
| 7 | 6 | 184 | 173 | a, b, k = list(map(int, input().split()))
ans = [b - i for i in range(k) if b - i >= a]
ans.extend([a + i for i in range(k) if a + k <= b])
ans.sort()
ans = set(ans)
for item in ans:
print(item)
| a, b, k = list(map(int, input().split()))
ans = [b - i for i in range(k) if b - i >= a]
ans.extend([a + i for i in range(k) if a + k <= b])
ans.sort()
ans = set(ans)
print(*ans, sep="\n")
| false | 14.285714 | [
"-for item in ans:",
"- print(item)",
"+print(*ans, sep=\"\\n\")"
] | false | 0.043651 | 0.042242 | 1.033345 | [
"s140713247",
"s226822188"
] |
u222668979 | p03169 | python | s401392695 | s936157519 | 1,399 | 1,235 | 254,472 | 254,088 | Accepted | Accepted | 11.72 | import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def NI(): return int(sys.stdin.readline())
N = NI()
a = [0, 0, 0]
for x in LI():
a[x-1] += 1
dp = [[[0.0] * (N+1) for _ in range(N+1)] for _ in range(N+1)]
for k in range(a[2]+1):
for j in range(a[1]+a[2]+1):
for ... | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
cnt = [0, 0, 0]
for ai in a:
cnt[ai-1] += 1
p, q, r = cnt[0], cnt[1], cnt[2]
dp = [[[0.0] * (n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for k in range(r + 1):
for j in range(r + q + 1):
... | 27 | 28 | 737 | 732 | import sys
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def NI():
return int(sys.stdin.readline())
N = NI()
a = [0, 0, 0]
for x in LI():
a[x - 1] += 1
dp = [[[0.0] * (N + 1) for _ in range(N + 1)] for _ in range(N + 1)]
for k in range(a[2] + 1):
for j in range(a[1] + a[2] + 1):
... | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
cnt = [0, 0, 0]
for ai in a:
cnt[ai - 1] += 1
p, q, r = cnt[0], cnt[1], cnt[2]
dp = [[[0.0] * (n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for k in range(r + 1):
for j in range(r + q + 1):
for i in... | false | 3.571429 | [
"-",
"-def LI():",
"- return [int(x) for x in sys.stdin.readline().split()]",
"-",
"-",
"-def NI():",
"- return int(sys.stdin.readline())",
"-",
"-",
"-N = NI()",
"-a = [0, 0, 0]",
"-for x in LI():",
"- a[x - 1] += 1",
"-dp = [[[0.0] * (N + 1) for _ in range(N + 1)] for _ in range... | false | 0.107803 | 0.12856 | 0.838539 | [
"s401392695",
"s936157519"
] |
u680851063 | p02923 | python | s071983493 | s393453360 | 103 | 80 | 14,252 | 14,252 | Accepted | Accepted | 22.33 | #ロジックは簡単だったが実装に手間取った.
n = int(eval(input()))
h = [int(_) for _ in input().split()]
h.append(0) #ループエラー防止のためのダミー
x = [0]
a = 0
for i in range(0,n):
if h[i] <= h[i-1]:
a += 1
if a > x[0]:
x[0] = a
else: # h[i] > h[i-1]:
a = 0
print((*x))
| n = int(eval(input()))
l = list(map(int, input().split()))
ans = 0
tmp = 0
for i in range(1, n):
if l[i] <= l[i-1]:
tmp += 1
if i == n-1:
ans = max(ans, tmp)
else:
ans = max(ans, tmp)
tmp = 0
print(ans)
| 14 | 15 | 286 | 265 | # ロジックは簡単だったが実装に手間取った.
n = int(eval(input()))
h = [int(_) for _ in input().split()]
h.append(0) # ループエラー防止のためのダミー
x = [0]
a = 0
for i in range(0, n):
if h[i] <= h[i - 1]:
a += 1
if a > x[0]:
x[0] = a
else: # h[i] > h[i-1]:
a = 0
print((*x))
| n = int(eval(input()))
l = list(map(int, input().split()))
ans = 0
tmp = 0
for i in range(1, n):
if l[i] <= l[i - 1]:
tmp += 1
if i == n - 1:
ans = max(ans, tmp)
else:
ans = max(ans, tmp)
tmp = 0
print(ans)
| false | 6.666667 | [
"-# ロジックは簡単だったが実装に手間取った.",
"-h = [int(_) for _ in input().split()]",
"-h.append(0) # ループエラー防止のためのダミー",
"-x = [0]",
"-a = 0",
"-for i in range(0, n):",
"- if h[i] <= h[i - 1]:",
"- a += 1",
"- if a > x[0]:",
"- x[0] = a",
"- else: # h[i] > h[i-1]:",
"- a ... | false | 0.047935 | 0.046779 | 1.024714 | [
"s071983493",
"s393453360"
] |
u732061897 | p03078 | python | s284971269 | s184310621 | 102 | 43 | 8,708 | 10,440 | Accepted | Accepted | 57.84 | x, y,z,K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
result = []
for i,a in enumerate(A):
for j,b in enumerate(B):
if (i + 1) * (j + ... | from heapq import heappop, heappush
X, Y, Z, K = list(map(int, input().split()))
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))
a_list.sort(reverse=True)
b_list.sort(reverse=True)
c_list.sort(reverse=True)
h = []
a = a_list[0]
b... | 25 | 38 | 623 | 1,102 | x, y, z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
result = []
for i, a in enumerate(A):
for j, b in enumerate(B):
if (i + 1) * (j + 1) > K:
... | from heapq import heappop, heappush
X, Y, Z, K = list(map(int, input().split()))
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))
a_list.sort(reverse=True)
b_list.sort(reverse=True)
c_list.sort(reverse=True)
h = []
a = a_list[0]
b = b_list[0]
c ... | false | 34.210526 | [
"-x, y, z, K = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-B = list(map(int, input().split()))",
"-C = list(map(int, input().split()))",
"-A.sort(reverse=True)",
"-B.sort(reverse=True)",
"-C.sort(reverse=True)",
"-result = []",
"-for i, a in enumerate(A):",
"- fo... | false | 0.130808 | 0.102952 | 1.270574 | [
"s284971269",
"s184310621"
] |
u994988729 | p03044 | python | s752386620 | s918317683 | 774 | 455 | 36,756 | 37,160 | Accepted | Accepted | 41.21 | from collections import deque
n=int(input())
to=[[] for _ in range(n)]
cost=[[] for _ in range(n)]
for _ in range(n-1):
u,v,w=map(int,input().split())
u-=1
v-=1
to[u].append(v)
to[v].append(u)
cost[u].append(w%2)
cost[v].append(w%2)
color=[-1]*n
color[0]=0
q=deque()
q.appe... | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
N = int(input())
edge = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b, c = map(int, input().split())
edge[a].append((b, c % 2))
edge[b].append((a, c % 2))
root = 1
dist = [-1] * (N + 1)
dist[root] = 0
node = [... | 28 | 25 | 518 | 538 | from collections import deque
n = int(input())
to = [[] for _ in range(n)]
cost = [[] for _ in range(n)]
for _ in range(n - 1):
u, v, w = map(int, input().split())
u -= 1
v -= 1
to[u].append(v)
to[v].append(u)
cost[u].append(w % 2)
cost[v].append(w % 2)
color = [-1] * n
color[0] = 0
q = deq... | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
N = int(input())
edge = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b, c = map(int, input().split())
edge[a].append((b, c % 2))
edge[b].append((a, c % 2))
root = 1
dist = [-1] * (N + 1)
dist[root] = 0
node = [root]
while nod... | false | 10.714286 | [
"-from collections import deque",
"+import sys",
"-n = int(input())",
"-to = [[] for _ in range(n)]",
"-cost = [[] for _ in range(n)]",
"-for _ in range(n - 1):",
"- u, v, w = map(int, input().split())",
"- u -= 1",
"- v -= 1",
"- to[u].append(v)",
"- to[v].append(u)",
"- cos... | false | 0.046604 | 0.06551 | 0.711392 | [
"s752386620",
"s918317683"
] |
u272457181 | p02717 | python | s563359913 | s541085573 | 30 | 27 | 9,072 | 9,100 | Accepted | Accepted | 10 | A, B, C = list(map(int,input().split()))
(A, B) = (B, A)
(A, C) = (C, A)
print((A, B, C)) | X, Y, Z = list(map(int,input().split()))
X, Y = Y, X
X, Z = Z, X
print((X,Y,Z)) | 4 | 4 | 84 | 74 | A, B, C = list(map(int, input().split()))
(A, B) = (B, A)
(A, C) = (C, A)
print((A, B, C))
| X, Y, Z = list(map(int, input().split()))
X, Y = Y, X
X, Z = Z, X
print((X, Y, Z))
| false | 0 | [
"-A, B, C = list(map(int, input().split()))",
"-(A, B) = (B, A)",
"-(A, C) = (C, A)",
"-print((A, B, C))",
"+X, Y, Z = list(map(int, input().split()))",
"+X, Y = Y, X",
"+X, Z = Z, X",
"+print((X, Y, Z))"
] | false | 0.048259 | 0.170814 | 0.282522 | [
"s563359913",
"s541085573"
] |
u941407962 | p03038 | python | s257643319 | s474268841 | 1,186 | 748 | 78,360 | 83,864 | Accepted | Accepted | 36.93 | N, M = list(map(int, input().split()))
As = list(map(int, input().split()))
xs = []
for _ in range(M):
b, c = list(map(int, input().split()))
xs.append((c, b))
for a in As:
xs.append((a, 1))
xs.sort()
c = 0
r = 0
for x in xs[::-1]:
c += x[1]
if c >= N:
r += x[0] * (N - (c-x[1])... | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
X = []
for _ in range(M):
b, c = list(map(int, input().split()))
X.append((b, c))
X = sorted(X, key=lambda x: -x[1])
Y = []
for i in range(M):
ly = len(Y)
b, c = X[i]
if ly + b < N:
Y += [c] * b
els... | 19 | 18 | 366 | 379 | N, M = list(map(int, input().split()))
As = list(map(int, input().split()))
xs = []
for _ in range(M):
b, c = list(map(int, input().split()))
xs.append((c, b))
for a in As:
xs.append((a, 1))
xs.sort()
c = 0
r = 0
for x in xs[::-1]:
c += x[1]
if c >= N:
r += x[0] * (N - (c - x[1]))
br... | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
X = []
for _ in range(M):
b, c = list(map(int, input().split()))
X.append((b, c))
X = sorted(X, key=lambda x: -x[1])
Y = []
for i in range(M):
ly = len(Y)
b, c = X[i]
if ly + b < N:
Y += [c] * b
else:
Y +=... | false | 5.263158 | [
"-As = list(map(int, input().split()))",
"-xs = []",
"+A = list(map(int, input().split()))",
"+X = []",
"- xs.append((c, b))",
"-for a in As:",
"- xs.append((a, 1))",
"-xs.sort()",
"-c = 0",
"-r = 0",
"-for x in xs[::-1]:",
"- c += x[1]",
"- if c >= N:",
"- r += x[0] * (... | false | 0.100966 | 0.039537 | 2.553698 | [
"s257643319",
"s474268841"
] |
u536377809 | p03546 | python | s283339546 | s675186459 | 465 | 186 | 26,212 | 14,060 | Accepted | Accepted | 60 | import numpy as np
from scipy.sparse.csgraph import dijkstra
from collections import defaultdict
import sys
input = sys.stdin.readline
[H,W]= [int(x) for x in input().split()]
c=np.array([[int(x) for x in input().split()] for _ in range(10)])
A=[]
for _ in range(H):
A+=[int(x) for x in input().split()]... | import numpy as np
from scipy.sparse.csgraph import dijkstra
from collections import defaultdict
import sys
input = sys.stdin.readline
[H,W]= [int(x) for x in input().split()]
c=np.array([[int(x) for x in input().split()] for _ in range(10)])
A=[]
for _ in range(H):
A+=[int(x) for x in input().split()]... | 23 | 24 | 494 | 518 | import numpy as np
from scipy.sparse.csgraph import dijkstra
from collections import defaultdict
import sys
input = sys.stdin.readline
[H, W] = [int(x) for x in input().split()]
c = np.array([[int(x) for x in input().split()] for _ in range(10)])
A = []
for _ in range(H):
A += [int(x) for x in input().split()]
dd ... | import numpy as np
from scipy.sparse.csgraph import dijkstra
from collections import defaultdict
import sys
input = sys.stdin.readline
[H, W] = [int(x) for x in input().split()]
c = np.array([[int(x) for x in input().split()] for _ in range(10)])
A = []
for _ in range(H):
A += [int(x) for x in input().split()]
dd ... | false | 4.166667 | [
"+scores = dijkstra(c.T, indices=1).astype(int)",
"- res += v * int(dijkstra(c, indices=k)[1])",
"+ res += v * scores[k]"
] | false | 0.353641 | 0.582417 | 0.607196 | [
"s283339546",
"s675186459"
] |
u440566786 | p02574 | python | s948369461 | s395990814 | 528 | 372 | 191,728 | 199,484 | Accepted | Accepted | 29.55 | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from math import gcd
from functools import reduce
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
if reduce(gcd, A) != 1:
print("... | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from math import gcd
from functools import reduce
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
if reduce(gcd, A) != 1:
print("... | 28 | 34 | 635 | 768 | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
from math import gcd
from functools import reduce
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
if reduce(gcd, A) != 1:
print("not copr... | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
from math import gcd
from functools import reduce
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
if reduce(gcd, A) != 1:
print("not copr... | false | 17.647059 | [
"- for d in range(2, M + 1):",
"- c = sum(dist[i] for i in range(d, M + 1, d))",
"+ sieve = [True] * (M + 1)",
"+ for p in range(2, M + 1):",
"+ if not sieve[p]:",
"+ continue",
"+ c = 0",
"+ for i in range(p, M + 1, p):",
"+ c += dist[i]",
... | false | 0.043005 | 0.069553 | 0.618312 | [
"s948369461",
"s395990814"
] |
u905582793 | p03476 | python | s746024444 | s355606804 | 1,139 | 576 | 7,096 | 6,972 | Accepted | Accepted | 49.43 | from itertools import accumulate
def prm(x):
if x == 1 or x == 4:
return False
for i in range(2,int(x**0.5+1)):
if x%i==0:
return False
else:
return True
def like2017(x):
if x == 2:
return False
if prm(x) and prm((x+1)//2):
return True... | from itertools import accumulate
import sys
input=sys.stdin.readline
def prm(x):
if x == 1 or x == 4:
return False
for i in range(2,int(x**0.5+1)):
if x%i==0:
return False
else:
return True
def like2017(x):
if x == 2:
return False
if prm(x) a... | 23 | 25 | 527 | 565 | from itertools import accumulate
def prm(x):
if x == 1 or x == 4:
return False
for i in range(2, int(x**0.5 + 1)):
if x % i == 0:
return False
else:
return True
def like2017(x):
if x == 2:
return False
if prm(x) and prm((x + 1) // 2):
return Tr... | from itertools import accumulate
import sys
input = sys.stdin.readline
def prm(x):
if x == 1 or x == 4:
return False
for i in range(2, int(x**0.5 + 1)):
if x % i == 0:
return False
else:
return True
def like2017(x):
if x == 2:
return False
if prm(x) a... | false | 8 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.444059 | 1.447433 | 0.306791 | [
"s746024444",
"s355606804"
] |
u609061751 | p02688 | python | s631056848 | s960374790 | 64 | 56 | 67,528 | 67,692 | Accepted | Accepted | 12.5 | import sys
input = sys.stdin.readline
n, k = [int(x) for x in input().split()]
flag = [0]*n
for _ in range(k):
d = int(eval(input()))
a = [int(x) for x in input().split()]
for i in a:
flag[i - 1] = 1
ans = 0
for i in flag:
if not i:
ans += 1
print(ans)
| import sys
input = sys.stdin.readline
n, k = [int(x) for x in input().split()]
s = set()
for _ in range(k):
d = int(eval(input()))
a = [int(x) for x in input().split()]
for i in a:
s.add(i)
ans = 0
for i in range(n):
if i + 1 not in s:
ans += 1
print(ans) | 19 | 17 | 302 | 300 | import sys
input = sys.stdin.readline
n, k = [int(x) for x in input().split()]
flag = [0] * n
for _ in range(k):
d = int(eval(input()))
a = [int(x) for x in input().split()]
for i in a:
flag[i - 1] = 1
ans = 0
for i in flag:
if not i:
ans += 1
print(ans)
| import sys
input = sys.stdin.readline
n, k = [int(x) for x in input().split()]
s = set()
for _ in range(k):
d = int(eval(input()))
a = [int(x) for x in input().split()]
for i in a:
s.add(i)
ans = 0
for i in range(n):
if i + 1 not in s:
ans += 1
print(ans)
| false | 10.526316 | [
"-flag = [0] * n",
"+s = set()",
"- flag[i - 1] = 1",
"+ s.add(i)",
"-for i in flag:",
"- if not i:",
"+for i in range(n):",
"+ if i + 1 not in s:"
] | false | 0.046163 | 0.046405 | 0.994768 | [
"s631056848",
"s960374790"
] |
u777923818 | p02954 | python | s156703638 | s311827661 | 250 | 178 | 50,236 | 11,636 | Accepted | Accepted | 28.8 | def inpl(): return list(map(int, input().split()))
S = eval(input())
N = len(S)
R = [0]*N
L = [0]*N
for i in range(N-2, -1, -1):
r = int(S[i] == "R")
R[i] = R[i+1]*r + r
for i in range(1, N):
l = int(S[i] == "L")
L[i] = L[i-1]*l + l
X = [0]*N
for i in range(N):
if S[i] == "R... | # -*- coding: utf-8 -*-
from collections import defaultdict, Counter
from string import ascii_lowercase as abc
def inpl(): return list(map(int, input().split()))
S = eval(input())
N = len(S)
R = [0]*N
L = [0]*N
R[0] = 1
L[-1] = 1
for i in range(1, N):
x = S[i] == "L"
L[i] = L[i-1]*x + x
f... | 25 | 30 | 402 | 535 | def inpl():
return list(map(int, input().split()))
S = eval(input())
N = len(S)
R = [0] * N
L = [0] * N
for i in range(N - 2, -1, -1):
r = int(S[i] == "R")
R[i] = R[i + 1] * r + r
for i in range(1, N):
l = int(S[i] == "L")
L[i] = L[i - 1] * l + l
X = [0] * N
for i in range(N):
if S[i] == "R":
... | # -*- coding: utf-8 -*-
from collections import defaultdict, Counter
from string import ascii_lowercase as abc
def inpl():
return list(map(int, input().split()))
S = eval(input())
N = len(S)
R = [0] * N
L = [0] * N
R[0] = 1
L[-1] = 1
for i in range(1, N):
x = S[i] == "L"
L[i] = L[i - 1] * x + x
for i in... | false | 16.666667 | [
"+# -*- coding: utf-8 -*-",
"+from collections import defaultdict, Counter",
"+from string import ascii_lowercase as abc",
"+",
"+",
"+R[0] = 1",
"+L[-1] = 1",
"+for i in range(1, N):",
"+ x = S[i] == \"L\"",
"+ L[i] = L[i - 1] * x + x",
"- r = int(S[i] == \"R\")",
"- R[i] = R[i + ... | false | 0.03851 | 0.040086 | 0.960675 | [
"s156703638",
"s311827661"
] |
u585482323 | p03108 | python | s763775283 | s814581851 | 806 | 738 | 102,364 | 97,116 | Accepted | Accepted | 8.44 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [lis... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [lis... | 76 | 74 | 1,748 | 1,703 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
r... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
r... | false | 2.631579 | [
"- s[par[x]] += s[x]",
"- s[x] = 0"
] | false | 0.041021 | 0.042057 | 0.975364 | [
"s763775283",
"s814581851"
] |
u626337957 | p03061 | python | s481851005 | s346072072 | 378 | 236 | 89,580 | 16,152 | Accepted | Accepted | 37.57 | import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * (N+1)
R = [0] * (N+2)
M = [0] * (N+1)
for i in range(1, N+1):
L[i] = fractions.gcd(L[i-1], A[i-1])
R[N-i+1] = fractions.gcd(R[N-i+2], A[N-i])
for i in range(1, N+1):
M[i] = fractions.gcd(L[i-1], R[i+1])
print((m... | import fractions
N = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
L = [0] * (N+1)
R = [0] * (N+2)
for i in range(1, N+1):
L[i] = fractions.gcd(L[i-1], A[i-1])
R[N-i+1] = fractions.gcd(R[N-i+2], A[N-i+2])
ans = 0
for i in range(1, N+1):
rest_gcd = fractions.gcd(L[i], R[i])
a... | 16 | 16 | 330 | 356 | import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * (N + 1)
R = [0] * (N + 2)
M = [0] * (N + 1)
for i in range(1, N + 1):
L[i] = fractions.gcd(L[i - 1], A[i - 1])
R[N - i + 1] = fractions.gcd(R[N - i + 2], A[N - i])
for i in range(1, N + 1):
M[i] = fractions.gcd(L[i - 1], ... | import fractions
N = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
L = [0] * (N + 1)
R = [0] * (N + 2)
for i in range(1, N + 1):
L[i] = fractions.gcd(L[i - 1], A[i - 1])
R[N - i + 1] = fractions.gcd(R[N - i + 2], A[N - i + 2])
ans = 0
for i in range(1, N + 1):
rest_gcd = fractions.gcd(... | false | 0 | [
"-A = list(map(int, input().split()))",
"+A = [0] + list(map(int, input().split())) + [0]",
"-M = [0] * (N + 1)",
"- R[N - i + 1] = fractions.gcd(R[N - i + 2], A[N - i])",
"+ R[N - i + 1] = fractions.gcd(R[N - i + 2], A[N - i + 2])",
"+ans = 0",
"- M[i] = fractions.gcd(L[i - 1], R[i + 1])",
"... | false | 0.051769 | 0.007479 | 6.922229 | [
"s481851005",
"s346072072"
] |
u285891772 | p03041 | python | s239612205 | s073462105 | 57 | 50 | 5,712 | 5,456 | Accepted | Accepted | 12.28 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ... | 26 | 28 | 885 | 872 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_... | false | 7.142857 | [
"- return int(input())",
"+ return int(eval(input()))",
"- return map(int, input().split())",
"+ return list(map(int, input().split()))",
"- return zip(*(MAP() for _ in range(n)))",
"+ return list(zip(*(MAP() for _ in range(n))))",
"-S = input()",
"-print(S[: K - 1], end=\"\")",
"-... | false | 0.101319 | 0.04229 | 2.395782 | [
"s239612205",
"s073462105"
] |
u353919145 | p02801 | python | s530452970 | s994061575 | 24 | 17 | 3,768 | 2,940 | Accepted | Accepted | 29.17 | letra = eval(input())
import string
letras = list(string.ascii_lowercase)
index = letras.index(letra)
print((letras[index+1]))
| métele_algonomas=eval(input())
caja_china = ord(métele_algonomas)
dedos = caja_china + 1
print((chr(dedos)))
| 6 | 5 | 125 | 106 | letra = eval(input())
import string
letras = list(string.ascii_lowercase)
index = letras.index(letra)
print((letras[index + 1]))
| métele_algonomas = eval(input())
caja_china = ord(métele_algonomas)
dedos = caja_china + 1
print((chr(dedos)))
| false | 16.666667 | [
"-letra = eval(input())",
"-import string",
"-",
"-letras = list(string.ascii_lowercase)",
"-index = letras.index(letra)",
"-print((letras[index + 1]))",
"+métele_algonomas = eval(input())",
"+caja_china = ord(métele_algonomas)",
"+dedos = caja_china + 1",
"+print((chr(dedos)))"
] | false | 0.078193 | 0.059014 | 1.324997 | [
"s530452970",
"s994061575"
] |
u256678932 | p02258 | python | s565478628 | s532571321 | 1,430 | 530 | 16,984 | 7,680 | Accepted | Accepted | 62.94 | def main():
n = int(eval(input()))
nums = []
for i in range(n):
nums.append(int(eval(input())))
rj = max(nums[1:])
r = rj - nums[0]
for i in range(1, n-1):
ri = nums[i]
if ri == rj:
rj = max(nums[i+1:])
r = max(r, rj-ri)
pr... | def main():
n = int(eval(input()))
r = 0
ri = 0
for i in range(n):
m = int(eval(input()))
if 0 == i:
ri = m
continue
if 1 == i:
r = m - ri
r = max(r, m - ri)
ri = min(ri, m)
print(r)
if __name__... | 22 | 23 | 356 | 335 | def main():
n = int(eval(input()))
nums = []
for i in range(n):
nums.append(int(eval(input())))
rj = max(nums[1:])
r = rj - nums[0]
for i in range(1, n - 1):
ri = nums[i]
if ri == rj:
rj = max(nums[i + 1 :])
r = max(r, rj - ri)
print(r)
if __name... | def main():
n = int(eval(input()))
r = 0
ri = 0
for i in range(n):
m = int(eval(input()))
if 0 == i:
ri = m
continue
if 1 == i:
r = m - ri
r = max(r, m - ri)
ri = min(ri, m)
print(r)
if __name__ == "__main__":
main()
| false | 4.347826 | [
"- nums = []",
"+ r = 0",
"+ ri = 0",
"- nums.append(int(eval(input())))",
"- rj = max(nums[1:])",
"- r = rj - nums[0]",
"- for i in range(1, n - 1):",
"- ri = nums[i]",
"- if ri == rj:",
"- rj = max(nums[i + 1 :])",
"- r = max(r, rj - ri)... | false | 0.038489 | 0.007868 | 4.89201 | [
"s565478628",
"s532571321"
] |
u073852194 | p02983 | python | s299689081 | s181204383 | 1,454 | 75 | 149,652 | 3,064 | Accepted | Accepted | 94.84 | L,R = list(map(int, input().split()))
P = min(R, L+2018)
c = []
for i in range(L,P+1):
for j in range(L,P+1):
if i != j:
c.append((i * j) % 2019)
print((min(c))) | L,R = list(map(int, input().split()))
c = 2018
for i in range(L,R):
for j in range(i+1,R+1):
c = min(c,(i*j)%2019)
if (i*j)%2019 == 0:
print(c)
exit()
print(c)
# 解説をみてから回答 | 8 | 10 | 172 | 202 | L, R = list(map(int, input().split()))
P = min(R, L + 2018)
c = []
for i in range(L, P + 1):
for j in range(L, P + 1):
if i != j:
c.append((i * j) % 2019)
print((min(c)))
| L, R = list(map(int, input().split()))
c = 2018
for i in range(L, R):
for j in range(i + 1, R + 1):
c = min(c, (i * j) % 2019)
if (i * j) % 2019 == 0:
print(c)
exit()
print(c)
# 解説をみてから回答
| false | 20 | [
"-P = min(R, L + 2018)",
"-c = []",
"-for i in range(L, P + 1):",
"- for j in range(L, P + 1):",
"- if i != j:",
"- c.append((i * j) % 2019)",
"-print((min(c)))",
"+c = 2018",
"+for i in range(L, R):",
"+ for j in range(i + 1, R + 1):",
"+ c = min(c, (i * j) % 2019... | false | 0.074589 | 0.037427 | 1.992939 | [
"s299689081",
"s181204383"
] |
u621935300 | p03556 | python | s135691872 | s564876172 | 14 | 10 | 2,692 | 2,568 | Accepted | Accepted | 28.57 | N=eval(input())
print(int(N**0.5)**2) | print(int(input()**0.5)**2) | 2 | 1 | 31 | 26 | N = eval(input())
print(int(N**0.5) ** 2)
| print(int(input() ** 0.5) ** 2)
| false | 50 | [
"-N = eval(input())",
"-print(int(N**0.5) ** 2)",
"+print(int(input() ** 0.5) ** 2)"
] | false | 0.038584 | 0.047462 | 0.812945 | [
"s135691872",
"s564876172"
] |
u814986259 | p03341 | python | s684434020 | s306639442 | 310 | 208 | 17,484 | 15,436 | Accepted | Accepted | 32.9 | N = int(eval(input()))
S = list(eval(input()))
s = [0]*(N+1)
for i in range(1, N+1):
k = 0
if S[i-1] == "W":
k = 1
s[i] = s[i-1] + k
ans = N
for i in range(1, N+1):
k = (N - i) - (s[N] - s[i])
ans = min(ans, k + s[i-1])
print(ans)
| N = int(eval(input()))
S = eval(input())
L = [0]*N
l = 0
for i, x in enumerate(S):
L[i] += l
if x == 'E':
l += 1
r = 0
for i, x in enumerate(S[::-1]):
L[N-1-i] += r
if x == 'W':
r += 1
print((N-1 - max(L)))
| 18 | 17 | 269 | 244 | N = int(eval(input()))
S = list(eval(input()))
s = [0] * (N + 1)
for i in range(1, N + 1):
k = 0
if S[i - 1] == "W":
k = 1
s[i] = s[i - 1] + k
ans = N
for i in range(1, N + 1):
k = (N - i) - (s[N] - s[i])
ans = min(ans, k + s[i - 1])
print(ans)
| N = int(eval(input()))
S = eval(input())
L = [0] * N
l = 0
for i, x in enumerate(S):
L[i] += l
if x == "E":
l += 1
r = 0
for i, x in enumerate(S[::-1]):
L[N - 1 - i] += r
if x == "W":
r += 1
print((N - 1 - max(L)))
| false | 5.555556 | [
"-S = list(eval(input()))",
"-s = [0] * (N + 1)",
"-for i in range(1, N + 1):",
"- k = 0",
"- if S[i - 1] == \"W\":",
"- k = 1",
"- s[i] = s[i - 1] + k",
"-ans = N",
"-for i in range(1, N + 1):",
"- k = (N - i) - (s[N] - s[i])",
"- ans = min(ans, k + s[i - 1])",
"-print(a... | false | 0.045777 | 0.039605 | 1.155842 | [
"s684434020",
"s306639442"
] |
u171366497 | p03062 | python | s781186295 | s195535161 | 249 | 92 | 24,812 | 14,496 | Accepted | Accepted | 63.05 | N=int(eval(input()))
A=list(map(int,input().split()))
dp=[[0,0] for i in range(N)]
dp[0][0]=A[0]+A[1]
dp[0][1]=-1*dp[0][0]
for i in range(1,N-1):
dp[i][0]=max(dp[i-1][0]+A[i+1],dp[i-1][1]+A[i+1])
dp[i][1]=max(dp[i-1][0]-2*A[i]-A[i+1],dp[i-1][1]+2*A[i]-A[i+1])
print((max(dp[N-2]))) | N=int(eval(input()))
A=list(map(int,input().split()))
A.sort()
idx=N
for i in range(N):
if A[i]>0:
idx=i
break
if idx==0:
print((sum(A)))
elif idx==N:
print((sum(A[(N//2)*2:])-sum(A[:(N//2)*2])))
else:
x=sum(A[(idx//2)*2:])-sum(A[:(idx//2)*2])
y=sum(A[((idx+1)//2)*2:])-... | 9 | 17 | 289 | 407 | N = int(eval(input()))
A = list(map(int, input().split()))
dp = [[0, 0] for i in range(N)]
dp[0][0] = A[0] + A[1]
dp[0][1] = -1 * dp[0][0]
for i in range(1, N - 1):
dp[i][0] = max(dp[i - 1][0] + A[i + 1], dp[i - 1][1] + A[i + 1])
dp[i][1] = max(
dp[i - 1][0] - 2 * A[i] - A[i + 1], dp[i - 1][1] + 2 * A[i... | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
idx = N
for i in range(N):
if A[i] > 0:
idx = i
break
if idx == 0:
print((sum(A)))
elif idx == N:
print((sum(A[(N // 2) * 2 :]) - sum(A[: (N // 2) * 2])))
else:
x = sum(A[(idx // 2) * 2 :]) - sum(A[: (idx // 2) * 2])
... | false | 47.058824 | [
"-dp = [[0, 0] for i in range(N)]",
"-dp[0][0] = A[0] + A[1]",
"-dp[0][1] = -1 * dp[0][0]",
"-for i in range(1, N - 1):",
"- dp[i][0] = max(dp[i - 1][0] + A[i + 1], dp[i - 1][1] + A[i + 1])",
"- dp[i][1] = max(",
"- dp[i - 1][0] - 2 * A[i] - A[i + 1], dp[i - 1][1] + 2 * A[i] - A[i + 1]",
... | false | 0.037576 | 0.037519 | 1.001507 | [
"s781186295",
"s195535161"
] |
u197615397 | p02364 | python | s907846664 | s135000985 | 520 | 410 | 25,704 | 24,012 | Accepted | Accepted | 21.15 | import sys
readline = sys.stdin.readline
class UnionFind:
__slots__ = ["nodes"]
def __init__(self, n: int) -> None:
self.nodes = [-1]*n
def get_root(self, x: int) -> int:
if self.nodes[x] < 0:
return x
else:
self.nodes[x] = self.get_root(self... | import sys
def kruskal(n: int, edges: list) -> int:
tree = [-1]*n
def get_root(x):
if tree[x] < 0:
return x
tree[x] = get_root(tree[x])
return tree[x]
def unite(x, y):
x, y = get_root(x), get_root(y)
if x != y:
big, small = (x,... | 51 | 24 | 1,289 | 697 | import sys
readline = sys.stdin.readline
class UnionFind:
__slots__ = ["nodes"]
def __init__(self, n: int) -> None:
self.nodes = [-1] * n
def get_root(self, x: int) -> int:
if self.nodes[x] < 0:
return x
else:
self.nodes[x] = self.get_root(self.nodes[x])
... | import sys
def kruskal(n: int, edges: list) -> int:
tree = [-1] * n
def get_root(x):
if tree[x] < 0:
return x
tree[x] = get_root(tree[x])
return tree[x]
def unite(x, y):
x, y = get_root(x), get_root(y)
if x != y:
big, small = (x, y) if tree... | false | 52.941176 | [
"-",
"-readline = sys.stdin.readline",
"-",
"-",
"-class UnionFind:",
"- __slots__ = [\"nodes\"]",
"-",
"- def __init__(self, n: int) -> None:",
"- self.nodes = [-1] * n",
"-",
"- def get_root(self, x: int) -> int:",
"- if self.nodes[x] < 0:",
"- return x",
... | false | 0.047678 | 0.043144 | 1.105095 | [
"s907846664",
"s135000985"
] |
u062147869 | p03225 | python | s204405604 | s944546395 | 1,869 | 1,351 | 70,492 | 58,972 | Accepted | Accepted | 27.72 | H,W=list(map(int,input().split()))
S=[eval(input()) for i in range(H)]
table=[[0]*(H+W-1) for i in range(H+W-1)]
for j in range(H):
for i in range(W):
table[i+j][i-j+H-1]=S[j][i]
yoko=[[0]*(H+W) for i in range(H+W-1)]
for j in range(H+W-1):
for i in range(1,H+W):
if table[j][i-1]=='#':
... | H,W=list(map(int,input().split()))
S=[list(eval(input())) for i in range(H)]
table=[[0]*(H+W-1) for i in range(H+W-1)]
for j in range(H):
for i in range(W):
if S[j][i]=='#':
table[i+j][i-j+H-1]=1
yoko=[[0]*(H+W) for i in range(H+W-1)]
for j in range(H+W-1):
for i in range(1,H+W):
... | 47 | 43 | 1,475 | 1,353 | H, W = list(map(int, input().split()))
S = [eval(input()) for i in range(H)]
table = [[0] * (H + W - 1) for i in range(H + W - 1)]
for j in range(H):
for i in range(W):
table[i + j][i - j + H - 1] = S[j][i]
yoko = [[0] * (H + W) for i in range(H + W - 1)]
for j in range(H + W - 1):
for i in range(1, H +... | H, W = list(map(int, input().split()))
S = [list(eval(input())) for i in range(H)]
table = [[0] * (H + W - 1) for i in range(H + W - 1)]
for j in range(H):
for i in range(W):
if S[j][i] == "#":
table[i + j][i - j + H - 1] = 1
yoko = [[0] * (H + W) for i in range(H + W - 1)]
for j in range(H + W ... | false | 8.510638 | [
"-S = [eval(input()) for i in range(H)]",
"+S = [list(eval(input())) for i in range(H)]",
"- table[i + j][i - j + H - 1] = S[j][i]",
"+ if S[j][i] == \"#\":",
"+ table[i + j][i - j + H - 1] = 1",
"- if table[j][i - 1] == \"#\":",
"- yoko[j][i] = yoko[j][i - 1] ... | false | 0.032042 | 0.036243 | 0.884075 | [
"s204405604",
"s944546395"
] |
u335406314 | p02578 | python | s859524540 | s776712643 | 1,799 | 374 | 113,232 | 50,792 | Accepted | Accepted | 79.21 | import numpy as np
from numba import jit
N = int(eval(input('')))
A1 = np.array(list(map(int, input('').split(' '))))
@jit(nopython=True)
def func(A):
step = 0
for k in range(0,N-1):
if A[k] > A[k+1]:
add = A[k] - A[k+1]
step += add
A[k+1] += add
ret... | import numpy as np
N = int(eval(input('')))
A1 = np.array(list(map(int, input('').split(' '))))
def func(A):
step = 0
for k in range(0,N-1):
if A[k] > A[k+1]:
add = A[k] - A[k+1]
step += add
A[k+1] += add
return step
print((func(A1))) | 16 | 14 | 349 | 305 | import numpy as np
from numba import jit
N = int(eval(input("")))
A1 = np.array(list(map(int, input("").split(" "))))
@jit(nopython=True)
def func(A):
step = 0
for k in range(0, N - 1):
if A[k] > A[k + 1]:
add = A[k] - A[k + 1]
step += add
A[k + 1] += add
retur... | import numpy as np
N = int(eval(input("")))
A1 = np.array(list(map(int, input("").split(" "))))
def func(A):
step = 0
for k in range(0, N - 1):
if A[k] > A[k + 1]:
add = A[k] - A[k + 1]
step += add
A[k + 1] += add
return step
print((func(A1)))
| false | 12.5 | [
"-from numba import jit",
"-@jit(nopython=True)"
] | false | 0.271684 | 0.261212 | 1.040091 | [
"s859524540",
"s776712643"
] |
u654470292 | p02691 | python | s483040434 | s727169963 | 181 | 150 | 136,924 | 124,312 | Accepted | Accepted | 17.13 | import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
sys.setrecurs... | import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
sys.setrecurs... | 26 | 30 | 592 | 666 | import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
sys.setrecursionl... | import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
sys.setrecursionl... | false | 13.333333 | [
"-dic = defaultdict(int)",
"+dic = {}",
"- ans += dic[i - a[i]]",
"- dic[a[i] + i] += 1",
"+ if i - a[i] in dic:",
"+ ans += dic[i - a[i]]",
"+ if a[i] + i in dic:",
"+ dic[a[i] + i] += 1",
"+ else:",
"+ dic[a[i] + i] = 1"
] | false | 0.038596 | 0.119396 | 0.323261 | [
"s483040434",
"s727169963"
] |
u037430802 | p03837 | python | s275038193 | s233008222 | 125 | 112 | 3,572 | 3,568 | Accepted | Accepted | 10.4 | import heapq
N, M = list(map(int, input().split()))
es = [[] for _ in range(N)]
INF = float("inf")
for i in range(M):
a, b, c = list(map(int, input().split()))
a, b = a-1, b-1
es[a].append((b,c))
es[b].append((a,c))
def djkstra(start, n, es):
# start:スタート地点のノード
# n:ノード数
# e... | import heapq
N,M = list(map(int, input().split()))
es = [[] for _ in range(N)]
for i in range(M):
a,b,c = list(map(int, input().split()))
es[a-1].append((c, b-1))
es[b-1].append((c, a-1))
INF = float("inf")
# 全ノード間の最短距離を求める
d = [[INF for _ in range(N)] for _ in range(N)]
for i in range(N):... | 51 | 38 | 1,270 | 865 | import heapq
N, M = list(map(int, input().split()))
es = [[] for _ in range(N)]
INF = float("inf")
for i in range(M):
a, b, c = list(map(int, input().split()))
a, b = a - 1, b - 1
es[a].append((b, c))
es[b].append((a, c))
def djkstra(start, n, es):
# start:スタート地点のノード
# n:ノード数
# es:edges, ... | import heapq
N, M = list(map(int, input().split()))
es = [[] for _ in range(N)]
for i in range(M):
a, b, c = list(map(int, input().split()))
es[a - 1].append((c, b - 1))
es[b - 1].append((c, a - 1))
INF = float("inf")
# 全ノード間の最短距離を求める
d = [[INF for _ in range(N)] for _ in range(N)]
for i in range(N):
q... | false | 25.490196 | [
"-INF = float(\"inf\")",
"- a, b = a - 1, b - 1",
"- es[a].append((b, c))",
"- es[b].append((a, c))",
"-",
"-",
"-def djkstra(start, n, es):",
"- # start:スタート地点のノード",
"- # n:ノード数",
"- # es:edges, ある辺のコスト",
"- # 最初は全部未探索",
"- costs = [INF] * n",
"- costs[start] = 0"... | false | 0.048472 | 0.046205 | 1.049056 | [
"s275038193",
"s233008222"
] |
u133936772 | p02550 | python | s288447511 | s148286258 | 91 | 61 | 13,936 | 14,052 | Accepted | Accepted | 32.97 | n,x,m=list(map(int,input().split()))
l=[0]*m
s=[0]*m
t=p=0
while l[x]<1:
t+=1
l[x]=t
s[x]=s[p]+x
p=x
x=pow(p,2,m)
T=t+1-l[x]
S=s[p]+x-s[x]
d,m=divmod(n-l[x],T)
print((S*d+s[l.index(l[x]+m)])) | n,x,m=list(map(int,input().split()))
l,s=[0]*m,[0]*m
t=p=0
while l[x]<1:
t+=1
l[x]=t
s[x]=s[p]+x
p=x
x=p*p%m
k=l[x]
d,m=divmod(n-k,t+1-k)
print(((s[p]+x-s[x])*d+s[l.index(k+m)])) | 14 | 12 | 206 | 191 | n, x, m = list(map(int, input().split()))
l = [0] * m
s = [0] * m
t = p = 0
while l[x] < 1:
t += 1
l[x] = t
s[x] = s[p] + x
p = x
x = pow(p, 2, m)
T = t + 1 - l[x]
S = s[p] + x - s[x]
d, m = divmod(n - l[x], T)
print((S * d + s[l.index(l[x] + m)]))
| n, x, m = list(map(int, input().split()))
l, s = [0] * m, [0] * m
t = p = 0
while l[x] < 1:
t += 1
l[x] = t
s[x] = s[p] + x
p = x
x = p * p % m
k = l[x]
d, m = divmod(n - k, t + 1 - k)
print(((s[p] + x - s[x]) * d + s[l.index(k + m)]))
| false | 14.285714 | [
"-l = [0] * m",
"-s = [0] * m",
"+l, s = [0] * m, [0] * m",
"- x = pow(p, 2, m)",
"-T = t + 1 - l[x]",
"-S = s[p] + x - s[x]",
"-d, m = divmod(n - l[x], T)",
"-print((S * d + s[l.index(l[x] + m)]))",
"+ x = p * p % m",
"+k = l[x]",
"+d, m = divmod(n - k, t + 1 - k)",
"+print(((s[p] + x -... | false | 0.048583 | 0.04487 | 1.08275 | [
"s288447511",
"s148286258"
] |
u477977638 | p03112 | python | s948322764 | s279956520 | 1,998 | 647 | 79,592 | 16,244 | Accepted | Accepted | 67.62 | import bisect
A,B,Q=list(map(int,input().split()))
inf=10**18
s=[-inf]+[int(eval(input())) for i in range(A)]+[inf]
t=[-inf]+[int(eval(input())) for i in range(B)]+[inf]
for i in range(Q):
ans=inf
x=int(eval(input()))
b=bisect.bisect_left(s,x)
d=bisect.bisect_left(t,x)
for S in (s[b-1],s[b]):
... | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np
inf=10**18
import bisect
def main():
a,b,q=list(map(int,input().split()))
s=[-inf]+[int(eval(input())) for _ in ... | 15 | 37 | 390 | 687 | import bisect
A, B, Q = list(map(int, input().split()))
inf = 10**18
s = [-inf] + [int(eval(input())) for i in range(A)] + [inf]
t = [-inf] + [int(eval(input())) for i in range(B)] + [inf]
for i in range(Q):
ans = inf
x = int(eval(input()))
b = bisect.bisect_left(s, x)
d = bisect.bisect_left(t, x)
... | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np
inf = 10**18
import bisect
def main():
a, b, q = list(map(int, input().split()))
s = [-inf] + [int(eval(input())) for _ in r... | false | 59.459459 | [
"+import sys",
"+",
"+read = sys.stdin.buffer.read",
"+input = sys.stdin.buffer.readline",
"+inputs = sys.stdin.buffer.readlines",
"+# rstrip().decode('utf-8')",
"+# map(int,input().split())",
"+# import numpy as np",
"+inf = 10**18",
"-A, B, Q = list(map(int, input().split()))",
"-inf = 10**18"... | false | 0.046581 | 0.047082 | 0.989352 | [
"s948322764",
"s279956520"
] |
u644516473 | p03339 | python | s816277864 | s141953908 | 99 | 80 | 3,676 | 3,672 | Accepted | Accepted | 19.19 | N = int(eval(input()))
S = eval(input())
x = S.count('E')
ans = x
for s in S:
if s == 'E':
x -= 1
if ans > x:
ans = x
else:
x += 1
if ans > x:
ans = x
print(ans)
| N = int(eval(input()))
S = eval(input())
x = S.count('E')
ans = x
for s in S:
if s == 'E':
x -= 1
if ans > x:
ans = x
else:
x += 1
print(ans)
| 14 | 12 | 219 | 185 | N = int(eval(input()))
S = eval(input())
x = S.count("E")
ans = x
for s in S:
if s == "E":
x -= 1
if ans > x:
ans = x
else:
x += 1
if ans > x:
ans = x
print(ans)
| N = int(eval(input()))
S = eval(input())
x = S.count("E")
ans = x
for s in S:
if s == "E":
x -= 1
if ans > x:
ans = x
else:
x += 1
print(ans)
| false | 14.285714 | [
"- if ans > x:",
"- ans = x"
] | false | 0.045604 | 0.045019 | 1.012996 | [
"s816277864",
"s141953908"
] |
u018679195 | p03733 | python | s241060956 | s098288421 | 159 | 141 | 26,836 | 26,836 | Accepted | Accepted | 11.32 | #データ入力
data = eval(input())
data = data.split(" ")
n_large = int(data[0])
t_large = int(data[1])
data = eval(input())
data = data.split(" ")
ts = []
for d in data:
ts.append(int(d))
#計算
ts.sort()
total = ts[0]
for i in range(1, len(ts)):
buf = ts[i] - ts[i - 1]
if buf > t_large:
... | data = eval(input())
data = data.split(" ")
n_large = int(data[0])
t_large = int(data[1])
data = eval(input())
data = data.split(" ")
ts = []
for d in data:
ts.append(int(d))
max = ts[n_large - 1] + t_large
decrease = 0
for i in range(0, n_large - 1):
a = ts[i + 1] - ts[i]
if a > t_large:
b = a... | 27 | 20 | 397 | 358 | # データ入力
data = eval(input())
data = data.split(" ")
n_large = int(data[0])
t_large = int(data[1])
data = eval(input())
data = data.split(" ")
ts = []
for d in data:
ts.append(int(d))
# 計算
ts.sort()
total = ts[0]
for i in range(1, len(ts)):
buf = ts[i] - ts[i - 1]
if buf > t_large:
total += t_large
... | data = eval(input())
data = data.split(" ")
n_large = int(data[0])
t_large = int(data[1])
data = eval(input())
data = data.split(" ")
ts = []
for d in data:
ts.append(int(d))
max = ts[n_large - 1] + t_large
decrease = 0
for i in range(0, n_large - 1):
a = ts[i + 1] - ts[i]
if a > t_large:
b = a - t_... | false | 25.925926 | [
"-# データ入力",
"-# 計算",
"-ts.sort()",
"-total = ts[0]",
"-for i in range(1, len(ts)):",
"- buf = ts[i] - ts[i - 1]",
"- if buf > t_large:",
"- total += t_large",
"- else:",
"- total += buf",
"-total += t_large",
"-print(total)",
"+max = ts[n_large - 1] + t_large",
"+dec... | false | 0.045256 | 0.085067 | 0.531999 | [
"s241060956",
"s098288421"
] |
u021548497 | p02579 | python | s863297513 | s868698246 | 1,916 | 205 | 23,520 | 84,800 | Accepted | Accepted | 89.3 | import sys
from collections import deque
input = sys.stdin.readline
def main():
h, w = list(map(int, input().split()))
ch, cw = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
ch += 1
cw += 1
dh += 1
dw += 1
s = ["#"*(w+4)]
s... | import sys
input = sys.stdin.readline
def main():
h, w = list(map(int, input().split()))
ch, cw = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
ch += 1
cw += 1
dh += 1
dw += 1
s = ["#"*(w+4)]
s.append("#"*(w+4))
for i i... | 65 | 64 | 1,785 | 1,732 | import sys
from collections import deque
input = sys.stdin.readline
def main():
h, w = list(map(int, input().split()))
ch, cw = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
ch += 1
cw += 1
dh += 1
dw += 1
s = ["#" * (w + 4)]
s.append("#" * (w + 4))
... | import sys
input = sys.stdin.readline
def main():
h, w = list(map(int, input().split()))
ch, cw = list(map(int, input().split()))
dh, dw = list(map(int, input().split()))
ch += 1
cw += 1
dh += 1
dw += 1
s = ["#" * (w + 4)]
s.append("#" * (w + 4))
for i in range(h):
s.a... | false | 1.538462 | [
"-from collections import deque",
"- not_yet = deque([(ch, cw)])",
"- one_time = deque([])",
"+ not_yet = [(ch, cw)]",
"+ one_time = []",
"- x, y = not_yet.popleft()",
"+ x, y = not_yet.pop()",
"- x2, y2 = one_time.popleft()",
"+ x2, y2 = one_t... | false | 0.048219 | 0.036302 | 1.328278 | [
"s863297513",
"s868698246"
] |
u689890477 | p02675 | python | s692139303 | s496510643 | 23 | 20 | 9,176 | 9,088 | Accepted | Accepted | 13.04 | n = int(eval(input()))
a = n%10
if a == 3:
print("bon")
elif a == 0:
print("pon")
elif a == 1:
print("pon")
elif a == 6:
print("pon")
elif a == 8:
print("pon")
else:
print("hon") | n = int(eval(input()))
hon = [2,4,5,7,9]
pon = [0,1,6,8]
a = n % 10
if a in hon:
print("hon")
elif a in pon:
print("pon")
else:
print("bon") | 15 | 11 | 211 | 157 | n = int(eval(input()))
a = n % 10
if a == 3:
print("bon")
elif a == 0:
print("pon")
elif a == 1:
print("pon")
elif a == 6:
print("pon")
elif a == 8:
print("pon")
else:
print("hon")
| n = int(eval(input()))
hon = [2, 4, 5, 7, 9]
pon = [0, 1, 6, 8]
a = n % 10
if a in hon:
print("hon")
elif a in pon:
print("pon")
else:
print("bon")
| false | 26.666667 | [
"+hon = [2, 4, 5, 7, 9]",
"+pon = [0, 1, 6, 8]",
"-if a == 3:",
"- print(\"bon\")",
"-elif a == 0:",
"- print(\"pon\")",
"-elif a == 1:",
"- print(\"pon\")",
"-elif a == 6:",
"- print(\"pon\")",
"-elif a == 8:",
"+if a in hon:",
"+ print(\"hon\")",
"+elif a in pon:",
"- ... | false | 0.039992 | 0.040538 | 0.986535 | [
"s692139303",
"s496510643"
] |
u098012509 | p02900 | python | s778762198 | s137065918 | 461 | 272 | 5,304 | 9,164 | Accepted | Accepted | 41 | import sys
input = sys.stdin.readline
import fractions
import math
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... | A, B = [int(x) for x in input().split()]
def prime_factorization(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return factors
Aprimes = prime_factoriza... | 46 | 29 | 887 | 531 | import sys
input = sys.stdin.readline
import fractions
import math
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
def ma... | A, B = [int(x) for x in input().split()]
def prime_factorization(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return factors
Aprimes = prime_factorization(A)
Bprim... | false | 36.956522 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-import fractions",
"-import math",
"+A, B = [int(x) for x in input().split()]",
"-def make_divisors(n):",
"- divisors = []",
"- for i in range(1, int(n**0.5) + 1):",
"- if n % i == 0:",
"- divisors.append(i)",
"- ... | false | 0.081947 | 0.037898 | 2.162279 | [
"s778762198",
"s137065918"
] |
u072717685 | p02880 | python | s875927651 | s449909373 | 20 | 17 | 3,316 | 3,060 | Accepted | Accepted | 15 | import sys
#input = sys.stdin.readline
from collections import Counter
def main():
n = int(eval(input( )))
for i in range(1,10):
for j in range(1,10):
if n == i * j:
print('Yes')
exit()
else:
print('No')
if __name__ == '__main__':
... |
import sys
def main():
n = int(eval(input()))
for i1 in range(1, 10):
for i2 in range(1,10):
if n == i1 * i2:
print('Yes')
sys.exit()
else:
print('No')
if __name__ == '__main__':
main() | 16 | 16 | 326 | 274 | import sys
# input = sys.stdin.readline
from collections import Counter
def main():
n = int(eval(input()))
for i in range(1, 10):
for j in range(1, 10):
if n == i * j:
print("Yes")
exit()
else:
print("No")
if __name__ == "__main__":
main()... | import sys
def main():
n = int(eval(input()))
for i1 in range(1, 10):
for i2 in range(1, 10):
if n == i1 * i2:
print("Yes")
sys.exit()
else:
print("No")
if __name__ == "__main__":
main()
| false | 0 | [
"-",
"-# input = sys.stdin.readline",
"-from collections import Counter",
"- for i in range(1, 10):",
"- for j in range(1, 10):",
"- if n == i * j:",
"+ for i1 in range(1, 10):",
"+ for i2 in range(1, 10):",
"+ if n == i1 * i2:",
"- exit()",... | false | 0.047766 | 0.05223 | 0.91453 | [
"s875927651",
"s449909373"
] |
u692453235 | p02768 | python | s320960757 | s233712873 | 243 | 113 | 32,848 | 9,160 | Accepted | Accepted | 53.5 | n, a, b = list(map(int, input().split()))
mod = 10 ** 9 + 7
N = min(n, 2 * 10**5)
fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
def comb(n, r):
return fac[n] * ( finv[r] * finv[n-r] % mod ) % mod
for i in range(2, N + 1):
fac.append( ( fac[-1] * i ) % mod )
inv.append( mod - ( inv[mod % i] * (mod // i)... | n, a, b = list(map(int, input().split()))
mod = 10 ** 9 + 7
def frac_rev(n, r):
x = 1
for i in range(n, n-r, -1):
x = x * i % mod
return x
def frac(n):
x = 1
for i in range(1, n+1):
x = x * i % mod
return x
print((( pow(2, n, mod) - 1 - frac_rev(n, a) * pow(frac(a), mod-2, mod) %... | 26 | 17 | 661 | 375 | n, a, b = list(map(int, input().split()))
mod = 10**9 + 7
N = min(n, 2 * 10**5)
fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
def comb(n, r):
return fac[n] * (finv[r] * finv[n - r] % mod) % mod
for i in range(2, N + 1):
fac.append((fac[-1] * i) % mod)
inv.append(mod - (inv[mod % i] * (mod // i) % mod))
fi... | n, a, b = list(map(int, input().split()))
mod = 10**9 + 7
def frac_rev(n, r):
x = 1
for i in range(n, n - r, -1):
x = x * i % mod
return x
def frac(n):
x = 1
for i in range(1, n + 1):
x = x * i % mod
return x
print(
(
(
pow(2, n, mod)
- 1... | false | 34.615385 | [
"-N = min(n, 2 * 10**5)",
"-fac = [1, 1]",
"-finv = [1, 1]",
"-inv = [0, 1]",
"-",
"-",
"-def comb(n, r):",
"- return fac[n] * (finv[r] * finv[n - r] % mod) % mod",
"-",
"-",
"-for i in range(2, N + 1):",
"- fac.append((fac[-1] * i) % mod)",
"- inv.append(mod - (inv[mod % i] * (mod ... | false | 0.371024 | 0.07277 | 5.098553 | [
"s320960757",
"s233712873"
] |
u315685304 | p03110 | python | s096301731 | s220979795 | 149 | 18 | 12,444 | 2,940 | Accepted | Accepted | 87.92 | import numpy as np
people_num = int(eval(input()))
otoshidama_box = []
for i in range(people_num):
value, v_type = [_ for _ in input().split()]
value = float(value)
if str(v_type) == "JPY":
ans = value
elif str(v_type) == "BTC":
ans = value * 380000.0
otoshidama_b... | n = int(eval(input()))
ans = 0
for _ in range(n):
value, v_type = input().split()
value = float(value)
if v_type=="BTC":
ans += value * 380000.0
else:
ans += value
print(ans) | 17 | 11 | 424 | 211 | import numpy as np
people_num = int(eval(input()))
otoshidama_box = []
for i in range(people_num):
value, v_type = [_ for _ in input().split()]
value = float(value)
if str(v_type) == "JPY":
ans = value
elif str(v_type) == "BTC":
ans = value * 380000.0
otoshidama_box.append(float(ans... | n = int(eval(input()))
ans = 0
for _ in range(n):
value, v_type = input().split()
value = float(value)
if v_type == "BTC":
ans += value * 380000.0
else:
ans += value
print(ans)
| false | 35.294118 | [
"-import numpy as np",
"-",
"-people_num = int(eval(input()))",
"-otoshidama_box = []",
"-for i in range(people_num):",
"- value, v_type = [_ for _ in input().split()]",
"+n = int(eval(input()))",
"+ans = 0",
"+for _ in range(n):",
"+ value, v_type = input().split()",
"- if str(v_type) ... | false | 0.19701 | 0.113716 | 1.732463 | [
"s096301731",
"s220979795"
] |
u741397536 | p03013 | python | s320628756 | s539577357 | 531 | 213 | 460,056 | 7,852 | Accepted | Accepted | 59.89 | N, M = list(map(int, input().split()))
arr = []
for i in range(M):
arr.append(int(eval(input())))
arr.append(10**10)
dp = [0 for i in range(N+1)]
dp[0] = 1
tmp = 0
if arr[0] == 1:
dp[1] = 0
tmp += 1
else:
dp[1] = 1
for i in range(N-1):
if arr[tmp] == i+2:
dp[i+2] = ... | N, M = list(map(int, input().split()))
arr = []
MOD = 1000000007
for i in range(M):
arr.append(int(eval(input())))
arr.append(10**10)
dp = [0 for i in range(N+1)]
dp[0] = 1
tmp = 0
if arr[0] == 1:
dp[1] = 0
tmp += 1
else:
dp[1] = 1
for i in range(N-1):
if arr[tmp] == i+2:
... | 26 | 27 | 405 | 418 | N, M = list(map(int, input().split()))
arr = []
for i in range(M):
arr.append(int(eval(input())))
arr.append(10**10)
dp = [0 for i in range(N + 1)]
dp[0] = 1
tmp = 0
if arr[0] == 1:
dp[1] = 0
tmp += 1
else:
dp[1] = 1
for i in range(N - 1):
if arr[tmp] == i + 2:
dp[i + 2] = 0
tmp += 1... | N, M = list(map(int, input().split()))
arr = []
MOD = 1000000007
for i in range(M):
arr.append(int(eval(input())))
arr.append(10**10)
dp = [0 for i in range(N + 1)]
dp[0] = 1
tmp = 0
if arr[0] == 1:
dp[1] = 0
tmp += 1
else:
dp[1] = 1
for i in range(N - 1):
if arr[tmp] == i + 2:
dp[i + 2] = 0... | false | 3.703704 | [
"+MOD = 1000000007",
"- dp[i + 2] = dp[i + 1] + dp[i]",
"-print((dp[N] % (1000000007)))",
"+ dp[i + 2] = (dp[i + 1] + dp[i]) % MOD",
"+print((dp[N]))"
] | false | 0.043246 | 0.037135 | 1.164563 | [
"s320628756",
"s539577357"
] |
u141610915 | p02779 | python | s298621004 | s897684539 | 303 | 274 | 94,036 | 97,620 | Accepted | Accepted | 9.57 | import sys
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
s = set()
for x in a:
if x in s:
print("NO")
exit(0)
s.add(x)
print("YES") | import sys
input = sys.stdin.readline
N = int(eval(input()))
a = set(map(int, input().split()))
if N == len(a): print("YES")
else: print("NO") | 11 | 6 | 187 | 141 | import sys
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
s = set()
for x in a:
if x in s:
print("NO")
exit(0)
s.add(x)
print("YES")
| import sys
input = sys.stdin.readline
N = int(eval(input()))
a = set(map(int, input().split()))
if N == len(a):
print("YES")
else:
print("NO")
| false | 45.454545 | [
"-a = list(map(int, input().split()))",
"-s = set()",
"-for x in a:",
"- if x in s:",
"- print(\"NO\")",
"- exit(0)",
"- s.add(x)",
"-print(\"YES\")",
"+a = set(map(int, input().split()))",
"+if N == len(a):",
"+ print(\"YES\")",
"+else:",
"+ print(\"NO\")"
] | false | 0.074042 | 0.040921 | 1.809405 | [
"s298621004",
"s897684539"
] |
u692453235 | p02574 | python | s760615930 | s531271554 | 669 | 372 | 224,772 | 187,224 | Accepted | Accepted | 44.39 | from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
INF = 10**6
def min_primes(n):
ret = [i for i in range(n+1)]
for i in range(2, int(n**0.5)+1):
if ret[i] < i:
continue
for j in range(i, n+1, i):
ret[j] = min(i, ret[j])
return ret
... | import math
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
Nums = [0]*(10**6 + 1)
for a in A:
Nums[a] += 1
GCD = A[0]
for i in range(N-1):
GCD = math.gcd(GCD, A[i+1])
if GCD != 1:
print("not coprime")
else:
for d in range(2, 10**6+1):
... | 41 | 24 | 688 | 427 | from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
INF = 10**6
def min_primes(n):
ret = [i for i in range(n + 1)]
for i in range(2, int(n**0.5) + 1):
if ret[i] < i:
continue
for j in range(i, n + 1, i):
ret[j] = min(i, ret[j]... | import math
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
Nums = [0] * (10**6 + 1)
for a in A:
Nums[a] += 1
GCD = A[0]
for i in range(N - 1):
GCD = math.gcd(GCD, A[i + 1])
if GCD != 1:
print("not coprime")
else:
for d in range(2, 10**6 + 1):
cn... | false | 41.463415 | [
"-from collections import defaultdict",
"+import math",
"+import sys",
"+input = sys.stdin.readline",
"-INF = 10**6",
"-",
"-",
"-def min_primes(n):",
"- ret = [i for i in range(n + 1)]",
"- for i in range(2, int(n**0.5) + 1):",
"- if ret[i] < i:",
"- continue",
"- ... | false | 1.004668 | 0.813789 | 1.234556 | [
"s760615930",
"s531271554"
] |
u798803522 | p02345 | python | s013097560 | s574716798 | 3,470 | 2,990 | 11,136 | 11,808 | Accepted | Accepted | 13.83 | import math
def update(index,n):
targ[index] = n
index = (index - 1) // 2
while True:
targ[index] = min(targ[index * 2 + 1],targ[index * 2 + 2])
if index <= 0:
break
index = (index - 1) // 2
def find(i,e,node,inode,enode):
#print(i,e,node,inode,enode)
... | import math
import sys
def update(index,n):
targ[index] = n
index = (index - 1) // 2
while True:
targ[index] = min(targ[index * 2 + 1],targ[index * 2 + 2])
if index <= 0:
break
index = (index - 1) // 2
def find(i,e,node,inode,enode):
#print(i,e,node,inode... | 40 | 41 | 1,098 | 1,133 | import math
def update(index, n):
targ[index] = n
index = (index - 1) // 2
while True:
targ[index] = min(targ[index * 2 + 1], targ[index * 2 + 2])
if index <= 0:
break
index = (index - 1) // 2
def find(i, e, node, inode, enode):
# print(i,e,node,inode,enode)
i... | import math
import sys
def update(index, n):
targ[index] = n
index = (index - 1) // 2
while True:
targ[index] = min(targ[index * 2 + 1], targ[index * 2 + 2])
if index <= 0:
break
index = (index - 1) // 2
def find(i, e, node, inode, enode):
# print(i,e,node,inode,e... | false | 2.439024 | [
"+import sys",
"-num, query = (int(n) for n in input().split(\" \"))",
"+f = sys.stdin",
"+num, query = (int(n) for n in f.readline().split(\" \"))",
"- temp = [int(n) for n in input().split(\" \")]",
"+ temp = [int(n) for n in f.readline().split(\" \")]"
] | false | 0.037674 | 0.043095 | 0.874215 | [
"s013097560",
"s574716798"
] |
u584174687 | p03163 | python | s463221631 | s388434135 | 1,927 | 230 | 656,728 | 92,092 | Accepted | Accepted | 88.06 | from collections import defaultdict
def main():
num, weigh = list(map(int, input().split()))
dp = [defaultdict(int) for i in range(num + 1)]
dp[0][0] = 0
for i in range(1, num + 1):
data = list(map(int, input().split()))
for pre_value in list(dp[i - 1].keys()):
dp... | import numpy as np
def main():
num, weigh = list(map(int, input().split()))
dp = np.zeros((num + 1, weigh + 1), dtype=int)
for i in range(1, num + 1):
now_weigh, now_value = list(map(int, input().split()))
dp[i, :now_weigh] = dp[i - 1, :now_weigh]
dp[i, now_weigh:] = np.ma... | 19 | 17 | 610 | 455 | from collections import defaultdict
def main():
num, weigh = list(map(int, input().split()))
dp = [defaultdict(int) for i in range(num + 1)]
dp[0][0] = 0
for i in range(1, num + 1):
data = list(map(int, input().split()))
for pre_value in list(dp[i - 1].keys()):
dp[i][pre_va... | import numpy as np
def main():
num, weigh = list(map(int, input().split()))
dp = np.zeros((num + 1, weigh + 1), dtype=int)
for i in range(1, num + 1):
now_weigh, now_value = list(map(int, input().split()))
dp[i, :now_weigh] = dp[i - 1, :now_weigh]
dp[i, now_weigh:] = np.maximum(
... | false | 10.526316 | [
"-from collections import defaultdict",
"+import numpy as np",
"- dp = [defaultdict(int) for i in range(num + 1)]",
"- dp[0][0] = 0",
"+ dp = np.zeros((num + 1, weigh + 1), dtype=int)",
"- data = list(map(int, input().split()))",
"- for pre_value in list(dp[i - 1].keys()):",
"- ... | false | 0.034593 | 0.221178 | 0.156402 | [
"s463221631",
"s388434135"
] |
u707124227 | p03584 | python | s648161407 | s896469455 | 572 | 322 | 27,324 | 85,548 | Accepted | Accepted | 43.71 | n,k=list(map(int,input().split()))
ab=[list(map(int,input(). split())) for _ in range(n)]
bk=list(bin(k)[2:])
if '0' not in bk:
t=k
ans=0
for a,b in ab:
if a<=t:ans+=b
print(ans)
else:
ks=[k]
for i in range(len(bk)):
if bk[i]=='1':
if i==0:
ks.append(int('1'*(len(bk)-1),2... | def main(n,k,ab):
ks=[k]
m=len(bin(k))-2
# kはm桁
kbin=bin(k)[2:]
now=0
for i in range(m):
if kbin[i]=='1' and i<m-1:
ks.append(now+pow(2,m-i-1)-1)
now+=int(kbin[i])*pow(2,m-i-1)
ans=0
for x in ks:
tmp=0
for a,b in ab:
if a|x==x:tmp+=b
ans=max(ans,tmp)
pri... | 22 | 21 | 511 | 428 | n, k = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
bk = list(bin(k)[2:])
if "0" not in bk:
t = k
ans = 0
for a, b in ab:
if a <= t:
ans += b
print(ans)
else:
ks = [k]
for i in range(len(bk)):
if bk[i] == "1":
if... | def main(n, k, ab):
ks = [k]
m = len(bin(k)) - 2
# kはm桁
kbin = bin(k)[2:]
now = 0
for i in range(m):
if kbin[i] == "1" and i < m - 1:
ks.append(now + pow(2, m - i - 1) - 1)
now += int(kbin[i]) * pow(2, m - i - 1)
ans = 0
for x in ks:
tmp = 0
fo... | false | 4.545455 | [
"+def main(n, k, ab):",
"+ ks = [k]",
"+ m = len(bin(k)) - 2",
"+ # kはm桁",
"+ kbin = bin(k)[2:]",
"+ now = 0",
"+ for i in range(m):",
"+ if kbin[i] == \"1\" and i < m - 1:",
"+ ks.append(now + pow(2, m - i - 1) - 1)",
"+ now += int(kbin[i]) * pow(2, m - ... | false | 0.117336 | 0.083504 | 1.405159 | [
"s648161407",
"s896469455"
] |
u098012509 | p02756 | python | s721753333 | s967726885 | 604 | 257 | 12,012 | 10,468 | Accepted | Accepted | 57.45 | import sys
import collections
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
S = input().strip()
Q = int(input())
rev = 0
sdeq = collections.deque()
for s in S:
sdeq.append(ord(s) - ord('a'))
for i in range(Q):
A = [x for x in input(... | import sys
import collections
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
S = input().strip()
Q = int(eval(input()))
rev = 0
sdeq = collections.deque(list(S))
for i in range(Q):
A = [x for x in input().split()]
if len(A) == 1:
... | 47 | 43 | 1,066 | 872 | import sys
import collections
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
S = input().strip()
Q = int(input())
rev = 0
sdeq = collections.deque()
for s in S:
sdeq.append(ord(s) - ord("a"))
for i in range(Q):
A = [x for x in input().split()]
if l... | import sys
import collections
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
S = input().strip()
Q = int(eval(input()))
rev = 0
sdeq = collections.deque(list(S))
for i in range(Q):
A = [x for x in input().split()]
if len(A) == 1:
rev = (rev + 1) % ... | false | 8.510638 | [
"- Q = int(input())",
"+ Q = int(eval(input()))",
"- sdeq = collections.deque()",
"- for s in S:",
"- sdeq.append(ord(s) - ord(\"a\"))",
"+ sdeq = collections.deque(list(S))",
"- sdeq.appendleft(ord(c) - ord(\"a\"))",
"+ sdeq.appendleft(c)",
... | false | 0.075607 | 0.006881 | 10.987338 | [
"s721753333",
"s967726885"
] |
u995004106 | p02781 | python | s377123630 | s694812603 | 75 | 63 | 63,164 | 63,000 | Accepted | Accepted | 16 | N=list(eval(input()))
K=int(eval(input()))
N=list(map(int,N))
#print(N)
dp=[[[0 for _ in range(4)] for _ in range(len(N))] for _ in range(2)]
for i in range(len(N)):
num=N[i]
mayover=0
if i==0:
for j in range(10):
if j<num:
if j==0:
dp[0][i... | N=list(eval(input()))
K=int(eval(input()))
N=list(map(int,N))
#print(N)
dp=[[[0 for _ in range(4)] for _ in range(len(N))] for _ in range(2)]
for i in range(len(N)):
num=N[i]
mayover=0
if i==0:
id=0
for j in range(10):
if j==num:
id=1
elif... | 48 | 44 | 1,398 | 1,302 | N = list(eval(input()))
K = int(eval(input()))
N = list(map(int, N))
# print(N)
dp = [[[0 for _ in range(4)] for _ in range(len(N))] for _ in range(2)]
for i in range(len(N)):
num = N[i]
mayover = 0
if i == 0:
for j in range(10):
if j < num:
if j == 0:
... | N = list(eval(input()))
K = int(eval(input()))
N = list(map(int, N))
# print(N)
dp = [[[0 for _ in range(4)] for _ in range(len(N))] for _ in range(2)]
for i in range(len(N)):
num = N[i]
mayover = 0
if i == 0:
id = 0
for j in range(10):
if j == num:
id = 1
... | false | 8.333333 | [
"+ id = 0",
"- if j < num:",
"- if j == 0:",
"- dp[0][i][0] = dp[0][i][0] + 1",
"- else:",
"- dp[0][i][1] = dp[0][i][1] + 1",
"- elif j == num:",
"- if j == 0:",
"- dp[1... | false | 0.036085 | 0.094109 | 0.383441 | [
"s377123630",
"s694812603"
] |
u368796742 | p02845 | python | s575342103 | s237363608 | 117 | 79 | 13,924 | 14,020 | Accepted | Accepted | 32.48 | n = int(eval(input()))
l = list(input().split())
l1 = [int(i) for i in l]
ans = 1
mod = 10**9+7
ch = [0]*3
for i in range(n):
if l1[i] in ch:
ans = ans * ch.count(l1[i]) % mod
k = ch.index(l1[i])
ch[k] += 1
else:
print((0))
exit()
print(ans) | n = int(eval(input()))
l = list(map(int,input().split()))
ans = 1
mod = 10**9+7
ch = [0]*(n+1)
ch[0] = 3
for i in l:
ans = ans * ch[i] % mod
ch[i+1] += 1
ch[i] -= 1
print(ans)
| 18 | 12 | 289 | 189 | n = int(eval(input()))
l = list(input().split())
l1 = [int(i) for i in l]
ans = 1
mod = 10**9 + 7
ch = [0] * 3
for i in range(n):
if l1[i] in ch:
ans = ans * ch.count(l1[i]) % mod
k = ch.index(l1[i])
ch[k] += 1
else:
print((0))
exit()
print(ans)
| n = int(eval(input()))
l = list(map(int, input().split()))
ans = 1
mod = 10**9 + 7
ch = [0] * (n + 1)
ch[0] = 3
for i in l:
ans = ans * ch[i] % mod
ch[i + 1] += 1
ch[i] -= 1
print(ans)
| false | 33.333333 | [
"-l = list(input().split())",
"-l1 = [int(i) for i in l]",
"+l = list(map(int, input().split()))",
"-ch = [0] * 3",
"-for i in range(n):",
"- if l1[i] in ch:",
"- ans = ans * ch.count(l1[i]) % mod",
"- k = ch.index(l1[i])",
"- ch[k] += 1",
"- else:",
"- print((0... | false | 0.067012 | 0.052668 | 1.272362 | [
"s575342103",
"s237363608"
] |
u017415492 | p02660 | python | s242717043 | s285702025 | 247 | 153 | 9,508 | 9,712 | Accepted | Accepted | 38.06 | n=int(eval(input()))
count=0
def make_divisors(n):
lower_divisors , upper_divisors = [], []
i = 1
while i*i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n//i)
i += 1
return lower_divisors + upper_di... | from collections import Counter
n=int(eval(input()))
def soin(n):
soin_ans=[]
while n%2==0:
n//=2
soin_ans.append(2)
f=3
while f<=n**0.5:
if n%f==0:
n//=f
soin_ans.append(f)
else:
f+=2
if n!=1:
soin_ans.append(n)
return soin_ans
s_list=soin(n)
s_set=se... | 41 | 27 | 887 | 464 | n = int(eval(input()))
count = 0
def make_divisors(n):
lower_divisors, upper_divisors = [], []
i = 1
while i * i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n // i)
i += 1
return lower_divisors + upper_divi... | from collections import Counter
n = int(eval(input()))
def soin(n):
soin_ans = []
while n % 2 == 0:
n //= 2
soin_ans.append(2)
f = 3
while f <= n**0.5:
if n % f == 0:
n //= f
soin_ans.append(f)
else:
f += 2
if n != 1:
soi... | false | 34.146341 | [
"+from collections import Counter",
"+",
"-count = 0",
"-def make_divisors(n):",
"- lower_divisors, upper_divisors = [], []",
"- i = 1",
"- while i * i <= n:",
"- if n % i == 0:",
"- lower_divisors.append(i)",
"- if i != n // i:",
"- upper_div... | false | 0.098309 | 0.038473 | 2.555256 | [
"s242717043",
"s285702025"
] |
u677121387 | p02596 | python | s281735529 | s515745783 | 594 | 425 | 77,948 | 16,644 | Accepted | Accepted | 28.45 | k = int(eval(input()))
x = 7
ans = 1
s = set()
while x%k != 0:
ans += 1
x = (x*10%k+7)%k
if x in s:
ans = -1
break
s.add(x)
print(ans) | k = int(eval(input()))
x = 7
ans = 1
flag = [False]*k
while x%k != 0:
ans += 1
x = (x*10%k+7)%k
if flag[x]:
ans = -1
break
flag[x] = True
print(ans) | 12 | 12 | 171 | 185 | k = int(eval(input()))
x = 7
ans = 1
s = set()
while x % k != 0:
ans += 1
x = (x * 10 % k + 7) % k
if x in s:
ans = -1
break
s.add(x)
print(ans)
| k = int(eval(input()))
x = 7
ans = 1
flag = [False] * k
while x % k != 0:
ans += 1
x = (x * 10 % k + 7) % k
if flag[x]:
ans = -1
break
flag[x] = True
print(ans)
| false | 0 | [
"-s = set()",
"+flag = [False] * k",
"- if x in s:",
"+ if flag[x]:",
"- s.add(x)",
"+ flag[x] = True"
] | false | 0.221759 | 0.377642 | 0.587219 | [
"s281735529",
"s515745783"
] |
u437351386 | p03557 | python | s176821022 | s353310371 | 318 | 242 | 22,720 | 29,412 | Accepted | Accepted | 23.9 | n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
import bisect
ans=0
for i in b:
q=bisect.bisect_left(a,i)
s=bisect.bisect_right(c,i)
ans=ans+q*(n-s)
print(ans)
| #この問題のポイント一つ目 3つ動くときは真ん中を固定する
#真ん中を固定したら下の段からはそれより小さいもの、上の段はそれより大きいものを選べる
#上の段と下の段をsortするとある境界を境にokとngがはっきり分かれる
#二部探索
n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
from bisect import bisect_left
from bisect ... | 16 | 22 | 285 | 454 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
import bisect
ans = 0
for i in b:
q = bisect.bisect_left(a, i)
s = bisect.bisect_right(c, i)
ans = ans + q * (n - s)
print(ans)
| # この問題のポイント一つ目 3つ動くときは真ん中を固定する
# 真ん中を固定したら下の段からはそれより小さいもの、上の段はそれより大きいものを選べる
# 上の段と下の段をsortするとある境界を境にokとngがはっきり分かれる
# 二部探索
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
from bisect import bisect_left
from bise... | false | 27.272727 | [
"+# この問題のポイント一つ目 3つ動くときは真ん中を固定する",
"+# 真ん中を固定したら下の段からはそれより小さいもの、上の段はそれより大きいものを選べる",
"+# 上の段と下の段をsortするとある境界を境にokとngがはっきり分かれる",
"+# 二部探索",
"-import bisect",
"+from bisect import bisect_left",
"+from bisect import bisect_right",
"-for i in b:",
"- q = bisect.bisect_left(a, i)",
"- s = bisect.b... | false | 0.041038 | 0.041799 | 0.981787 | [
"s176821022",
"s353310371"
] |
u902151549 | p02987 | python | s545011432 | s926247277 | 52 | 36 | 5,716 | 5,044 | Accepted | Accepted | 30.77 | # coding: utf-8
import time
import re
import math
import fractions
def main():
global N,A,B,C,D,memo,mx,mn,temp
s=eval(input())
f=False
if len(set(list(s)))==2:
num1=0
num2=0
for a in range(4):
if list(set(list(s)))[0]==s[a]:
num1+=1
... | # coding: utf-8
import time
import re
import math
import fractions
def main():
s=eval(input())
if 2==len(set(s)):
print("Yes")
else:
print("No")
start=time.time()
main()
#print("処理速度 {}sec".format(time.time()-start))
#A=list(map(int,input().split()))
#A,B,C=map(int,input()... | 34 | 20 | 683 | 377 | # coding: utf-8
import time
import re
import math
import fractions
def main():
global N, A, B, C, D, memo, mx, mn, temp
s = eval(input())
f = False
if len(set(list(s))) == 2:
num1 = 0
num2 = 0
for a in range(4):
if list(set(list(s)))[0] == s[a]:
num1... | # coding: utf-8
import time
import re
import math
import fractions
def main():
s = eval(input())
if 2 == len(set(s)):
print("Yes")
else:
print("No")
start = time.time()
main()
# print("処理速度 {}sec".format(time.time()-start))
# A=list(map(int,input().split()))
# A,B,C=map(int,input().split... | false | 41.176471 | [
"- global N, A, B, C, D, memo, mx, mn, temp",
"- f = False",
"- if len(set(list(s))) == 2:",
"- num1 = 0",
"- num2 = 0",
"- for a in range(4):",
"- if list(set(list(s)))[0] == s[a]:",
"- num1 += 1",
"- else:",
"- num... | false | 0.006908 | 0.062764 | 0.110062 | [
"s545011432",
"s926247277"
] |
u380524497 | p02750 | python | s128749484 | s070048107 | 1,732 | 1,587 | 63,328 | 58,592 | Accepted | Accepted | 8.37 | def main():
import itertools
import sys
buf = sys.stdin.buffer
n, t = list(map(int, buf.readline().split()))
m = list(map(int, buf.read().split()))
shops = []
shopsA0 = [0]
for a, b in zip(m, m):
if a == 0:
shopsA0.append(b + 1)
else:
... | def main():
import itertools
import sys
buf = sys.stdin.buffer
n, t = list(map(int, buf.readline().split()))
m = list(map(int, buf.read().split()))
shops = []
shopsA0 = [0]
for a, b in zip(m, m):
if a == 0:
shopsA0.append(b + 1)
else:
... | 46 | 46 | 1,045 | 1,058 | def main():
import itertools
import sys
buf = sys.stdin.buffer
n, t = list(map(int, buf.readline().split()))
m = list(map(int, buf.read().split()))
shops = []
shopsA0 = [0]
for a, b in zip(m, m):
if a == 0:
shopsA0.append(b + 1)
else:
shops.append... | def main():
import itertools
import sys
buf = sys.stdin.buffer
n, t = list(map(int, buf.readline().split()))
m = list(map(int, buf.read().split()))
shops = []
shopsA0 = [0]
for a, b in zip(m, m):
if a == 0:
shopsA0.append(b + 1)
else:
shops.append... | false | 0 | [
"- shops.append([a / (b + 1), a, b])",
"+ shops.append([a, b])",
"- shops.sort(reverse=True)",
"+ shops.sort(reverse=True, key=lambda x: x[0] / (x[1] + 1))",
"- for _, a, b in shops:",
"+ for a, b in shops:"
] | false | 0.039736 | 0.032365 | 1.227748 | [
"s128749484",
"s070048107"
] |
u489959379 | p03450 | python | s768938107 | s895817369 | 1,858 | 1,248 | 83,168 | 73,764 | Accepted | Accepted | 32.83 | from collections import deque
N, M = list(map(int, input().split()))
graph = [[] for _ in range(N)]
for _ in range(M):
l, r, d = list(map(int, input().split()))
graph[l - 1].append([r - 1, d])
graph[r - 1].append([l - 1, -d])
X = [None] * N
def bfs(u):
que = deque([(u, 0)])
X[u] = 0
... | from collections import deque
n, m = list(map(int, input().split()))
tree = [[] for _ in range(n)]
for _ in range(m):
L, R, D = list(map(int, input().split()))
tree[L - 1].append((R - 1, D))
tree[R - 1].append((L - 1, -D))
visited = [None for _ in range(n)]
def bfs(u):
q = deque([[u, 0]])... | 31 | 33 | 707 | 803 | from collections import deque
N, M = list(map(int, input().split()))
graph = [[] for _ in range(N)]
for _ in range(M):
l, r, d = list(map(int, input().split()))
graph[l - 1].append([r - 1, d])
graph[r - 1].append([l - 1, -d])
X = [None] * N
def bfs(u):
que = deque([(u, 0)])
X[u] = 0
while que... | from collections import deque
n, m = list(map(int, input().split()))
tree = [[] for _ in range(n)]
for _ in range(m):
L, R, D = list(map(int, input().split()))
tree[L - 1].append((R - 1, D))
tree[R - 1].append((L - 1, -D))
visited = [None for _ in range(n)]
def bfs(u):
q = deque([[u, 0]])
visited... | false | 6.060606 | [
"-N, M = list(map(int, input().split()))",
"-graph = [[] for _ in range(N)]",
"-for _ in range(M):",
"- l, r, d = list(map(int, input().split()))",
"- graph[l - 1].append([r - 1, d])",
"- graph[r - 1].append([l - 1, -d])",
"-X = [None] * N",
"+n, m = list(map(int, input().split()))",
"+tree... | false | 0.043353 | 0.042084 | 1.030166 | [
"s768938107",
"s895817369"
] |
u652081898 | p03645 | python | s760964640 | s618787647 | 740 | 609 | 46,140 | 27,112 | Accepted | Accepted | 17.7 | n, m = list(map(int, input().split()))
ship = {i:[] for i in range(1, n+1)}
for _ in range(m):
a, b = list(map(int, input().split()))
ship[a].append(b)
for i in ship[1]:
if n in ship[i]:
print("POSSIBLE")
exit()
print("IMPOSSIBLE") | n, m = list(map(int, input().split()))
ship = {i:False for i in range(1, n+1)}
bl = []
for _ in range(m):
a, b = list(map(int, input().split()))
if a == 1:
ship[b] = True
elif b == n:
bl.append(a)
for i in bl:
if ship[i] == True:
print("POSSIBLE")
exit()
pr... | 12 | 15 | 260 | 325 | n, m = list(map(int, input().split()))
ship = {i: [] for i in range(1, n + 1)}
for _ in range(m):
a, b = list(map(int, input().split()))
ship[a].append(b)
for i in ship[1]:
if n in ship[i]:
print("POSSIBLE")
exit()
print("IMPOSSIBLE")
| n, m = list(map(int, input().split()))
ship = {i: False for i in range(1, n + 1)}
bl = []
for _ in range(m):
a, b = list(map(int, input().split()))
if a == 1:
ship[b] = True
elif b == n:
bl.append(a)
for i in bl:
if ship[i] == True:
print("POSSIBLE")
exit()
print("IMPOSSI... | false | 20 | [
"-ship = {i: [] for i in range(1, n + 1)}",
"+ship = {i: False for i in range(1, n + 1)}",
"+bl = []",
"- ship[a].append(b)",
"-for i in ship[1]:",
"- if n in ship[i]:",
"+ if a == 1:",
"+ ship[b] = True",
"+ elif b == n:",
"+ bl.append(a)",
"+for i in bl:",
"+ if ... | false | 0.056288 | 0.040675 | 1.383831 | [
"s760964640",
"s618787647"
] |
u241159583 | p03325 | python | s853112219 | s241128715 | 111 | 83 | 4,148 | 4,148 | Accepted | Accepted | 25.23 | N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(N):
if a[i] % 2 == 0:
while a[i] % 2 == 0:
a[i] = a[i] // 2
ans += 1
print(ans) | N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for x in a:
if x % 2 == 0:
cnt = 0
while x % 2 == 0:
x //= 2
cnt += 1
ans += cnt
print(ans) | 9 | 12 | 181 | 190 | N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(N):
if a[i] % 2 == 0:
while a[i] % 2 == 0:
a[i] = a[i] // 2
ans += 1
print(ans)
| N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for x in a:
if x % 2 == 0:
cnt = 0
while x % 2 == 0:
x //= 2
cnt += 1
ans += cnt
print(ans)
| false | 25 | [
"-for i in range(N):",
"- if a[i] % 2 == 0:",
"- while a[i] % 2 == 0:",
"- a[i] = a[i] // 2",
"- ans += 1",
"+for x in a:",
"+ if x % 2 == 0:",
"+ cnt = 0",
"+ while x % 2 == 0:",
"+ x //= 2",
"+ cnt += 1",
"+ ans +=... | false | 0.039276 | 0.118834 | 0.330516 | [
"s853112219",
"s241128715"
] |
u227082700 | p02863 | python | s161384675 | s340691380 | 697 | 541 | 183,384 | 216,520 | Accepted | Accepted | 22.38 | n,t=list(map(int,input().split()))
ab=[list(map(int,input().split()))for _ in range(n)]
ab.sort()
dp=[6007*[0]for _ in range(n)]
for i in range(n):
a,b=ab[i]
for j in range(6007):
if i==0:
if j>=a and j<t:dp[i][j]=b
elif j>=a and j-a<t:dp[i][j]=max(dp[i-1][j-a]+b,dp[i-1][j])
else:dp[i][j... | n,t=list(map(int,input().split()))
ab=[list(map(int,input().split()))for _ in range(n)]
ab.sort()
dp=[(6007)*[0]for _ in range(n+1)]
dp[0][0]=0
ans=0
for i in range(n):
for j in range(6007):
dp[i+1][j]=max(dp[i+1][j],dp[i][j])
if j<t:dp[i+1][j+ab[i][0]]=max(dp[i][j]+ab[i][1],dp[i][j+ab[i][0]])
a... | 12 | 12 | 346 | 349 | n, t = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort()
dp = [6007 * [0] for _ in range(n)]
for i in range(n):
a, b = ab[i]
for j in range(6007):
if i == 0:
if j >= a and j < t:
dp[i][j] = b
elif j >= a and j - a < t:
... | n, t = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort()
dp = [(6007) * [0] for _ in range(n + 1)]
dp[0][0] = 0
ans = 0
for i in range(n):
for j in range(6007):
dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
if j < t:
dp[i + 1][j + ab[i][0]] =... | false | 0 | [
"-dp = [6007 * [0] for _ in range(n)]",
"+dp = [(6007) * [0] for _ in range(n + 1)]",
"+dp[0][0] = 0",
"+ans = 0",
"- a, b = ab[i]",
"- if i == 0:",
"- if j >= a and j < t:",
"- dp[i][j] = b",
"- elif j >= a and j - a < t:",
"- dp[i][j] = max(d... | false | 0.125984 | 0.073264 | 1.7196 | [
"s161384675",
"s340691380"
] |
u617990214 | p02418 | python | s647852799 | s212952664 | 20 | 10 | 6,420 | 6,420 | Accepted | Accepted | 50 | s=input()
target=input()
ring=s*2
f=0
for i in range(len(s)):
if ring[i:i+len(target)]==target:
f=1
break
if f==1:
print("Yes")
else:
print("No") | s=input()
target=input()
ring=s*2
ans="No"
for i in range(len(s)):
if ring[i:i+len(target)]==target:
ans="Yes"
break
print(ans) | 13 | 10 | 171 | 149 | s = input()
target = input()
ring = s * 2
f = 0
for i in range(len(s)):
if ring[i : i + len(target)] == target:
f = 1
break
if f == 1:
print("Yes")
else:
print("No")
| s = input()
target = input()
ring = s * 2
ans = "No"
for i in range(len(s)):
if ring[i : i + len(target)] == target:
ans = "Yes"
break
print(ans)
| false | 23.076923 | [
"-f = 0",
"+ans = \"No\"",
"- f = 1",
"+ ans = \"Yes\"",
"-if f == 1:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+print(ans)"
] | false | 0.133328 | 0.046496 | 2.8675 | [
"s647852799",
"s212952664"
] |
u583507988 | p02627 | python | s176938525 | s722497267 | 31 | 26 | 9,080 | 9,084 | Accepted | Accepted | 16.13 | a = eval(input())
if a.islower() == True:
print('a')
else:
print('A') | a = eval(input())
if a.islower():
print('a')
else:
print('A') | 6 | 6 | 73 | 65 | a = eval(input())
if a.islower() == True:
print("a")
else:
print("A")
| a = eval(input())
if a.islower():
print("a")
else:
print("A")
| false | 0 | [
"-if a.islower() == True:",
"+if a.islower():"
] | false | 0.117938 | 0.173413 | 0.680097 | [
"s176938525",
"s722497267"
] |
u491763171 | p00056 | python | s580541092 | s141714808 | 3,750 | 2,160 | 4,744 | 5,512 | Accepted | Accepted | 42.4 | def sieve(n):
primes = [True] * n
primes[0] = primes[1] = False
for i in range(2, int(n ** 0.5) + 1):
if primes[i]:
for j in range(i * i, n, i):
primes[j] = False
return [i for i in range(n) if primes[i]]
primes_a = sieve(25000)
primes_b = set(sieve(50000))... | def sieve(n):
primes = [True] * n
primes[0] = primes[1] = False
for i in range(2, int(n ** 0.5) + 1):
if primes[i]:
for j in range(i * i, n, i):
primes[j] = False
return [i for i in range(n) if primes[i]]
primes = sieve(50000)
ret = [0] * 100001
for i in r... | 22 | 22 | 540 | 560 | def sieve(n):
primes = [True] * n
primes[0] = primes[1] = False
for i in range(2, int(n**0.5) + 1):
if primes[i]:
for j in range(i * i, n, i):
primes[j] = False
return [i for i in range(n) if primes[i]]
primes_a = sieve(25000)
primes_b = set(sieve(50000))
while 1:
... | def sieve(n):
primes = [True] * n
primes[0] = primes[1] = False
for i in range(2, int(n**0.5) + 1):
if primes[i]:
for j in range(i * i, n, i):
primes[j] = False
return [i for i in range(n) if primes[i]]
primes = sieve(50000)
ret = [0] * 100001
for i in range(len(pri... | false | 0 | [
"-primes_a = sieve(25000)",
"-primes_b = set(sieve(50000))",
"+primes = sieve(50000)",
"+ret = [0] * 100001",
"+for i in range(len(primes)):",
"+ for j in range(i, len(primes)):",
"+ tmp = primes[i] + primes[j]",
"+ if tmp > 50000:",
"+ break",
"+ ret[tmp] += 1",... | false | 0.139128 | 2.499163 | 0.05567 | [
"s580541092",
"s141714808"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.