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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u699089116 | p03212 | python | s021614705 | s622259957 | 91 | 45 | 73,840 | 9,236 | Accepted | Accepted | 50.55 | from itertools import product
n = int(eval(input()))
i = len(str(n))
cnt = 0
for j in range(3, i+1):
for k in product(["3", "5", "7"], repeat=j):
if len(set(k)) != 3:
continue
if int("".join(k)) <= n:
cnt += 1
print(cnt) | N = int(eval(input()))
def dfs(current, judge, count):
if current > N:
return
if judge == 0b111:
count.append(1)
dfs(current * 10 + 7, judge | 0b100, count)
dfs(current * 10 + 5, judge | 0b010, count)
dfs(current * 10 + 3, judge | 0b001, count)
cnt = []
dfs(0, 0, ... | 13 | 17 | 272 | 335 | from itertools import product
n = int(eval(input()))
i = len(str(n))
cnt = 0
for j in range(3, i + 1):
for k in product(["3", "5", "7"], repeat=j):
if len(set(k)) != 3:
continue
if int("".join(k)) <= n:
cnt += 1
print(cnt)
| N = int(eval(input()))
def dfs(current, judge, count):
if current > N:
return
if judge == 0b111:
count.append(1)
dfs(current * 10 + 7, judge | 0b100, count)
dfs(current * 10 + 5, judge | 0b010, count)
dfs(current * 10 + 3, judge | 0b001, count)
cnt = []
dfs(0, 0, cnt)
print((sum(... | false | 23.529412 | [
"-from itertools import product",
"+N = int(eval(input()))",
"-n = int(eval(input()))",
"-i = len(str(n))",
"-cnt = 0",
"-for j in range(3, i + 1):",
"- for k in product([\"3\", \"5\", \"7\"], repeat=j):",
"- if len(set(k)) != 3:",
"- continue",
"- if int(\"\".join(k)) ... | false | 0.043369 | 0.120322 | 0.360443 | [
"s021614705",
"s622259957"
] |
u762420987 | p04034 | python | s723232261 | s202169163 | 598 | 410 | 53,080 | 12,780 | Accepted | Accepted | 31.44 | N, M = list(map(int, input().split()))
boxes = [1] * N
ans = {1}
for i in range(M):
x, y = list(map(int, input().split()))
boxes[x - 1] -= 1
boxes[y - 1] += 1
if x in ans:
if boxes[x - 1] == 0:
ans.remove(x)
ans.add(y)
print((len(ans)))
| def int_(num_str):
return int(num_str) - 1
N, M = list(map(int, input().split()))
balls = [1] * N
red = {0}
for i in range(M):
x, y = list(map(int_, input().split()))
if x in red:
if balls[x] == 1:
red.remove(x)
red.add(y)
else:
red.add(y)
... | 12 | 17 | 278 | 360 | N, M = list(map(int, input().split()))
boxes = [1] * N
ans = {1}
for i in range(M):
x, y = list(map(int, input().split()))
boxes[x - 1] -= 1
boxes[y - 1] += 1
if x in ans:
if boxes[x - 1] == 0:
ans.remove(x)
ans.add(y)
print((len(ans)))
| def int_(num_str):
return int(num_str) - 1
N, M = list(map(int, input().split()))
balls = [1] * N
red = {0}
for i in range(M):
x, y = list(map(int_, input().split()))
if x in red:
if balls[x] == 1:
red.remove(x)
red.add(y)
else:
red.add(y)
balls[x] -... | false | 29.411765 | [
"+def int_(num_str):",
"+ return int(num_str) - 1",
"+",
"+",
"-boxes = [1] * N",
"-ans = {1}",
"+balls = [1] * N",
"+red = {0}",
"- x, y = list(map(int, input().split()))",
"- boxes[x - 1] -= 1",
"- boxes[y - 1] += 1",
"- if x in ans:",
"- if boxes[x - 1] == 0:",
"- ... | false | 0.041217 | 0.035893 | 1.148325 | [
"s723232261",
"s202169163"
] |
u467736898 | p02822 | python | s494005912 | s273071945 | 1,757 | 1,390 | 192,824 | 87,672 | Accepted | Accepted | 20.89 | import sys
sys.setrecursionlimit(505050)
input = sys.stdin.buffer.readline
N = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(N-1)]
mod = 10**9+7
half = mod // 2 + 1
G = [[] for _ in range(N+1)]
for a, b in AB:
G[a].append(b)
G[b].append(a)
P = [0] * (N+1)
Size = [0] * (N+1)... | import os
import sys
import numpy as np
def solve(N, AB):
mod = 10**9+7
half = mod // 2 + 1
G = [[0]*0 for _ in range(N+1)]
for i in range(len(AB)):
a, b = AB[i]
G[a].append(b)
G[b].append(a)
P = [0] * (N+1)
Size = [0] * (N+1)
def dfs(v):
# siz... | 58 | 88 | 1,347 | 2,233 | import sys
sys.setrecursionlimit(505050)
input = sys.stdin.buffer.readline
N = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(N - 1)]
mod = 10**9 + 7
half = mod // 2 + 1
G = [[] for _ in range(N + 1)]
for a, b in AB:
G[a].append(b)
G[b].append(a)
P = [0] * (N + 1)
Size = [0] * (N + 1)
... | import os
import sys
import numpy as np
def solve(N, AB):
mod = 10**9 + 7
half = mod // 2 + 1
G = [[0] * 0 for _ in range(N + 1)]
for i in range(len(AB)):
a, b = AB[i]
G[a].append(b)
G[b].append(a)
P = [0] * (N + 1)
Size = [0] * (N + 1)
def dfs(v):
# siz = ... | false | 34.090909 | [
"+import os",
"-",
"-sys.setrecursionlimit(505050)",
"-input = sys.stdin.buffer.readline",
"-N = int(eval(input()))",
"-AB = [list(map(int, input().split())) for _ in range(N - 1)]",
"-mod = 10**9 + 7",
"-half = mod // 2 + 1",
"-G = [[] for _ in range(N + 1)]",
"-for a, b in AB:",
"- G[a].app... | false | 0.127261 | 0.293171 | 0.434085 | [
"s494005912",
"s273071945"
] |
u245870380 | p03478 | python | s346189666 | s017965987 | 48 | 33 | 2,940 | 2,940 | Accepted | Accepted | 31.25 | N, A, B = list(map(int, input().split()))
ans = 0
for i in range(N+1):
lis = [int(i) for i in str(i)]
if A <= sum(lis) <= B:
num = ""
for j in lis:
num += str(j)
ans += int(num)
print(ans) | N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1,N+1):
if A <= sum([int(x) for x in str(i)]) <= B:
ans += i
print(ans) | 10 | 6 | 235 | 153 | N, A, B = list(map(int, input().split()))
ans = 0
for i in range(N + 1):
lis = [int(i) for i in str(i)]
if A <= sum(lis) <= B:
num = ""
for j in lis:
num += str(j)
ans += int(num)
print(ans)
| N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
if A <= sum([int(x) for x in str(i)]) <= B:
ans += i
print(ans)
| false | 40 | [
"-for i in range(N + 1):",
"- lis = [int(i) for i in str(i)]",
"- if A <= sum(lis) <= B:",
"- num = \"\"",
"- for j in lis:",
"- num += str(j)",
"- ans += int(num)",
"+for i in range(1, N + 1):",
"+ if A <= sum([int(x) for x in str(i)]) <= B:",
"+ an... | false | 0.039022 | 0.115052 | 0.339167 | [
"s346189666",
"s017965987"
] |
u886790158 | p03289 | python | s690534879 | s394374263 | 19 | 17 | 3,188 | 3,064 | Accepted | Accepted | 10.53 | import re
def solve(s):
# 'AC' か 'WA' を返す
# Sの先頭の文字は大文字の A である。
if s[0] != 'A':
return 'WA'
# Sの先頭から3文字目と末尾から
# 2文字目の間(両端含む)に大文字の C
# がちょうど 1 個含まれる。
s_ = s[2:-1]
if len([True for c in s_ if c == 'C']) != 1:
return 'WA'
# 以上の A, C を除くSのすべての文字は小文... |
def solve(s):
# 'AC' か 'WA' を返す
# Sの先頭の文字は大文字の A である。
if s[0] != 'A':
return 'WA'
# Sの先頭から3文字目と末尾から
# 2文字目の間(両端含む)に大文字の C
# がちょうど 1 個含まれる。
if len([True for c in s[2:-1] if c == 'C']) != 1:
return 'WA'
# 以上の A, C を除くSのすべての文字は小文字である。
n_diff = 0
... | 27 | 30 | 475 | 507 | import re
def solve(s):
# 'AC' か 'WA' を返す
# Sの先頭の文字は大文字の A である。
if s[0] != "A":
return "WA"
# Sの先頭から3文字目と末尾から
# 2文字目の間(両端含む)に大文字の C
# がちょうど 1 個含まれる。
s_ = s[2:-1]
if len([True for c in s_ if c == "C"]) != 1:
return "WA"
# 以上の A, C を除くSのすべての文字は小文字である。
n_capital ... | def solve(s):
# 'AC' か 'WA' を返す
# Sの先頭の文字は大文字の A である。
if s[0] != "A":
return "WA"
# Sの先頭から3文字目と末尾から
# 2文字目の間(両端含む)に大文字の C
# がちょうど 1 個含まれる。
if len([True for c in s[2:-1] if c == "C"]) != 1:
return "WA"
# 以上の A, C を除くSのすべての文字は小文字である。
n_diff = 0
for s_ in s:
... | false | 10 | [
"-import re",
"-",
"-",
"- s_ = s[2:-1]",
"- if len([True for c in s_ if c == \"C\"]) != 1:",
"+ if len([True for c in s[2:-1] if c == \"C\"]) != 1:",
"- n_capital = len(re.findall(\"[A-Z]\", s))",
"- if (n_capital - 2) != 0:",
"+ n_diff = 0",
"+ for s_ in s:",
"+ sl_... | false | 0.007689 | 0.039009 | 0.197103 | [
"s690534879",
"s394374263"
] |
u485435834 | p03013 | python | s007323714 | s119119407 | 473 | 231 | 45,016 | 41,692 | Accepted | Accepted | 51.16 | def main():
N, M = list(map(int, input().split()))
a = [0] * (1 + 10 ** 5)
for _ in range(M):
a[int(eval(input()))] = 1
dp = [0] * (N + 1)
dp[0] = 1
if not a[1]:
dp[1] = 1
for i in range(2, N + 1):
if not a[i]:
dp[i] += dp[i-1] + dp[i-2]
... | def main():
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
a = [0] * (1 + 10 ** 5)
for _ in range(M):
a[int(eval(input()))] = 1
dp = [0] * (N + 1)
dp[0] = 1
if not a[1]:
dp[1] = 1
for i in range(2, N + 1):
if not a[i... | 18 | 20 | 366 | 414 | def main():
N, M = list(map(int, input().split()))
a = [0] * (1 + 10**5)
for _ in range(M):
a[int(eval(input()))] = 1
dp = [0] * (N + 1)
dp[0] = 1
if not a[1]:
dp[1] = 1
for i in range(2, N + 1):
if not a[i]:
dp[i] += dp[i - 1] + dp[i - 2]
dp[i... | def main():
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
a = [0] * (1 + 10**5)
for _ in range(M):
a[int(eval(input()))] = 1
dp = [0] * (N + 1)
dp[0] = 1
if not a[1]:
dp[1] = 1
for i in range(2, N + 1):
if not a[i]:
... | false | 10 | [
"+ import sys",
"+",
"+ input = sys.stdin.readline"
] | false | 0.035728 | 0.04266 | 0.837516 | [
"s007323714",
"s119119407"
] |
u440566786 | p02851 | python | s981286669 | s043569643 | 333 | 298 | 105,704 | 104,160 | Accepted | Accepted | 10.51 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from collections import defaultdict,deque
def resolve():
n,k=list(map(int,input().split()))
A=list([int(x)-1 for x in input().split()])
S=[0]*(n+1)
for i in range(n):
S... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from collections import defaultdict
def resolve():
n,k=list(map(int,input().split()))
A=list(map(int,input().split()))
S=[0]*(n+1)
for i in range(n):
S[i+1]=S[i]+A[i]
... | 25 | 26 | 559 | 563 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
from collections import defaultdict, deque
def resolve():
n, k = list(map(int, input().split()))
A = list([int(x) - 1 for x in input().split()])
S = [0] * (n + 1)
for i in ran... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
from collections import defaultdict
def resolve():
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
S = [0] * (n + 1)
for i in range(n):
S[i ... | false | 3.846154 | [
"-from collections import defaultdict, deque",
"+from collections import defaultdict",
"- A = list([int(x) - 1 for x in input().split()])",
"+ A = list(map(int, input().split()))",
"- S[i + 1] %= k",
"- C = defaultdict(int)",
"- Q = deque()",
"+ for i in range(n + 1):",
"+ ... | false | 0.062053 | 0.068241 | 0.909323 | [
"s981286669",
"s043569643"
] |
u242757684 | p02599 | python | s304227692 | s816183615 | 1,854 | 1,683 | 225,584 | 193,472 | Accepted | Accepted | 9.22 | # Fast IO (only use in integer input)
import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
# Fenwick Tree to Calculate Sum
N,Q = list(map(int,input().split()))
MaxLength = 2 ** 19
FenwickTree = []
CurLen = MaxLength
while CurLen != 0:
FenwickTree.append([0] * CurLen)
CurLen... | # Fast IO (only use in integer input)
import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
# Fenwick Tree to Calculate Sum
N,Q = list(map(int,input().split()))
MaxLength = N
FenwickTree = []
CurLen = MaxLength
while CurLen != 0:
FenwickTree.append([0] * CurLen)
CurLen //= 2... | 62 | 63 | 1,596 | 1,635 | # Fast IO (only use in integer input)
import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
# Fenwick Tree to Calculate Sum
N, Q = list(map(int, input().split()))
MaxLength = 2**19
FenwickTree = []
CurLen = MaxLength
while CurLen != 0:
FenwickTree.append([0] * CurLen)
CurLen //= 2
Depth = ... | # Fast IO (only use in integer input)
import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
# Fenwick Tree to Calculate Sum
N, Q = list(map(int, input().split()))
MaxLength = N
FenwickTree = []
CurLen = MaxLength
while CurLen != 0:
FenwickTree.append([0] * CurLen)
CurLen //= 2
Depth = len(... | false | 1.587302 | [
"-MaxLength = 2**19",
"+MaxLength = N",
"- FenwickTree[j][index] += n",
"+ if index < len(FenwickTree[j]):",
"+ FenwickTree[j][index] += n"
] | false | 0.154319 | 0.096547 | 1.598385 | [
"s304227692",
"s816183615"
] |
u604839890 | p02613 | python | s614796941 | s920414848 | 181 | 141 | 82,432 | 16,308 | Accepted | Accepted | 22.1 | n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
print(('AC x', s.count('AC')))
print(('WA x', s.count('WA')))
print(('TLE x', s.count('TLE')))
print(('RE x', s.count('RE'))) | n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
t = ('AC', 'WA', 'TLE', 'RE')
for i in t:
print((i, 'x', s.count(i))) | 6 | 6 | 171 | 126 | n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
print(("AC x", s.count("AC")))
print(("WA x", s.count("WA")))
print(("TLE x", s.count("TLE")))
print(("RE x", s.count("RE")))
| n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
t = ("AC", "WA", "TLE", "RE")
for i in t:
print((i, "x", s.count(i)))
| false | 0 | [
"-print((\"AC x\", s.count(\"AC\")))",
"-print((\"WA x\", s.count(\"WA\")))",
"-print((\"TLE x\", s.count(\"TLE\")))",
"-print((\"RE x\", s.count(\"RE\")))",
"+t = (\"AC\", \"WA\", \"TLE\", \"RE\")",
"+for i in t:",
"+ print((i, \"x\", s.count(i)))"
] | false | 0.069628 | 0.046213 | 1.506678 | [
"s614796941",
"s920414848"
] |
u456595418 | p03062 | python | s377965599 | s517085849 | 108 | 96 | 14,496 | 14,252 | Accepted | Accepted | 11.11 | n = int(eval(input()))
a = list(map(int, input().split()))
new_a = []
sum = 0
minus_count = 0
zero_flag = 0
for i in range(n):
new_a.append(abs(a[i]))
for i in range(n):
if a[i] < 0:
minus_count += 1
if a[i] == 0:
zero_flag = 1
if zero_flag == 1:
for i in range(n):
sum += abs(a[i])
elif ... | n = int(eval(input()))
a = list(map(int, input().split()))
new_a = []
sum = 0
minus_count = 0
for i in range(n):
new_a.append(abs(a[i]))
for i in range(n):
if a[i] < 0:
minus_count += 1
if minus_count % 2 == 0:
for i in range(n):
sum += abs(a[i])
else:
for i in range(n):
sum += new_a[i]
... | 28 | 22 | 466 | 355 | n = int(eval(input()))
a = list(map(int, input().split()))
new_a = []
sum = 0
minus_count = 0
zero_flag = 0
for i in range(n):
new_a.append(abs(a[i]))
for i in range(n):
if a[i] < 0:
minus_count += 1
if a[i] == 0:
zero_flag = 1
if zero_flag == 1:
for i in range(n):
sum += abs(a[i... | n = int(eval(input()))
a = list(map(int, input().split()))
new_a = []
sum = 0
minus_count = 0
for i in range(n):
new_a.append(abs(a[i]))
for i in range(n):
if a[i] < 0:
minus_count += 1
if minus_count % 2 == 0:
for i in range(n):
sum += abs(a[i])
else:
for i in range(n):
sum += n... | false | 21.428571 | [
"-zero_flag = 0",
"- if a[i] == 0:",
"- zero_flag = 1",
"-if zero_flag == 1:",
"- for i in range(n):",
"- sum += abs(a[i])",
"-elif minus_count % 2 == 0:",
"+if minus_count % 2 == 0:"
] | false | 0.046656 | 0.04584 | 1.017793 | [
"s377965599",
"s517085849"
] |
u256464928 | p03112 | python | s283740903 | s001231324 | 1,516 | 1,357 | 16,172 | 16,176 | Accepted | Accepted | 10.49 | import bisect
A, B, Q = list(map(int,input().split()))
S = [int(eval(input())) for _ in range(A)]
T = [int(eval(input())) for _ in range(B)]
X = [int(eval(input())) for _ in range(Q)]
S.insert(0,-float("inf"))
S.append(float("inf"))
T.insert(0,-float("inf"))
T.append(float("inf"))
for i in range(Q):
ans = f... | def main():
import bisect
A, B, Q = list(map(int,input().split()))
S = [int(eval(input())) for _ in range(A)]
T = [int(eval(input())) for _ in range(B)]
X = [int(eval(input())) for _ in range(Q)]
S.insert(0,-float("inf"))
S.append(float("inf"))
T.insert(0,-float("inf"))
T.append(float("inf"))... | 28 | 30 | 1,063 | 1,168 | import bisect
A, B, Q = list(map(int, input().split()))
S = [int(eval(input())) for _ in range(A)]
T = [int(eval(input())) for _ in range(B)]
X = [int(eval(input())) for _ in range(Q)]
S.insert(0, -float("inf"))
S.append(float("inf"))
T.insert(0, -float("inf"))
T.append(float("inf"))
for i in range(Q):
ans = float... | def main():
import bisect
A, B, Q = list(map(int, input().split()))
S = [int(eval(input())) for _ in range(A)]
T = [int(eval(input())) for _ in range(B)]
X = [int(eval(input())) for _ in range(Q)]
S.insert(0, -float("inf"))
S.append(float("inf"))
T.insert(0, -float("inf"))
T.append(... | false | 6.666667 | [
"-import bisect",
"+def main():",
"+ import bisect",
"-A, B, Q = list(map(int, input().split()))",
"-S = [int(eval(input())) for _ in range(A)]",
"-T = [int(eval(input())) for _ in range(B)]",
"-X = [int(eval(input())) for _ in range(Q)]",
"-S.insert(0, -float(\"inf\"))",
"-S.append(float(\"inf\"... | false | 0.03825 | 0.040133 | 0.953083 | [
"s283740903",
"s001231324"
] |
u050428930 | p03309 | python | s810135451 | s963364840 | 821 | 221 | 34,224 | 26,128 | Accepted | Accepted | 73.08 | import numpy as np
ans=0
N=int(eval(input()))
s1,s_1,s0=[],[],[]
s=list(map(int,input().split()))
s_=np.array(s)-np.array(list(range(N)))
for i in s_:
if i<0:
s_1.append(i)
elif i==0:
s0.append(i)
else:
s1.append(i)
if len(s1)==len(s_1) or (max(len(s1),len(s_1))<=min(len... | N=int(eval(input()))
s=list(map(int,input().split()))
for i in range(N):
s[i]-=i
s.sort()
print((sum(list([abs(x-s[N//2]) for x in s])))) | 29 | 6 | 595 | 142 | import numpy as np
ans = 0
N = int(eval(input()))
s1, s_1, s0 = [], [], []
s = list(map(int, input().split()))
s_ = np.array(s) - np.array(list(range(N)))
for i in s_:
if i < 0:
s_1.append(i)
elif i == 0:
s0.append(i)
else:
s1.append(i)
if len(s1) == len(s_1) or (max(len(s1), len(s_... | N = int(eval(input()))
s = list(map(int, input().split()))
for i in range(N):
s[i] -= i
s.sort()
print((sum(list([abs(x - s[N // 2]) for x in s]))))
| false | 79.310345 | [
"-import numpy as np",
"-",
"-ans = 0",
"-s1, s_1, s0 = [], [], []",
"-s_ = np.array(s) - np.array(list(range(N)))",
"-for i in s_:",
"- if i < 0:",
"- s_1.append(i)",
"- elif i == 0:",
"- s0.append(i)",
"- else:",
"- s1.append(i)",
"-if len(s1) == len(s_1) or (... | false | 0.36217 | 0.054563 | 6.637707 | [
"s810135451",
"s963364840"
] |
u796942881 | p03557 | python | s659710261 | s935557055 | 316 | 279 | 22,720 | 24,052 | Accepted | Accepted | 11.71 | def main():
from bisect import bisect_left
from bisect import bisect_right
N = int(eval(input()))
An = sorted(map(int, input().split()))
Bn = sorted(map(int, input().split()))
Cn = sorted(map(int, input().split()))
ans = 0
lx = 0
ux = 0
for Bi in Bn:
# ... | N = int(eval(input()))
An = sorted(map(int, input().split()))
Bn = sorted(map(int, input().split()))
Cn = sorted(map(int, input().split()))
def f(xn, yn, zn):
tn = [0] * N
num = 0
j = N - 1
for i in range(N - 1, -1, - 1):
while 0 <= j and xn[i] < yn[j]:
num += zn[j]... | 28 | 32 | 493 | 504 | def main():
from bisect import bisect_left
from bisect import bisect_right
N = int(eval(input()))
An = sorted(map(int, input().split()))
Bn = sorted(map(int, input().split()))
Cn = sorted(map(int, input().split()))
ans = 0
lx = 0
ux = 0
for Bi in Bn:
# 以上
lx = bi... | N = int(eval(input()))
An = sorted(map(int, input().split()))
Bn = sorted(map(int, input().split()))
Cn = sorted(map(int, input().split()))
def f(xn, yn, zn):
tn = [0] * N
num = 0
j = N - 1
for i in range(N - 1, -1, -1):
while 0 <= j and xn[i] < yn[j]:
num += zn[j]
j -=... | false | 12.5 | [
"+N = int(eval(input()))",
"+An = sorted(map(int, input().split()))",
"+Bn = sorted(map(int, input().split()))",
"+Cn = sorted(map(int, input().split()))",
"+",
"+",
"+def f(xn, yn, zn):",
"+ tn = [0] * N",
"+ num = 0",
"+ j = N - 1",
"+ for i in range(N - 1, -1, -1):",
"+ w... | false | 0.040302 | 0.039593 | 1.017892 | [
"s659710261",
"s935557055"
] |
u652656291 | p02777 | python | s267888517 | s409398570 | 25 | 17 | 2,940 | 2,940 | Accepted | Accepted | 32 | S,T = input().split()
A,B = list(map(int, input().split()))
U = eval(input())
if S==U:
A -= 1
else:
B -= 1
print((A,B))
| a,b = input().split()
x,y = list(map(int,input().split()))
k = eval(input())
if a == k:
print((x-1,y))
else:
print((x,y-1))
| 9 | 8 | 123 | 120 | S, T = input().split()
A, B = list(map(int, input().split()))
U = eval(input())
if S == U:
A -= 1
else:
B -= 1
print((A, B))
| a, b = input().split()
x, y = list(map(int, input().split()))
k = eval(input())
if a == k:
print((x - 1, y))
else:
print((x, y - 1))
| false | 11.111111 | [
"-S, T = input().split()",
"-A, B = list(map(int, input().split()))",
"-U = eval(input())",
"-if S == U:",
"- A -= 1",
"+a, b = input().split()",
"+x, y = list(map(int, input().split()))",
"+k = eval(input())",
"+if a == k:",
"+ print((x - 1, y))",
"- B -= 1",
"-print((A, B))",
"+ ... | false | 0.044605 | 0.102742 | 0.434141 | [
"s267888517",
"s409398570"
] |
u600402037 | p03030 | python | s323599075 | s863840647 | 21 | 18 | 3,316 | 3,060 | Accepted | Accepted | 14.29 | from collections import defaultdict
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n = int(eval(input()))
SP = [[x for x in input().split()] for _ in range(n)]
ans_list = defaultdict(list)
for i, sp in enumerate(SP):
ans_list[sp[1]] = i
li = sorted(SP, key=lambda x: -int(x[1]))
l... | N = int(eval(input()))
SP = []
for i in range(N):
s, p = list(input().split())
SP.append([s, int(p), i+1])
SP.sort(key=lambda SP:(SP[0], -SP[1]))
for x in SP:
print((x[2])) | 18 | 8 | 424 | 177 | from collections import defaultdict
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n = int(eval(input()))
SP = [[x for x in input().split()] for _ in range(n)]
ans_list = defaultdict(list)
for i, sp in enumerate(SP):
ans_list[sp[1]] = i
li = sorted(SP, key=lambda x: -int(x[1]))
li = sorted(li, ... | N = int(eval(input()))
SP = []
for i in range(N):
s, p = list(input().split())
SP.append([s, int(p), i + 1])
SP.sort(key=lambda SP: (SP[0], -SP[1]))
for x in SP:
print((x[2]))
| false | 55.555556 | [
"-from collections import defaultdict",
"-import sys",
"-",
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**7)",
"-n = int(eval(input()))",
"-SP = [[x for x in input().split()] for _ in range(n)]",
"-ans_list = defaultdict(list)",
"-for i, sp in enumerate(SP):",
"- ans_list[sp[1]] = ... | false | 0.036395 | 0.036732 | 0.990835 | [
"s323599075",
"s863840647"
] |
u307622233 | p02642 | python | s244603808 | s092903821 | 1,611 | 1,409 | 51,288 | 51,472 | Accepted | Accepted | 12.54 | import numpy as np
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = np.array([int(i) for i in input().split()])
max_dp = np.max(A) + 1
dp = np.zeros(max_dp, dtype="int32")
for a in A:
if dp[a] >= 2:
continue
fancy = np.arange... | import numpy as np
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = [int(i) for i in input().split()]
max_dp = max(A) + 1
dp = np.zeros(max_dp, dtype="int32")
for a in A:
if dp[a] >= 2:
continue
dp[np.arange(a, max_dp, a)] ... | 23 | 24 | 445 | 412 | import numpy as np
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = np.array([int(i) for i in input().split()])
max_dp = np.max(A) + 1
dp = np.zeros(max_dp, dtype="int32")
for a in A:
if dp[a] >= 2:
continue
fancy = np.arange(a, max_dp, a)
... | import numpy as np
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
A = [int(i) for i in input().split()]
max_dp = max(A) + 1
dp = np.zeros(max_dp, dtype="int32")
for a in A:
if dp[a] >= 2:
continue
dp[np.arange(a, max_dp, a)] += 2
dp[a]... | false | 4.166667 | [
"- A = np.array([int(i) for i in input().split()])",
"- max_dp = np.max(A) + 1",
"+ A = [int(i) for i in input().split()]",
"+ max_dp = max(A) + 1",
"- fancy = np.arange(a, max_dp, a)",
"- dp[fancy] += 2",
"+ dp[np.arange(a, max_dp, a)] += 2"
] | false | 0.225467 | 0.633942 | 0.355658 | [
"s244603808",
"s092903821"
] |
u731235119 | p00856 | python | s574967882 | s136232465 | 250 | 230 | 4,508 | 4,508 | Accepted | Accepted | 8 | while 1:
N, T, L, B = list(map(int,input().split(" ")))
if N == T == L == B == 0: break
check = 0
dp = [[0 for _ in range(N+1)] for _ in range(T+1)]
Lose = set([int(input()) for _ in range(L)])
Back = set([int(input()) for _ in range(B)])
dp[0][0] = 1
for i in range(T):
for j in range(N):
rank = ... | while 1:
N, T, L, B = list(map(int,input().split(" ")))
if N == T == L == B == 0: break
dp = [[0 for _ in range(N+1)] for _ in range(T+1)]
Lose = set([int(input()) for _ in range(L)])
Back = set([int(input()) for _ in range(B)])
dp[0][0] = 1
for i in range(T):
for j in range(N):
rank = i-1 if j in ... | 21 | 20 | 607 | 595 | while 1:
N, T, L, B = list(map(int, input().split(" ")))
if N == T == L == B == 0:
break
check = 0
dp = [[0 for _ in range(N + 1)] for _ in range(T + 1)]
Lose = set([int(input()) for _ in range(L)])
Back = set([int(input()) for _ in range(B)])
dp[0][0] = 1
for i in range(T):
... | while 1:
N, T, L, B = list(map(int, input().split(" ")))
if N == T == L == B == 0:
break
dp = [[0 for _ in range(N + 1)] for _ in range(T + 1)]
Lose = set([int(input()) for _ in range(L)])
Back = set([int(input()) for _ in range(B)])
dp[0][0] = 1
for i in range(T):
for j in r... | false | 4.761905 | [
"- check = 0"
] | false | 0.036945 | 0.038047 | 0.971056 | [
"s574967882",
"s136232465"
] |
u642874916 | p03013 | python | s740915302 | s777929682 | 595 | 244 | 474,616 | 43,228 | Accepted | Accepted | 58.99 | import sys
input = sys.stdin.readline
MOD = 10 ** 9 + 7
MIN = 100
def main():
N, M = list(map(int, input().split()))
memo = [0] * max((N + 1), MIN)
a = [0] * M
memo[0] = 1
memo[1] = 1
memo[2] = 2
for i in range(3, max(N+1, MIN)):
memo[i] = memo[i-1] + memo[i-2]
... | import sys
input = sys.stdin.readline
MOD = 10 ** 9 + 7
MIN = 100
def org(N, M, dp):
a = [0] * M
dp[0] = 1
dp[1] = 1
dp[2] = 2
for i in range(3, max(N+1, MIN)):
dp[i] = dp[i-1] + dp[i-2]
ans = 1
for i in range(M):
a[i] = int(eval(input()))
... | 52 | 84 | 1,068 | 1,601 | import sys
input = sys.stdin.readline
MOD = 10**9 + 7
MIN = 100
def main():
N, M = list(map(int, input().split()))
memo = [0] * max((N + 1), MIN)
a = [0] * M
memo[0] = 1
memo[1] = 1
memo[2] = 2
for i in range(3, max(N + 1, MIN)):
memo[i] = memo[i - 1] + memo[i - 2]
ans = 1
... | import sys
input = sys.stdin.readline
MOD = 10**9 + 7
MIN = 100
def org(N, M, dp):
a = [0] * M
dp[0] = 1
dp[1] = 1
dp[2] = 2
for i in range(3, max(N + 1, MIN)):
dp[i] = dp[i - 1] + dp[i - 2]
ans = 1
for i in range(M):
a[i] = int(eval(input()))
if i != 0 and abs(a[i... | false | 38.095238 | [
"-def main():",
"- N, M = list(map(int, input().split()))",
"- memo = [0] * max((N + 1), MIN)",
"+def org(N, M, dp):",
"- memo[0] = 1",
"- memo[1] = 1",
"- memo[2] = 2",
"+ dp[0] = 1",
"+ dp[1] = 1",
"+ dp[2] = 2",
"- memo[i] = memo[i - 1] + memo[i - 2]",
"+ ... | false | 0.036049 | 0.034315 | 1.050514 | [
"s740915302",
"s777929682"
] |
u636683284 | p02918 | python | s617128150 | s375735290 | 83 | 68 | 77,352 | 69,608 | Accepted | Accepted | 18.07 | n,k = list(map(int,input().split()))
s = list(eval(input()))
first = s[0]
second = 'R' if first=='L' else 'L'
i = 0
while k > 0 and i < n:
if s[i] ==second:
while i < n and s[i] == second:
s[i] = first
i += 1
k -= 1
else:
i += 1
# print(s)
a... | n,k = list(map(int,input().split()))
s = list(eval(input()))
a = 0
for i in range(n-1):
if s[i] != s[i+1]:
a += 1
print((n-1-max(a-2*k,0))) | 31 | 8 | 547 | 145 | n, k = list(map(int, input().split()))
s = list(eval(input()))
first = s[0]
second = "R" if first == "L" else "L"
i = 0
while k > 0 and i < n:
if s[i] == second:
while i < n and s[i] == second:
s[i] = first
i += 1
k -= 1
else:
i += 1
# print(s)
ans = 0
def happy... | n, k = list(map(int, input().split()))
s = list(eval(input()))
a = 0
for i in range(n - 1):
if s[i] != s[i + 1]:
a += 1
print((n - 1 - max(a - 2 * k, 0)))
| false | 74.193548 | [
"-first = s[0]",
"-second = \"R\" if first == \"L\" else \"L\"",
"-i = 0",
"-while k > 0 and i < n:",
"- if s[i] == second:",
"- while i < n and s[i] == second:",
"- s[i] = first",
"- i += 1",
"- k -= 1",
"- else:",
"- i += 1",
"-# print(s)",
... | false | 0.073079 | 0.036325 | 2.011843 | [
"s617128150",
"s375735290"
] |
u104282757 | p02888 | python | s022860016 | s626665540 | 1,592 | 888 | 82,280 | 3,316 | Accepted | Accepted | 44.22 | from heapq import heappush, heappop
def solve_d(n, l_list):
res = 0
l_list_s = sorted(l_list)
h = []
for i in range(1, n - 1):
for j in range(0, i):
heappush(h, l_list_s[i] + l_list_s[j])
while len(h) > 0:
a = heappop(h)
if a > l_list_s[i... | from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
def solve_d(n, l_list):
res = 0
l_list_s = sorted(l_list)
for i in range(1, n - 1):
b = l_list_s[i]
for j in range(0, i):
a = l_list_s[j]
res += bisect_left(l_list_s, a + b) ... | 36 | 49 | 777 | 1,090 | from heapq import heappush, heappop
def solve_d(n, l_list):
res = 0
l_list_s = sorted(l_list)
h = []
for i in range(1, n - 1):
for j in range(0, i):
heappush(h, l_list_s[i] + l_list_s[j])
while len(h) > 0:
a = heappop(h)
if a > l_list_s[i + 1]:
... | from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
def solve_d(n, l_list):
res = 0
l_list_s = sorted(l_list)
for i in range(1, n - 1):
b = l_list_s[i]
for j in range(0, i):
a = l_list_s[j]
res += bisect_left(l_list_s, a + b) - (i + 1)
... | false | 26.530612 | [
"+from bisect import bisect_left, bisect_right",
"+ res = 0",
"+ l_list_s = sorted(l_list)",
"+ for i in range(1, n - 1):",
"+ b = l_list_s[i]",
"+ for j in range(0, i):",
"+ a = l_list_s[j]",
"+ res += bisect_left(l_list_s, a + b) - (i + 1)",
"+ retur... | false | 0.113697 | 0.094087 | 1.208433 | [
"s022860016",
"s626665540"
] |
u845573105 | p02596 | python | s998803541 | s546348756 | 210 | 189 | 9,164 | 9,052 | Accepted | Accepted | 10 | K = int(eval(input()))
a = 7
flag = False
for i in range(1,K+1):
b = a%K
if b==0:
flag = True
break
a = b*10 + 7
if flag:
print(i)
else:
print((-1)) | # 解答
K = int(eval(input()))
A = 7 % K
flag = False
for i in range(1, K+1):
if A == 0:
flag = True
break
A = (A*10 + 7) % K
if flag:
print(i)
else:
print((-1)) | 15 | 15 | 174 | 183 | K = int(eval(input()))
a = 7
flag = False
for i in range(1, K + 1):
b = a % K
if b == 0:
flag = True
break
a = b * 10 + 7
if flag:
print(i)
else:
print((-1))
| # 解答
K = int(eval(input()))
A = 7 % K
flag = False
for i in range(1, K + 1):
if A == 0:
flag = True
break
A = (A * 10 + 7) % K
if flag:
print(i)
else:
print((-1))
| false | 0 | [
"+# 解答",
"-a = 7",
"+A = 7 % K",
"- b = a % K",
"- if b == 0:",
"+ if A == 0:",
"- a = b * 10 + 7",
"+ A = (A * 10 + 7) % K"
] | false | 0.108614 | 0.098247 | 1.105526 | [
"s998803541",
"s546348756"
] |
u746419473 | p03609 | python | s374413513 | s480596269 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | x,t=list(map(int,input().split()))
print(("0" if x-t<0 else x-t))
| x, t = list(map(int, input().split()))
print((0 if x <= t else x - t))
| 2 | 2 | 59 | 64 | x, t = list(map(int, input().split()))
print(("0" if x - t < 0 else x - t))
| x, t = list(map(int, input().split()))
print((0 if x <= t else x - t))
| false | 0 | [
"-print((\"0\" if x - t < 0 else x - t))",
"+print((0 if x <= t else x - t))"
] | false | 0.054689 | 0.062344 | 0.877204 | [
"s374413513",
"s480596269"
] |
u644907318 | p03834 | python | s843661593 | s885372632 | 167 | 62 | 38,256 | 61,676 | Accepted | Accepted | 62.87 | S = input().strip()
x = S[:5]+" "+S[6:13]+" "+S[14:]
print(x) | S = list(input().split(","))
print((*S)) | 3 | 2 | 63 | 39 | S = input().strip()
x = S[:5] + " " + S[6:13] + " " + S[14:]
print(x)
| S = list(input().split(","))
print((*S))
| false | 33.333333 | [
"-S = input().strip()",
"-x = S[:5] + \" \" + S[6:13] + \" \" + S[14:]",
"-print(x)",
"+S = list(input().split(\",\"))",
"+print((*S))"
] | false | 0.041857 | 0.044435 | 0.942001 | [
"s843661593",
"s885372632"
] |
u127499732 | p03575 | python | s545423549 | s110882415 | 447 | 17 | 3,552 | 3,064 | Accepted | Accepted | 96.2 | import copy
def main():
# n: 頂点数
# w: 辺の数
n, w = list(map(int, input().split()))
# v -> v ; cost: 0
d = [[False] * n for i in range(n)]
# d[u][v] : 辺u-vのコスト(if not: inf)
e = []
for i in range(w):
# edge: u -> v ; cost : z
u, v = [int(x) - 1 for x in input... | def main():
n, m, *ab = list(map(int, open(0).read().split()))
e = [[] for _ in range(n)]
for u, v in zip(*[iter(ab)] * 2):
e[u - 1].append(v - 1)
e[v - 1].append(u - 1)
ans = 0
for _ in range(m):
count = 0
for i, x in enumerate(e):
if len(x) =... | 44 | 25 | 1,013 | 550 | import copy
def main():
# n: 頂点数
# w: 辺の数
n, w = list(map(int, input().split()))
# v -> v ; cost: 0
d = [[False] * n for i in range(n)]
# d[u][v] : 辺u-vのコスト(if not: inf)
e = []
for i in range(w):
# edge: u -> v ; cost : z
u, v = [int(x) - 1 for x in input().split()]
... | def main():
n, m, *ab = list(map(int, open(0).read().split()))
e = [[] for _ in range(n)]
for u, v in zip(*[iter(ab)] * 2):
e[u - 1].append(v - 1)
e[v - 1].append(u - 1)
ans = 0
for _ in range(m):
count = 0
for i, x in enumerate(e):
if len(x) == 1:
... | false | 43.181818 | [
"-import copy",
"-",
"-",
"- # n: 頂点数",
"- # w: 辺の数",
"- n, w = list(map(int, input().split()))",
"- # v -> v ; cost: 0",
"- d = [[False] * n for i in range(n)]",
"- # d[u][v] : 辺u-vのコスト(if not: inf)",
"- e = []",
"- for i in range(w):",
"- # edge: u -> v ; cost ... | false | 0.14326 | 0.035453 | 4.04088 | [
"s545423549",
"s110882415"
] |
u813098295 | p03634 | python | s674658689 | s122762980 | 1,596 | 868 | 53,076 | 49,496 | Accepted | Accepted | 45.61 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import queue
N = int(input())
tree = [[] for _ in range(N)]
for i in range(N-1):
a, b, c = list(map(int, input().split()))
a -= 1; b -= 1;
tree[a].append((b, c))
tree[b].append((a, c))
Q, K = list(map(int, input().split()))
K -= 1
d = ... | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
N = int(input())
tree = [[] for _ in range(N)]
for i in range(N-1):
a, b, c = list(map(int, input().split()))
a -= 1; b -= 1;
tree[a].append((b, c))
tree[b].append((a, c))
Q, K = list(map(int, input().split()))
K -= 1
depth = [0 for _ in ... | 40 | 35 | 814 | 755 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import queue
N = int(input())
tree = [[] for _ in range(N)]
for i in range(N - 1):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
tree[a].append((b, c))
tree[b].append((a, c))
Q, K = list(map(int, input().split()))
K -= 1
d = [float("inf") for... | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
N = int(input())
tree = [[] for _ in range(N)]
for i in range(N - 1):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
tree[a].append((b, c))
tree[b].append((a, c))
Q, K = list(map(int, input().split()))
K -= 1
depth = [0 for _ in range(N)]
def... | false | 12.5 | [
"-import queue",
"-",
"-d = [float(\"inf\") for _ in range(N)]",
"+depth = [0 for _ in range(N)]",
"-def dijkstra(s):",
"- que = queue.PriorityQueue()",
"- d[s] = 0",
"- que.put([0, s])",
"- while not que.empty():",
"- p = que.get()",
"- v = p[1]",
"- if d[v] <... | false | 0.043595 | 0.06288 | 0.693304 | [
"s674658689",
"s122762980"
] |
u241159583 | p02773 | python | s554784688 | s414115265 | 774 | 495 | 45,084 | 47,940 | Accepted | Accepted | 36.05 | N = int(eval(input()))
S = list(eval(input()) for _ in range(N))
import collections
a = collections.Counter(S).most_common()
ans = []
for i in range(len(a)):
if i == 0:
ans.append(a[i][0])
elif a[i - 1][1] == a[i][1]:
ans.append(a[i][0])
else:
break
ans.sort()
for j in ans:
print(j... | from collections import Counter
n = int(eval(input()))
s = Counter([eval(input()) for _ in range(n)])
before = 0
ans = []
s = s.most_common()
for i in range(len(s)):
if before == 0: before = s[i][1]
elif before != s[i][1]: break
ans.append(s[i][0])
for i in sorted(ans): print(i) | 17 | 11 | 309 | 289 | N = int(eval(input()))
S = list(eval(input()) for _ in range(N))
import collections
a = collections.Counter(S).most_common()
ans = []
for i in range(len(a)):
if i == 0:
ans.append(a[i][0])
elif a[i - 1][1] == a[i][1]:
ans.append(a[i][0])
else:
break
ans.sort()
for j in ans:
prin... | from collections import Counter
n = int(eval(input()))
s = Counter([eval(input()) for _ in range(n)])
before = 0
ans = []
s = s.most_common()
for i in range(len(s)):
if before == 0:
before = s[i][1]
elif before != s[i][1]:
break
ans.append(s[i][0])
for i in sorted(ans):
print(i)
| false | 35.294118 | [
"-N = int(eval(input()))",
"-S = list(eval(input()) for _ in range(N))",
"-import collections",
"+from collections import Counter",
"-a = collections.Counter(S).most_common()",
"+n = int(eval(input()))",
"+s = Counter([eval(input()) for _ in range(n)])",
"+before = 0",
"-for i in range(len(a)):",
... | false | 0.042308 | 0.042828 | 0.987877 | [
"s554784688",
"s414115265"
] |
u906501980 | p03328 | python | s213655175 | s842117324 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a, b = list(map(int, input().split()))
out = 0
for i in range(b-a):
out += i+1
print((out-b)) | a, b = list(map(int, input().split()))
num = b - a
print((((1+num)*num)//2 - b)) | 5 | 3 | 93 | 74 | a, b = list(map(int, input().split()))
out = 0
for i in range(b - a):
out += i + 1
print((out - b))
| a, b = list(map(int, input().split()))
num = b - a
print((((1 + num) * num) // 2 - b))
| false | 40 | [
"-out = 0",
"-for i in range(b - a):",
"- out += i + 1",
"-print((out - b))",
"+num = b - a",
"+print((((1 + num) * num) // 2 - b))"
] | false | 0.05245 | 0.04717 | 1.111941 | [
"s213655175",
"s842117324"
] |
u401452016 | p02954 | python | s084171026 | s164228190 | 256 | 156 | 6,312 | 9,712 | Accepted | Accepted | 39.06 | s = eval(input())
s += 'R'
n = len(s)
ans = [0 for i in range(n-1)]
def move(block):
blen = len(block)
lidx = block.find('L')
if lidx ==-1:
return
ans[restart+lidx] = blen//2
ans[restart+lidx-1] = blen//2
if blen %2 ==1:
if lidx %2 ==0:
ans[restart+li... | import sys
import re
S = sys.stdin.readline()
ptn = 'R+L+'
ptn = re.compile(ptn)
result = ptn.findall(S)
#print(result)
ans = []
for bl in result:
len_bl_half = len(bl)//2
tmp = [0 for _ in range(len(bl))]
ln = bl.find('L')
#print(ln)
if len(bl)%2==0:
tmp[ln] = len_bl_half
... | 31 | 27 | 559 | 590 | s = eval(input())
s += "R"
n = len(s)
ans = [0 for i in range(n - 1)]
def move(block):
blen = len(block)
lidx = block.find("L")
if lidx == -1:
return
ans[restart + lidx] = blen // 2
ans[restart + lidx - 1] = blen // 2
if blen % 2 == 1:
if lidx % 2 == 0:
ans[restart ... | import sys
import re
S = sys.stdin.readline()
ptn = "R+L+"
ptn = re.compile(ptn)
result = ptn.findall(S)
# print(result)
ans = []
for bl in result:
len_bl_half = len(bl) // 2
tmp = [0 for _ in range(len(bl))]
ln = bl.find("L")
# print(ln)
if len(bl) % 2 == 0:
tmp[ln] = len_bl_half
t... | false | 12.903226 | [
"-s = eval(input())",
"-s += \"R\"",
"-n = len(s)",
"-ans = [0 for i in range(n - 1)]",
"+import sys",
"+import re",
"-",
"-def move(block):",
"- blen = len(block)",
"- lidx = block.find(\"L\")",
"- if lidx == -1:",
"- return",
"- ans[restart + lidx] = blen // 2",
"- ... | false | 0.048122 | 0.054118 | 0.889206 | [
"s084171026",
"s164228190"
] |
u089230684 | p02628 | python | s060055268 | s709204904 | 30 | 27 | 9,092 | 9,172 | Accepted | Accepted | 10 | def main():
entrada = list(map(int, input().split()))
frutas = list(map(int, input().split()))
frutas.sort()
suma = 0
for i in range(entrada[1]):
suma = suma + frutas[i]
print(suma)
if __name__ == "__main__":
main()
| N, K = input().split(" ")
price = input().split(" ")
list1 = []
for j in price:
list1.append(int(j))
list1 = list1[:int(N)]
list1.sort()
list2 = list1[:int(K)]
summ = 0
for i in list2[:int(K)]:
summ += int(i)
print(summ)
| 13 | 18 | 267 | 252 | def main():
entrada = list(map(int, input().split()))
frutas = list(map(int, input().split()))
frutas.sort()
suma = 0
for i in range(entrada[1]):
suma = suma + frutas[i]
print(suma)
if __name__ == "__main__":
main()
| N, K = input().split(" ")
price = input().split(" ")
list1 = []
for j in price:
list1.append(int(j))
list1 = list1[: int(N)]
list1.sort()
list2 = list1[: int(K)]
summ = 0
for i in list2[: int(K)]:
summ += int(i)
print(summ)
| false | 27.777778 | [
"-def main():",
"- entrada = list(map(int, input().split()))",
"- frutas = list(map(int, input().split()))",
"- frutas.sort()",
"- suma = 0",
"- for i in range(entrada[1]):",
"- suma = suma + frutas[i]",
"- print(suma)",
"-",
"-",
"-if __name__ == \"__main__\":",
"- ... | false | 0.034446 | 0.037523 | 0.91798 | [
"s060055268",
"s709204904"
] |
u392220578 | p04046 | python | s274885893 | s573743574 | 834 | 494 | 71,260 | 58,992 | Accepted | Accepted | 40.77 | C = int(1e9) + 7
h, w, a, b = [int(x) for x in input().split()]
# 1000000005 = 2^29 + 2^28 + 2^27 + 2^25 + 2^24 + 2^23 + 2^20 + 2^19 + 2^17 + 2^15 + 2^14 + 2^11 + 2^9 + 2^2 + 1
def pow(n):
ans = n
for i in range(1, 30):
n = (n * n) % C
if i in {29, 28, 27, 25, 24, 23, 20, 19, 17, 15, ... | C = int(1e9) + 7
h, w, a, b = [int(x) for x in input().split()]
fact = [1]
for x in range(1, h + w - 2):
fact.append((x * fact[x - 1]) % C)
factinv = [1] * (h + w - 2)
factinv[h + w - 3] = pow(fact[h + w - 3], C - 2, C)
for x in reversed(list(range(2, h + w - 3))):
factinv[x] = (factinv[x + 1] * (x ... | 28 | 20 | 807 | 531 | C = int(1e9) + 7
h, w, a, b = [int(x) for x in input().split()]
# 1000000005 = 2^29 + 2^28 + 2^27 + 2^25 + 2^24 + 2^23 + 2^20 + 2^19 + 2^17 + 2^15 + 2^14 + 2^11 + 2^9 + 2^2 + 1
def pow(n):
ans = n
for i in range(1, 30):
n = (n * n) % C
if i in {29, 28, 27, 25, 24, 23, 20, 19, 17, 15, 14, 11, 9, ... | C = int(1e9) + 7
h, w, a, b = [int(x) for x in input().split()]
fact = [1]
for x in range(1, h + w - 2):
fact.append((x * fact[x - 1]) % C)
factinv = [1] * (h + w - 2)
factinv[h + w - 3] = pow(fact[h + w - 3], C - 2, C)
for x in reversed(list(range(2, h + w - 3))):
factinv[x] = (factinv[x + 1] * (x + 1)) % C
... | false | 28.571429 | [
"-# 1000000005 = 2^29 + 2^28 + 2^27 + 2^25 + 2^24 + 2^23 + 2^20 + 2^19 + 2^17 + 2^15 + 2^14 + 2^11 + 2^9 + 2^2 + 1",
"-def pow(n):",
"- ans = n",
"- for i in range(1, 30):",
"- n = (n * n) % C",
"- if i in {29, 28, 27, 25, 24, 23, 20, 19, 17, 15, 14, 11, 9, 2}:",
"- ans = ... | false | 0.039652 | 0.041354 | 0.958829 | [
"s274885893",
"s573743574"
] |
u030090262 | p03503 | python | s158339248 | s160980903 | 297 | 76 | 3,064 | 3,064 | Accepted | Accepted | 74.41 | #from collections import Counter
N=int(eval(input()))
F=list(list(map(int,input().split())) for i in range(N))
P=list(list(map(int,input().split())) for i in range(N))
ans=-(1<<40)
for bit in range(1,1<<10):
tmp = 0
for i in range(N):
c=0
for j in range(10):
if bit&(1<<j) a... | #from collections import Counter
N=int(eval(input()))
F=list(int(input().replace(" ",""),2) for i in range(N))
P=list(list(map(int,input().split())) for i in range(N))
ans=-(1<<40)
for bit in range(1,1<<10):
tmp = 0
for i in range(N):
tmp+=P[i][bin(bit&F[i]).count('1')]
ans = max(ans,tmp)
... | 15 | 11 | 405 | 324 | # from collections import Counter
N = int(eval(input()))
F = list(list(map(int, input().split())) for i in range(N))
P = list(list(map(int, input().split())) for i in range(N))
ans = -(1 << 40)
for bit in range(1, 1 << 10):
tmp = 0
for i in range(N):
c = 0
for j in range(10):
if bit ... | # from collections import Counter
N = int(eval(input()))
F = list(int(input().replace(" ", ""), 2) for i in range(N))
P = list(list(map(int, input().split())) for i in range(N))
ans = -(1 << 40)
for bit in range(1, 1 << 10):
tmp = 0
for i in range(N):
tmp += P[i][bin(bit & F[i]).count("1")]
ans = ma... | false | 26.666667 | [
"-F = list(list(map(int, input().split())) for i in range(N))",
"+F = list(int(input().replace(\" \", \"\"), 2) for i in range(N))",
"- c = 0",
"- for j in range(10):",
"- if bit & (1 << j) and F[i][j]:",
"- c += 1",
"- tmp += P[i][c]",
"+ tmp += P... | false | 0.039713 | 0.038449 | 1.032871 | [
"s158339248",
"s160980903"
] |
u018679195 | p02786 | python | s288320171 | s603056994 | 172 | 19 | 38,384 | 3,060 | Accepted | Accepted | 88.95 | n = int(eval(input()))
res, i = 0, 1
while n > 0:
res += i
i *= 2
n //= 2
print(res)
| N = int(eval(input()))
q = N
cnt = 0
while (q > 1) :
q = q // 2
cnt += 1
print((2 ** (cnt + 1) - 1)) | 7 | 10 | 97 | 113 | n = int(eval(input()))
res, i = 0, 1
while n > 0:
res += i
i *= 2
n //= 2
print(res)
| N = int(eval(input()))
q = N
cnt = 0
while q > 1:
q = q // 2
cnt += 1
print((2 ** (cnt + 1) - 1))
| false | 30 | [
"-n = int(eval(input()))",
"-res, i = 0, 1",
"-while n > 0:",
"- res += i",
"- i *= 2",
"- n //= 2",
"-print(res)",
"+N = int(eval(input()))",
"+q = N",
"+cnt = 0",
"+while q > 1:",
"+ q = q // 2",
"+ cnt += 1",
"+print((2 ** (cnt + 1) - 1))"
] | false | 0.235105 | 0.036276 | 6.480932 | [
"s288320171",
"s603056994"
] |
u952708174 | p04013 | python | s969082665 | s228193027 | 197 | 25 | 5,732 | 3,572 | Accepted | Accepted | 87.31 | def c_Tak_and_Cards(N, A, S):
X = max(S + [A])
y = [0] + [x - A for x in S]
dp = [[0 for _ in range(2 * N * X + 1)] for _ in range(N + 1)]
dp[0][N * X] = 1
for j in range(N + 1):
for t in range(2 * N * X + 1):
if j == 0 and t == N * X:
dp[j][t] = 1
... | def c_tak_and_cards():
from collections import defaultdict
N, A = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
average = [x - A for x in X]
dp = defaultdict(int) # dp[s]: y から 1 枚以上選んで整数の和を s にする方法
dp[0] = 1 # 「選ばない」 1 通り
for y in average:
for k... | 19 | 14 | 733 | 448 | def c_Tak_and_Cards(N, A, S):
X = max(S + [A])
y = [0] + [x - A for x in S]
dp = [[0 for _ in range(2 * N * X + 1)] for _ in range(N + 1)]
dp[0][N * X] = 1
for j in range(N + 1):
for t in range(2 * N * X + 1):
if j == 0 and t == N * X:
dp[j][t] = 1
eli... | def c_tak_and_cards():
from collections import defaultdict
N, A = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
average = [x - A for x in X]
dp = defaultdict(int) # dp[s]: y から 1 枚以上選んで整数の和を s にする方法
dp[0] = 1 # 「選ばない」 1 通り
for y in average:
for k, v in li... | false | 26.315789 | [
"-def c_Tak_and_Cards(N, A, S):",
"- X = max(S + [A])",
"- y = [0] + [x - A for x in S]",
"- dp = [[0 for _ in range(2 * N * X + 1)] for _ in range(N + 1)]",
"- dp[0][N * X] = 1",
"- for j in range(N + 1):",
"- for t in range(2 * N * X + 1):",
"- if j == 0 and t == N *... | false | 0.084183 | 0.064341 | 1.308391 | [
"s969082665",
"s228193027"
] |
u941047297 | p03208 | python | s021979242 | s143687602 | 247 | 175 | 8,280 | 13,376 | Accepted | Accepted | 29.15 | n, k = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(n)]
H = sorted(H)
ans = float('inf')
for i in range(n - k + 1):
ans = min(ans, H[i + k - 1] - H[i])
print(ans) | def main():
n, k = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(n)]
H.sort()
ans = 10 ** 9 + 2
for i in range(n - k + 1):
ans = min(ans, H[i + k - 1] - H[i])
print(ans)
if __name__ == '__main__':
main()
| 7 | 11 | 192 | 264 | n, k = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(n)]
H = sorted(H)
ans = float("inf")
for i in range(n - k + 1):
ans = min(ans, H[i + k - 1] - H[i])
print(ans)
| def main():
n, k = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(n)]
H.sort()
ans = 10**9 + 2
for i in range(n - k + 1):
ans = min(ans, H[i + k - 1] - H[i])
print(ans)
if __name__ == "__main__":
main()
| false | 36.363636 | [
"-n, k = list(map(int, input().split()))",
"-H = [int(eval(input())) for _ in range(n)]",
"-H = sorted(H)",
"-ans = float(\"inf\")",
"-for i in range(n - k + 1):",
"- ans = min(ans, H[i + k - 1] - H[i])",
"-print(ans)",
"+def main():",
"+ n, k = list(map(int, input().split()))",
"+ H = [i... | false | 0.036993 | 0.036923 | 1.00191 | [
"s021979242",
"s143687602"
] |
u077291787 | p03608 | python | s406926054 | s770763493 | 341 | 218 | 9,828 | 9,836 | Accepted | Accepted | 36.07 | # ABC073D - joisino's travel
from heapq import heapify, heappop, heappush
from itertools import permutations
def dijkstra(G: "Array[Array[int]]", size: int, start: int) -> list:
dist = [float("inf")] * size
queue = [(0, start)]
heapify(queue)
while queue:
cost, v = heappop(queue)
... | # ABC073D - joisino's travel
from heapq import heapify, heappop, heappush
from itertools import permutations
def dijkstra(G: "Array[Array[int]]", size: int, start: int) -> list:
dist = [float("inf")] * size
queue = [(0, start)]
unchecked = size - 1 # vertex_0 won't appear in 1-idx graph
heap... | 37 | 41 | 1,065 | 1,210 | # ABC073D - joisino's travel
from heapq import heapify, heappop, heappush
from itertools import permutations
def dijkstra(G: "Array[Array[int]]", size: int, start: int) -> list:
dist = [float("inf")] * size
queue = [(0, start)]
heapify(queue)
while queue:
cost, v = heappop(queue)
if co... | # ABC073D - joisino's travel
from heapq import heapify, heappop, heappush
from itertools import permutations
def dijkstra(G: "Array[Array[int]]", size: int, start: int) -> list:
dist = [float("inf")] * size
queue = [(0, start)]
unchecked = size - 1 # vertex_0 won't appear in 1-idx graph
heapify(queue... | false | 9.756098 | [
"+ unchecked = size - 1 # vertex_0 won't appear in 1-idx graph",
"- for u, next_cost in G[v]:",
"+ for next_cost, u in G[v]:",
"+ unchecked -= 1",
"+ if not unchecked:",
"+ break",
"- for v, u, c in zip(*[iter(ABC)] * 3):",
"- G[v].append((u, c)), G... | false | 0.044792 | 0.03958 | 1.131692 | [
"s406926054",
"s770763493"
] |
u759412327 | p03835 | python | s244863460 | s775725551 | 1,135 | 1,021 | 9,164 | 9,104 | Accepted | Accepted | 10.04 | K,S = list(map(int,input().split()))
a = 0
for X in range(K+1):
for Y in range(K+1):
Z = S-X-Y
if 0<=Z<=K:
a+=1
print(a) | K,S = list(map(int,input().split()))
a = 0
for X in range(K+1):
for Y in range(K+1):
if 0<=S-X-Y<=K:
a+=1
print(a) | 10 | 9 | 141 | 130 | K, S = list(map(int, input().split()))
a = 0
for X in range(K + 1):
for Y in range(K + 1):
Z = S - X - Y
if 0 <= Z <= K:
a += 1
print(a)
| K, S = list(map(int, input().split()))
a = 0
for X in range(K + 1):
for Y in range(K + 1):
if 0 <= S - X - Y <= K:
a += 1
print(a)
| false | 10 | [
"- Z = S - X - Y",
"- if 0 <= Z <= K:",
"+ if 0 <= S - X - Y <= K:"
] | false | 0.160897 | 0.041767 | 3.852288 | [
"s244863460",
"s775725551"
] |
u298224238 | p02267 | python | s917534888 | s798212661 | 30 | 20 | 6,552 | 6,556 | Accepted | Accepted | 33.33 | def linearSearch(key, list):
for e in list:
if key == e:
return 1
return 0
N1 = int(eval(input()))
arr1 = list(set([int(n) for n in input().split()]))
N2 = int(eval(input()))
arr2 = list(set([int(n) for n in input().split()]))
print((sum([linearSearch(key, arr2) for key in arr... | def linearSearch(key, list):
for e in list:
if key == e:
return 1
return 0
N1 = int(eval(input()))
arr1 = [int(n) for n in input().split()]
N2 = int(eval(input()))
arr2 = [int(n) for n in input().split()]
print((sum([linearSearch(key, arr1) for key in arr2])))
| 14 | 14 | 314 | 292 | def linearSearch(key, list):
for e in list:
if key == e:
return 1
return 0
N1 = int(eval(input()))
arr1 = list(set([int(n) for n in input().split()]))
N2 = int(eval(input()))
arr2 = list(set([int(n) for n in input().split()]))
print((sum([linearSearch(key, arr2) for key in arr1])))
| def linearSearch(key, list):
for e in list:
if key == e:
return 1
return 0
N1 = int(eval(input()))
arr1 = [int(n) for n in input().split()]
N2 = int(eval(input()))
arr2 = [int(n) for n in input().split()]
print((sum([linearSearch(key, arr1) for key in arr2])))
| false | 0 | [
"-arr1 = list(set([int(n) for n in input().split()]))",
"+arr1 = [int(n) for n in input().split()]",
"-arr2 = list(set([int(n) for n in input().split()]))",
"-print((sum([linearSearch(key, arr2) for key in arr1])))",
"+arr2 = [int(n) for n in input().split()]",
"+print((sum([linearSearch(key, arr1) for ke... | false | 0.045747 | 0.078937 | 0.579544 | [
"s917534888",
"s798212661"
] |
u413165887 | p02787 | python | s093133611 | s328801084 | 1,358 | 423 | 14,688 | 12,644 | Accepted | Accepted | 68.85 | import numpy as np
h, n = list(map(int, input().split()))
ab = np.array([np.fromstring(eval(input()), dtype=np.int64, sep=" ") for _ in range(n)])
a = ab[:, 0]
b = ab[:, 1]
dp = np.zeros(10**6, dtype=np.int)
for i in range(1,h+1):
dp[i] = min(dp[i-a]+b)
print((dp[h])) | import numpy as np
h, n = list(map(int, input().split()))
ab = np.array([np.fromstring(eval(input()), dtype=np.int64, sep=" ") for _ in range(n)])
a = ab[:, 0]
b = ab[:, 1]
dp = np.zeros(10**6, dtype=np.int)
for i in range(1,h+1):
dp[i] = (dp[i-a]+b).min()
print((dp[h])) | 13 | 13 | 274 | 277 | import numpy as np
h, n = list(map(int, input().split()))
ab = np.array([np.fromstring(eval(input()), dtype=np.int64, sep=" ") for _ in range(n)])
a = ab[:, 0]
b = ab[:, 1]
dp = np.zeros(10**6, dtype=np.int)
for i in range(1, h + 1):
dp[i] = min(dp[i - a] + b)
print((dp[h]))
| import numpy as np
h, n = list(map(int, input().split()))
ab = np.array([np.fromstring(eval(input()), dtype=np.int64, sep=" ") for _ in range(n)])
a = ab[:, 0]
b = ab[:, 1]
dp = np.zeros(10**6, dtype=np.int)
for i in range(1, h + 1):
dp[i] = (dp[i - a] + b).min()
print((dp[h]))
| false | 0 | [
"- dp[i] = min(dp[i - a] + b)",
"+ dp[i] = (dp[i - a] + b).min()"
] | false | 0.269455 | 0.282275 | 0.954583 | [
"s093133611",
"s328801084"
] |
u514894322 | p02953 | python | s207884169 | s858026507 | 96 | 69 | 15,020 | 14,396 | Accepted | Accepted | 28.12 | n = int(eval(input()))
l = list(map(int,input().split()))
l[0] -= 1
for i in range(n):
if i == n-1:
print('Yes')
break
if l[i] < l[i+1]:
l[i+1]-=1
if l[i] > l[i+1]:
print('No')
break | n = int(eval(input()))
*l, = list(map(int,input().split()))
l[0] -= 1
ans = 'Yes'
for i in range(1,n):
if l[i] > l[i-1]:
l[i] -= 1
elif l[i] < l[i-1]:
ans = 'No'
break
print(ans) | 12 | 11 | 213 | 192 | n = int(eval(input()))
l = list(map(int, input().split()))
l[0] -= 1
for i in range(n):
if i == n - 1:
print("Yes")
break
if l[i] < l[i + 1]:
l[i + 1] -= 1
if l[i] > l[i + 1]:
print("No")
break
| n = int(eval(input()))
(*l,) = list(map(int, input().split()))
l[0] -= 1
ans = "Yes"
for i in range(1, n):
if l[i] > l[i - 1]:
l[i] -= 1
elif l[i] < l[i - 1]:
ans = "No"
break
print(ans)
| false | 8.333333 | [
"-l = list(map(int, input().split()))",
"+(*l,) = list(map(int, input().split()))",
"-for i in range(n):",
"- if i == n - 1:",
"- print(\"Yes\")",
"+ans = \"Yes\"",
"+for i in range(1, n):",
"+ if l[i] > l[i - 1]:",
"+ l[i] -= 1",
"+ elif l[i] < l[i - 1]:",
"+ ans =... | false | 0.042059 | 0.060079 | 0.700064 | [
"s207884169",
"s858026507"
] |
u759934006 | p02038 | python | s715569842 | s026803212 | 80 | 40 | 7,196 | 7,192 | Accepted | Accepted | 50 | from functools import reduce
def M(x, y):
if x == 'T' and y == 'T':
return 'T'
elif x == 'T' and y == 'F':
return 'F'
elif x == 'F' and y == 'T':
return 'T'
else:
return 'T'
_ = eval(input())
P = input().split()
print((reduce(M, P)))
| from functools import reduce
def M(x, y):
if x == 'T' and y == 'F':
return 'F'
else:
return 'T'
_ = eval(input())
P = input().split()
print((reduce(M, P)))
| 19 | 15 | 298 | 192 | from functools import reduce
def M(x, y):
if x == "T" and y == "T":
return "T"
elif x == "T" and y == "F":
return "F"
elif x == "F" and y == "T":
return "T"
else:
return "T"
_ = eval(input())
P = input().split()
print((reduce(M, P)))
| from functools import reduce
def M(x, y):
if x == "T" and y == "F":
return "F"
else:
return "T"
_ = eval(input())
P = input().split()
print((reduce(M, P)))
| false | 21.052632 | [
"- if x == \"T\" and y == \"T\":",
"- return \"T\"",
"- elif x == \"T\" and y == \"F\":",
"+ if x == \"T\" and y == \"F\":",
"- elif x == \"F\" and y == \"T\":",
"- return \"T\""
] | false | 0.083214 | 0.156429 | 0.531964 | [
"s715569842",
"s026803212"
] |
u723583932 | p02726 | python | s029569737 | s280724663 | 333 | 289 | 48,604 | 46,428 | Accepted | Accepted | 13.21 | n,x,y=list(map(int,input().split()))
x,y=x-1,y-1
ans=[0]*(n+1)
for i in range(n):
for j in range(i+1,n):
a=abs(i-j)
b=abs(i-x)+1+abs(y-j)
c=abs(y-i)+1+abs(x-j)
ans[min(a,b,c)]+=1
for i in range(1,n):
print((ans[i]))
| n,x,y=list(map(int,input().split()))
x,y=x-1,y-1
ans=[0]*(n+1)
for i in range(n):
for j in range(i+1,n):
a=abs(i-j)
b=abs(i-x)+1+abs(y-j)
ans[min(a,b)]+=1
for i in range(1,n):
print((ans[i]))
| 16 | 15 | 271 | 238 | n, x, y = list(map(int, input().split()))
x, y = x - 1, y - 1
ans = [0] * (n + 1)
for i in range(n):
for j in range(i + 1, n):
a = abs(i - j)
b = abs(i - x) + 1 + abs(y - j)
c = abs(y - i) + 1 + abs(x - j)
ans[min(a, b, c)] += 1
for i in range(1, n):
print((ans[i]))
| n, x, y = list(map(int, input().split()))
x, y = x - 1, y - 1
ans = [0] * (n + 1)
for i in range(n):
for j in range(i + 1, n):
a = abs(i - j)
b = abs(i - x) + 1 + abs(y - j)
ans[min(a, b)] += 1
for i in range(1, n):
print((ans[i]))
| false | 6.25 | [
"- c = abs(y - i) + 1 + abs(x - j)",
"- ans[min(a, b, c)] += 1",
"+ ans[min(a, b)] += 1"
] | false | 0.040058 | 0.035386 | 1.132038 | [
"s029569737",
"s280724663"
] |
u296150111 | p02756 | python | s495756227 | s587293379 | 899 | 205 | 8,692 | 6,184 | Accepted | Accepted | 77.2 | alph="abcdefghijklmnopqrstuvwxyz"
from collections import deque
import sys
input=sys.stdin.readline
moji=deque([])
s=input().rstrip()
for i in range(len(s)):
for j in range(26):
if s[i]==alph[j]:
moji.append(j)
break
q=int(eval(input()))
rev=0
for _ in range(q):
qw=input().split()
if qw[0]=="1... | from collections import deque
import sys
input=sys.stdin.readline
s=deque([input().rstrip()])
q=int(eval(input()))
rev=0
for _ in range(q):
qw=input().split()
if qw[0]=="1":
rev+=1
else:
f=qw[1]
c=qw[2]
if f=="1":
if rev%2==0:
s.appendleft(c)
else:
s.append(c)
else:
if r... | 44 | 31 | 749 | 456 | alph = "abcdefghijklmnopqrstuvwxyz"
from collections import deque
import sys
input = sys.stdin.readline
moji = deque([])
s = input().rstrip()
for i in range(len(s)):
for j in range(26):
if s[i] == alph[j]:
moji.append(j)
break
q = int(eval(input()))
rev = 0
for _ in range(q):
qw... | from collections import deque
import sys
input = sys.stdin.readline
s = deque([input().rstrip()])
q = int(eval(input()))
rev = 0
for _ in range(q):
qw = input().split()
if qw[0] == "1":
rev += 1
else:
f = qw[1]
c = qw[2]
if f == "1":
if rev % 2 == 0:
... | false | 29.545455 | [
"-alph = \"abcdefghijklmnopqrstuvwxyz\"",
"-moji = deque([])",
"-s = input().rstrip()",
"-for i in range(len(s)):",
"- for j in range(26):",
"- if s[i] == alph[j]:",
"- moji.append(j)",
"- break",
"+s = deque([input().rstrip()])",
"- for j in range(26):",
"... | false | 0.097347 | 0.060842 | 1.600003 | [
"s495756227",
"s587293379"
] |
u190866453 | p03416 | python | s068042351 | s745844885 | 78 | 59 | 9,164 | 9,072 | Accepted | Accepted | 24.36 | a, b = list(map(int, input().split()))
count = 0
for i in range(a, b + 1):
x = list(str(i))
y = x[::-1]
if x == y:
count += 1
print(count)
| a, b = list(map(int, input().split()))
count = 0
for i in range(a, b + 1):
x = str(i)
y = x[::-1]
if x == y:
count += 1
print(count)
| 12 | 12 | 171 | 165 | a, b = list(map(int, input().split()))
count = 0
for i in range(a, b + 1):
x = list(str(i))
y = x[::-1]
if x == y:
count += 1
print(count)
| a, b = list(map(int, input().split()))
count = 0
for i in range(a, b + 1):
x = str(i)
y = x[::-1]
if x == y:
count += 1
print(count)
| false | 0 | [
"- x = list(str(i))",
"+ x = str(i)"
] | false | 0.082431 | 0.047431 | 1.737908 | [
"s068042351",
"s745844885"
] |
u096660561 | p02281 | python | s797567797 | s240697603 | 30 | 20 | 5,640 | 5,624 | Accepted | Accepted | 33.33 | def Pre(i):
if dali[i].node != -1:
ret = dali[i].node
dali[i].node = -1
order.append(ret)
if dali[i].left != -1:
Pre(dali[i].left)
if dali[i].right != -1:
Pre(dali[i].right)
def Pre2(u):
if u == -1:
return
order.append(u)
Pre2(dali[u]... | def Pre(i):
if dali[i].node != -1:
ret = dali[i].node
dali[i].node = -1
order.append(ret)
if dali[i].left != -1:
Pre(dali[i].left)
if dali[i].right != -1:
Pre(dali[i].right)
def Pre2(u):
if u == -1:
return
order.append(u)
Pre2(dali[u]... | 122 | 96 | 2,510 | 1,658 | def Pre(i):
if dali[i].node != -1:
ret = dali[i].node
dali[i].node = -1
order.append(ret)
if dali[i].left != -1:
Pre(dali[i].left)
if dali[i].right != -1:
Pre(dali[i].right)
def Pre2(u):
if u == -1:
return
order.append(u)
Pre2(dali[u].left)
P... | def Pre(i):
if dali[i].node != -1:
ret = dali[i].node
dali[i].node = -1
order.append(ret)
if dali[i].left != -1:
Pre(dali[i].left)
if dali[i].right != -1:
Pre(dali[i].right)
def Pre2(u):
if u == -1:
return
order.append(u)
Pre2(dali[u].left)
P... | false | 21.311475 | [
"-",
"-",
"-def In(i):",
"- if dali2[i].left != -1:",
"- In(dali2[i].left)",
"- if dali2[i].node != -1:",
"- ret = dali2[i].node",
"- dali2[i].node = -1",
"- order.append(ret)",
"- if dali2[i].right != -1:",
"- In(dali2[i].right)",
"-def getParent(i)... | false | 0.037604 | 0.083807 | 0.448699 | [
"s797567797",
"s240697603"
] |
u361826811 | p03611 | python | s693064447 | s860743441 | 263 | 177 | 21,404 | 21,408 | Accepted | Accepted | 32.7 | import sys
import itertools
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *a = list(map(int, read().split()))
a.sort()
A = [0] * (10**5 + 1)
for i in a:
A[i] += 1
cnt = 0
for i in range(1, 10**5 - 1):
cnt = max(c... | import sys
import itertools
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *a = list(map(int, read().split()))
A = np.array(a)
counter = np.bincount(A)
B = counter.copy()
B[1:] += counter[:-1]
B[:-1] += counter[1:]
print... | 18 | 17 | 358 | 324 | import sys
import itertools
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *a = list(map(int, read().split()))
a.sort()
A = [0] * (10**5 + 1)
for i in a:
A[i] += 1
cnt = 0
for i in range(1, 10**5 - 1):
cnt = max(cnt, A[i - 1] + A[i... | import sys
import itertools
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *a = list(map(int, read().split()))
A = np.array(a)
counter = np.bincount(A)
B = counter.copy()
B[1:] += counter[:-1]
B[:-1] += counter[1:]
print((B.max()))
| false | 5.555556 | [
"-a.sort()",
"-A = [0] * (10**5 + 1)",
"-for i in a:",
"- A[i] += 1",
"-cnt = 0",
"-for i in range(1, 10**5 - 1):",
"- cnt = max(cnt, A[i - 1] + A[i] + A[i + 1])",
"-print(cnt)",
"+A = np.array(a)",
"+counter = np.bincount(A)",
"+B = counter.copy()",
"+B[1:] += counter[:-1]",
"+B[:-1] ... | false | 0.129009 | 0.233052 | 0.553563 | [
"s693064447",
"s860743441"
] |
u131273629 | p03493 | python | s627960386 | s066548839 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | s = list(eval(input()))
print((int(s[0])+int(s[1])+int(s[2]))) | s = eval(input())
print((int(s[0])+int(s[1])+int(s[2]))) | 2 | 2 | 55 | 49 | s = list(eval(input()))
print((int(s[0]) + int(s[1]) + int(s[2])))
| s = eval(input())
print((int(s[0]) + int(s[1]) + int(s[2])))
| false | 0 | [
"-s = list(eval(input()))",
"+s = eval(input())"
] | false | 0.078935 | 0.07165 | 1.101673 | [
"s627960386",
"s066548839"
] |
u815731054 | p02888 | python | s453854884 | s775440450 | 1,300 | 769 | 3,316 | 3,188 | Accepted | Accepted | 40.85 | import bisect
n = int(eval(input()))
ListL = [int(i) for i in input().split()]
ListL.sort()
ans = 0
for i in reversed(list(range(2, n))):
a = ListL[i]
for j in reversed(list(range(1, i))):
b = ListL[j]
index = bisect.bisect_right(ListL, a-b)
#print(a, b)
if (index >= j):
break
else:
... | import bisect
n = int(eval(input()))
ListL = [int(i) for i in input().split()]
ListL.sort()
ans = 0
for i in reversed(list(range(2, n))):
a = ListL[i]
b = ListL[i-1]
c = a - b + 1
indexb = i - 1
indexc = bisect.bisect_left(ListL, c)
while(indexb > indexc):
if (ListL[indexb] + ListL[indexc] > a... | 20 | 22 | 334 | 392 | import bisect
n = int(eval(input()))
ListL = [int(i) for i in input().split()]
ListL.sort()
ans = 0
for i in reversed(list(range(2, n))):
a = ListL[i]
for j in reversed(list(range(1, i))):
b = ListL[j]
index = bisect.bisect_right(ListL, a - b)
# print(a, b)
if index >= j:
... | import bisect
n = int(eval(input()))
ListL = [int(i) for i in input().split()]
ListL.sort()
ans = 0
for i in reversed(list(range(2, n))):
a = ListL[i]
b = ListL[i - 1]
c = a - b + 1
indexb = i - 1
indexc = bisect.bisect_left(ListL, c)
while indexb > indexc:
if ListL[indexb] + ListL[inde... | false | 9.090909 | [
"- for j in reversed(list(range(1, i))):",
"- b = ListL[j]",
"- index = bisect.bisect_right(ListL, a - b)",
"- # print(a, b)",
"- if index >= j:",
"- break",
"+ b = ListL[i - 1]",
"+ c = a - b + 1",
"+ indexb = i - 1",
"+ indexc = bisect.bisect... | false | 0.105923 | 0.092531 | 1.144731 | [
"s453854884",
"s775440450"
] |
u226108478 | p03353 | python | s657422416 | s213322139 | 1,567 | 33 | 4,084 | 4,552 | Accepted | Accepted | 97.89 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == '__main__':
s = eval(input())
k = int(eval(input()))
extracted = list()
s_len = len(s)
for i in range(1, min(k, s_len) + 1):
start = 0
ended = i
for j in range(s_len - i + 1):
... | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == '__main__':
s = eval(input())
k = int(eval(input()))
extracted = set()
s_len = len(s)
# See:
# https://beta.atcoder.jp/contests/abc097/submissions/2497319
for i in range(1, min(k, s_len) + 1):
... | 26 | 18 | 560 | 421 | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == "__main__":
s = eval(input())
k = int(eval(input()))
extracted = list()
s_len = len(s)
for i in range(1, min(k, s_len) + 1):
start = 0
ended = i
for j in range(s_len - i + 1):
sub_str = ... | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == "__main__":
s = eval(input())
k = int(eval(input()))
extracted = set()
s_len = len(s)
# See:
# https://beta.atcoder.jp/contests/abc097/submissions/2497319
for i in range(1, min(k, s_len) + 1):
for j in rang... | false | 30.769231 | [
"- extracted = list()",
"+ extracted = set()",
"+ # See:",
"+ # https://beta.atcoder.jp/contests/abc097/submissions/2497319",
"- start = 0",
"- ended = i",
"- sub_str = s[start:ended]",
"- if sub_str not in extracted:",
"- extracted.appe... | false | 0.105626 | 0.04226 | 2.499423 | [
"s657422416",
"s213322139"
] |
u047796752 | p03103 | python | s412500452 | s344948107 | 717 | 228 | 61,528 | 88,104 | Accepted | Accepted | 68.2 | N, M = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda t: t[0])
ans = 0
for A, B in AB:
if M-B>=0:
ans += A*B
M -= B
else:
ans += A*M
break
print(ans) | import sys
input = sys.stdin.readline
from collections import *
N, M = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda t: t[0])
ans = 0
for A, B in AB:
if M-B>=0:
ans += A*B
M -= B
else:
ans += A*M
brea... | 14 | 18 | 260 | 329 | N, M = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda t: t[0])
ans = 0
for A, B in AB:
if M - B >= 0:
ans += A * B
M -= B
else:
ans += A * M
break
print(ans)
| import sys
input = sys.stdin.readline
from collections import *
N, M = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda t: t[0])
ans = 0
for A, B in AB:
if M - B >= 0:
ans += A * B
M -= B
else:
ans += A * M
break
print... | false | 22.222222 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+from collections import *",
"+"
] | false | 0.079975 | 0.042114 | 1.89901 | [
"s412500452",
"s344948107"
] |
u809819902 | p02627 | python | s034589027 | s216870296 | 71 | 26 | 61,752 | 9,004 | Accepted | Accepted | 63.38 | a=eval(input())
print(("A" if a.lower()!=a else "a")) | s=eval(input())
print(("A" if s.upper()==s else "a")) | 2 | 2 | 46 | 46 | a = eval(input())
print(("A" if a.lower() != a else "a"))
| s = eval(input())
print(("A" if s.upper() == s else "a"))
| false | 0 | [
"-a = eval(input())",
"-print((\"A\" if a.lower() != a else \"a\"))",
"+s = eval(input())",
"+print((\"A\" if s.upper() == s else \"a\"))"
] | false | 0.036503 | 0.034977 | 1.043627 | [
"s034589027",
"s216870296"
] |
u361381049 | p02923 | python | s991659865 | s657050409 | 103 | 93 | 15,740 | 14,224 | Accepted | Accepted | 9.71 | n = int(eval(input()))
h = list(map(int, input().split()))
a = []
ans = []
b = set(h)
if n == 0:
print((0))
elif len(b) == 1:
print((len(h)-1))
else:
for i in range(n-1):
if h[i] < h[i+1]:
a.append(i+1)
if a == []:
print((len(h)-1))
else:
ans.append(a[0])
ans[0... | n = int(eval(input()))
h = list(map(int, input().split()))
h.reverse()
ans = 0
val = 0
for i in range(1,n):
if h[i-1] <= h[i]:
val += 1
else:
val = 0
ans = max(ans, val)
print(ans) | 29 | 12 | 493 | 199 | n = int(eval(input()))
h = list(map(int, input().split()))
a = []
ans = []
b = set(h)
if n == 0:
print((0))
elif len(b) == 1:
print((len(h) - 1))
else:
for i in range(n - 1):
if h[i] < h[i + 1]:
a.append(i + 1)
if a == []:
print((len(h) - 1))
else:
ans.append(a[0]... | n = int(eval(input()))
h = list(map(int, input().split()))
h.reverse()
ans = 0
val = 0
for i in range(1, n):
if h[i - 1] <= h[i]:
val += 1
else:
val = 0
ans = max(ans, val)
print(ans)
| false | 58.62069 | [
"-a = []",
"-ans = []",
"-b = set(h)",
"-if n == 0:",
"- print((0))",
"-elif len(b) == 1:",
"- print((len(h) - 1))",
"-else:",
"- for i in range(n - 1):",
"- if h[i] < h[i + 1]:",
"- a.append(i + 1)",
"- if a == []:",
"- print((len(h) - 1))",
"+h.revers... | false | 0.083827 | 0.106804 | 0.78487 | [
"s991659865",
"s657050409"
] |
u340781749 | p02996 | python | s316459703 | s911153848 | 427 | 268 | 31,876 | 20,820 | Accepted | Accepted | 37.24 | import sys
from operator import itemgetter
def solve(tasks):
tasks.sort(key=itemgetter(1))
t = 0
for a, b in tasks:
t += a
if t > b:
return False
return True
n = int(eval(input()))
tasks = [tuple(map(int, line.split())) for line in sys.stdin]
print(('Yes' ... | import sys
import numpy as np
n = int(eval(input()))
a, b = np.fromstring(sys.stdin.read(), sep=' ').reshape((n, 2)).T
i = b.argsort()
print(('Yes' if (a[i].cumsum() <= b[i]).all() else 'No'))
| 17 | 7 | 340 | 192 | import sys
from operator import itemgetter
def solve(tasks):
tasks.sort(key=itemgetter(1))
t = 0
for a, b in tasks:
t += a
if t > b:
return False
return True
n = int(eval(input()))
tasks = [tuple(map(int, line.split())) for line in sys.stdin]
print(("Yes" if solve(tasks) ... | import sys
import numpy as np
n = int(eval(input()))
a, b = np.fromstring(sys.stdin.read(), sep=" ").reshape((n, 2)).T
i = b.argsort()
print(("Yes" if (a[i].cumsum() <= b[i]).all() else "No"))
| false | 58.823529 | [
"-from operator import itemgetter",
"-",
"-",
"-def solve(tasks):",
"- tasks.sort(key=itemgetter(1))",
"- t = 0",
"- for a, b in tasks:",
"- t += a",
"- if t > b:",
"- return False",
"- return True",
"-",
"+import numpy as np",
"-tasks = [tuple(map(int,... | false | 0.053775 | 0.171242 | 0.314028 | [
"s316459703",
"s911153848"
] |
u297574184 | p03576 | python | s419126211 | s603363418 | 1,738 | 327 | 3,316 | 3,064 | Accepted | Accepted | 81.19 | from itertools import accumulate
from operator import add
N, K = list(map(int, input().split()))
xs, ys = [], []
for _ in range(N):
x, y = list(map(int, input().split()))
xs.append(x)
ys.append(y)
iXs = list(range(N))
iXs.sort(key=lambda iX: xs[iX])
odrXs = [0]*(N)
for odrX, iX in enumerate(i... | N, K = list(map(int, input().split()))
pts = []
ys = []
for _ in range(N):
x, y = list(map(int, input().split()))
pts.append((x, y))
ys.append(y)
pts.sort()
ys.sort()
ans = 10**20
for i, y1 in enumerate(ys):
for y2 in ys[i+1:]:
for j, (x1, _) in enumerate(pts):
num =... | 46 | 25 | 1,330 | 568 | from itertools import accumulate
from operator import add
N, K = list(map(int, input().split()))
xs, ys = [], []
for _ in range(N):
x, y = list(map(int, input().split()))
xs.append(x)
ys.append(y)
iXs = list(range(N))
iXs.sort(key=lambda iX: xs[iX])
odrXs = [0] * (N)
for odrX, iX in enumerate(iXs):
odr... | N, K = list(map(int, input().split()))
pts = []
ys = []
for _ in range(N):
x, y = list(map(int, input().split()))
pts.append((x, y))
ys.append(y)
pts.sort()
ys.sort()
ans = 10**20
for i, y1 in enumerate(ys):
for y2 in ys[i + 1 :]:
for j, (x1, _) in enumerate(pts):
num = 0
... | false | 45.652174 | [
"-from itertools import accumulate",
"-from operator import add",
"-",
"-xs, ys = [], []",
"+pts = []",
"+ys = []",
"- xs.append(x)",
"+ pts.append((x, y))",
"-iXs = list(range(N))",
"-iXs.sort(key=lambda iX: xs[iX])",
"-odrXs = [0] * (N)",
"-for odrX, iX in enumerate(iXs):",
"- odr... | false | 0.056906 | 0.036113 | 1.575793 | [
"s419126211",
"s603363418"
] |
u994988729 | p02838 | python | s806135517 | s429752969 | 525 | 339 | 122,808 | 48,808 | Accepted | Accepted | 35.43 | n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10 ** 9 + 7
bit = [0] * 60
for a in A:
i = 0
while a > 0:
bit[i] += a & 1
i += 1
a >>= 1
ans = 0
for i, x in enumerate(bit):
x = x*(n-x)
for _ in range(i):
x *= 2
x %= mod
ans... | import numpy as np
n = int(eval(input()))
A = np.array(list(map(int, input().split())))
mod = 10 ** 9 + 7
ans = 0
for i in range(64):
tmp = (A >> i) & 1
x = np.count_nonzero(tmp)
x *= n - x
ans += pow(2, i, mod) * x % mod
print((ans % mod))
| 21 | 13 | 348 | 263 | n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
bit = [0] * 60
for a in A:
i = 0
while a > 0:
bit[i] += a & 1
i += 1
a >>= 1
ans = 0
for i, x in enumerate(bit):
x = x * (n - x)
for _ in range(i):
x *= 2
x %= mod
ans += x
ans %= m... | import numpy as np
n = int(eval(input()))
A = np.array(list(map(int, input().split())))
mod = 10**9 + 7
ans = 0
for i in range(64):
tmp = (A >> i) & 1
x = np.count_nonzero(tmp)
x *= n - x
ans += pow(2, i, mod) * x % mod
print((ans % mod))
| false | 38.095238 | [
"+import numpy as np",
"+",
"-A = list(map(int, input().split()))",
"+A = np.array(list(map(int, input().split())))",
"-bit = [0] * 60",
"-for a in A:",
"- i = 0",
"- while a > 0:",
"- bit[i] += a & 1",
"- i += 1",
"- a >>= 1",
"-for i, x in enumerate(bit):",
"- ... | false | 0.035417 | 0.658383 | 0.053793 | [
"s806135517",
"s429752969"
] |
u440566786 | p03039 | python | s194380257 | s469552180 | 222 | 190 | 43,884 | 41,968 | Accepted | Accepted | 14.41 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
class modfact(object):
def __init__(self,n):
fact=[1]*(n+1); invfact=[1]*(n+1)
for i in range(1,n+1): fact[i]=i*fact[i-1]%MOD
invfact[n]=pow(fact[n],MOD-2,MOD)
... | import sys
sys.setrecursionlimit(2147483647)
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
input = lambda:sys.stdin.readline().rstrip()
class modfact(object):
def __init__(self, n):
fact, invfact = [1] * (n + 1), [1] * (n + 1)
for i in range(1, n + 1): fact[i] = i * fact[i - 1] % MOD
... | 45 | 45 | 1,205 | 1,319 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
class modfact(object):
def __init__(self, n):
fact = [1] * (n + 1)
invfact = [1] * (n + 1)
for i in range(1, n + 1):
fact[i] = i * fact[i - 1] % MOD
... | import sys
sys.setrecursionlimit(2147483647)
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
input = lambda: sys.stdin.readline().rstrip()
class modfact(object):
def __init__(self, n):
fact, invfact = [1] * (n + 1), [1] * (n + 1)
for i in range(1, n + 1):
fact[i] = i * fact[i - 1] % MOD
... | false | 0 | [
"-INF = float(\"inf\")",
"-MOD = 10**9 + 7",
"+INF = 1 << 60",
"+MOD = 10**9 + 7 # 998244353",
"- fact = [1] * (n + 1)",
"- invfact = [1] * (n + 1)",
"+ fact, invfact = [1] * (n + 1), [1] * (n + 1)",
"- self.__fact = fact",
"- self.__invfact = invfact",
"+ ... | false | 0.091534 | 0.053503 | 1.710809 | [
"s194380257",
"s469552180"
] |
u906428167 | p02744 | python | s472618702 | s125463441 | 480 | 384 | 56,536 | 57,816 | Accepted | Accepted | 20 | n = int(eval(input()))
d = 'abcdefghijklm'
def conv(s):
s = list([d[x] for x in s])
return ''.join(s)
def dfs(s):
if len(s) == n:
print((conv(s)))
else:
mx = max(s)+1
for i in range(mx+1):
dfs(s+[i])
dfs([0]) | n = int(eval(input()))
d = 'abcdefghijklm'
def conv(s):
s = list([d[x] for x in s])
return ''.join(s)
def dfs(s, k):
if len(s) == n:
print(s)
else:
for i in range(k):
dfs(s+d[i], k)
dfs(s+d[k], k+1)
dfs('a', 1)
| 20 | 20 | 283 | 288 | n = int(eval(input()))
d = "abcdefghijklm"
def conv(s):
s = list([d[x] for x in s])
return "".join(s)
def dfs(s):
if len(s) == n:
print((conv(s)))
else:
mx = max(s) + 1
for i in range(mx + 1):
dfs(s + [i])
dfs([0])
| n = int(eval(input()))
d = "abcdefghijklm"
def conv(s):
s = list([d[x] for x in s])
return "".join(s)
def dfs(s, k):
if len(s) == n:
print(s)
else:
for i in range(k):
dfs(s + d[i], k)
dfs(s + d[k], k + 1)
dfs("a", 1)
| false | 0 | [
"-def dfs(s):",
"+def dfs(s, k):",
"- print((conv(s)))",
"+ print(s)",
"- mx = max(s) + 1",
"- for i in range(mx + 1):",
"- dfs(s + [i])",
"+ for i in range(k):",
"+ dfs(s + d[i], k)",
"+ dfs(s + d[k], k + 1)",
"-dfs([0])",
"+dfs(... | false | 0.120439 | 0.16748 | 0.719127 | [
"s472618702",
"s125463441"
] |
u690037900 | p02952 | python | s418480704 | s018814253 | 65 | 17 | 2,940 | 3,060 | Accepted | Accepted | 73.85 | import sys
input=sys.stdin.readline
n=int(eval(input()))
ans=0
for _ in range(n):
if len(str(n))%2!=0:
ans+=1
n-=1
print(ans) | import sys
input=sys.stdin.buffer.readline
N = int(eval(input()))
S = len(str(N))
cnt=0
for i in range(S,-1,-1):
if i%2!=0:
cnt=cnt+N-10**(i-1)+1
else:
N=10**(i-1)-1
print(cnt) | 9 | 11 | 143 | 204 | import sys
input = sys.stdin.readline
n = int(eval(input()))
ans = 0
for _ in range(n):
if len(str(n)) % 2 != 0:
ans += 1
n -= 1
print(ans)
| import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
S = len(str(N))
cnt = 0
for i in range(S, -1, -1):
if i % 2 != 0:
cnt = cnt + N - 10 ** (i - 1) + 1
else:
N = 10 ** (i - 1) - 1
print(cnt)
| false | 18.181818 | [
"-input = sys.stdin.readline",
"-n = int(eval(input()))",
"-ans = 0",
"-for _ in range(n):",
"- if len(str(n)) % 2 != 0:",
"- ans += 1",
"- n -= 1",
"-print(ans)",
"+input = sys.stdin.buffer.readline",
"+N = int(eval(input()))",
"+S = len(str(N))",
"+cnt = 0",
"+for i in range(S... | false | 0.093533 | 0.071185 | 1.313944 | [
"s418480704",
"s018814253"
] |
u670180528 | p03839 | python | s673176125 | s387068676 | 126 | 112 | 23,308 | 23,308 | Accepted | Accepted | 11.11 | from itertools import accumulate
n,k,*a=list(map(int,open(0).read().split()))
p=[x if x>0 else 0 for x in a]
acc=[0]+list(accumulate(a))
p_acc=[0]+list(accumulate(p))
rev_p_acc=[0]+list(accumulate(p[::-1]))
print((max(max(0,acc[k+i]-acc[i])+p_acc[i]+rev_p_acc[n-k-i] for i in range(n-k+1)))) | from itertools import accumulate
def main():
n, k, *a = list(map(int, open(0).read().split()))
p = [x if x > 0 else 0 for x in a]
acc = [0] + list(accumulate(a))
p_acc = [0] + list(accumulate(p))
rev_p_acc = [0] + list(accumulate(p[::-1]))
print((max(max(0, acc[k + i] - acc[i]) + p_acc[i] + rev_p_acc[n - k... | 7 | 11 | 289 | 384 | from itertools import accumulate
n, k, *a = list(map(int, open(0).read().split()))
p = [x if x > 0 else 0 for x in a]
acc = [0] + list(accumulate(a))
p_acc = [0] + list(accumulate(p))
rev_p_acc = [0] + list(accumulate(p[::-1]))
print(
(
max(
max(0, acc[k + i] - acc[i]) + p_acc[i] + rev_p_acc[n ... | from itertools import accumulate
def main():
n, k, *a = list(map(int, open(0).read().split()))
p = [x if x > 0 else 0 for x in a]
acc = [0] + list(accumulate(a))
p_acc = [0] + list(accumulate(p))
rev_p_acc = [0] + list(accumulate(p[::-1]))
print(
(
max(
max(... | false | 36.363636 | [
"-n, k, *a = list(map(int, open(0).read().split()))",
"-p = [x if x > 0 else 0 for x in a]",
"-acc = [0] + list(accumulate(a))",
"-p_acc = [0] + list(accumulate(p))",
"-rev_p_acc = [0] + list(accumulate(p[::-1]))",
"-print(",
"- (",
"- max(",
"- max(0, acc[k + i] - acc[i]) + p_a... | false | 0.087148 | 0.097163 | 0.896921 | [
"s673176125",
"s387068676"
] |
u223663729 | p03162 | python | s100138095 | s828390985 | 586 | 356 | 40,232 | 110,636 | Accepted | Accepted | 39.25 | N = int(eval(input()))
A = [tuple(map(int, input().split())) for _ in range(N)]
# dp[i][j] i日目にjを選んだ場合の幸福度
dp = [[0]*3 for _ in range(N+1)]
for i, a in enumerate(A):
for j, h in enumerate(a):
dp[i+1][j] = max(dp[i][(1+j)%3], dp[i][(2+j)%3]) + h
print((max(dp[N]))) | N, *A = list(map(int, open(0).read().split()))
*A, = list(zip(*[iter(A)]*3))
dp = [[0]*3 for _ in range(N)]
for i, (a, b, c) in enumerate(A):
if i == 0:
dp[i] = [a, b, c]
continue
da, db, dc = dp[i-1]
dp[i][0] = max(dp[i][0], max(db, dc)+a)
dp[i][1] = max(dp[i][1], max(dc, d... | 11 | 15 | 279 | 381 | N = int(eval(input()))
A = [tuple(map(int, input().split())) for _ in range(N)]
# dp[i][j] i日目にjを選んだ場合の幸福度
dp = [[0] * 3 for _ in range(N + 1)]
for i, a in enumerate(A):
for j, h in enumerate(a):
dp[i + 1][j] = max(dp[i][(1 + j) % 3], dp[i][(2 + j) % 3]) + h
print((max(dp[N])))
| N, *A = list(map(int, open(0).read().split()))
(*A,) = list(zip(*[iter(A)] * 3))
dp = [[0] * 3 for _ in range(N)]
for i, (a, b, c) in enumerate(A):
if i == 0:
dp[i] = [a, b, c]
continue
da, db, dc = dp[i - 1]
dp[i][0] = max(dp[i][0], max(db, dc) + a)
dp[i][1] = max(dp[i][1], max(dc, da) ... | false | 26.666667 | [
"-N = int(eval(input()))",
"-A = [tuple(map(int, input().split())) for _ in range(N)]",
"-# dp[i][j] i日目にjを選んだ場合の幸福度",
"-dp = [[0] * 3 for _ in range(N + 1)]",
"-for i, a in enumerate(A):",
"- for j, h in enumerate(a):",
"- dp[i + 1][j] = max(dp[i][(1 + j) % 3], dp[i][(2 + j) % 3]) + h",
"-p... | false | 0.03731 | 0.038635 | 0.965698 | [
"s100138095",
"s828390985"
] |
u532966492 | p02889 | python | s285274190 | s003952677 | 1,693 | 1,002 | 83,928 | 44,072 | Accepted | Accepted | 40.82 | n,m,l=list(map(int,input().split()))
abc=[list(map(int,input().split())) for _ in [0]*m]
q=int(eval(input()))
st=[list(map(int,input().split())) for _ in [0]*q]
inf=10**12
dist=[[inf]*n for _ in [0]*n]
for i in range(n):
dist[i][i]=0
for a,b,c in abc:
dist[a-1][b-1]=c
dist[b-1][a-1]=c
for k in ra... | def main():
from sys import stdin
input=stdin.readline
import numpy as np
import scipy.sparse.csgraph as sp
n, m, l = list(map(int, input().split()))
abc = [list(map(int, input().split())) for _ in [0]*m]
q = int(eval(input()))
st = [list(map(int, input().split())) for _ ... | 33 | 39 | 897 | 1,020 | n, m, l = list(map(int, input().split()))
abc = [list(map(int, input().split())) for _ in [0] * m]
q = int(eval(input()))
st = [list(map(int, input().split())) for _ in [0] * q]
inf = 10**12
dist = [[inf] * n for _ in [0] * n]
for i in range(n):
dist[i][i] = 0
for a, b, c in abc:
dist[a - 1][b - 1] = c
dist... | def main():
from sys import stdin
input = stdin.readline
import numpy as np
import scipy.sparse.csgraph as sp
n, m, l = list(map(int, input().split()))
abc = [list(map(int, input().split())) for _ in [0] * m]
q = int(eval(input()))
st = [list(map(int, input().split())) for _ in [0] * q... | false | 15.384615 | [
"-n, m, l = list(map(int, input().split()))",
"-abc = [list(map(int, input().split())) for _ in [0] * m]",
"-q = int(eval(input()))",
"-st = [list(map(int, input().split())) for _ in [0] * q]",
"-inf = 10**12",
"-dist = [[inf] * n for _ in [0] * n]",
"-for i in range(n):",
"- dist[i][i] = 0",
"-f... | false | 0.040621 | 0.369292 | 0.109998 | [
"s285274190",
"s003952677"
] |
u102461423 | p03641 | python | s666870006 | s152153996 | 1,981 | 1,671 | 108,464 | 108,752 | Accepted | Accepted | 15.65 | import sys
input = sys.stdin.readline
import numpy as np
from heapq import heappush, heappop
N = int(eval(input()))
A = np.array(input().split(), dtype=np.int32)
a_to_i = {a:i for i,a in enumerate(A)}
# sparse table を使ってRMQ
# parityの同じところだけを見るようにしておく
U = len(A).bit_length()
sp = [None,A]
for i in range... | import sys
input = sys.stdin.readline
import numpy as np
from heapq import heappush, heappop
N = int(eval(input()))
A = np.array(input().split(), dtype=np.int32)
a_to_i = {a:i for i,a in enumerate(A)}
# sparse table を使ってRMQ
# parityの同じところだけを見るようにしておく
U = len(A).bit_length()
sp = [None,A]
for i in range... | 49 | 46 | 1,107 | 1,052 | import sys
input = sys.stdin.readline
import numpy as np
from heapq import heappush, heappop
N = int(eval(input()))
A = np.array(input().split(), dtype=np.int32)
a_to_i = {a: i for i, a in enumerate(A)}
# sparse table を使ってRMQ
# parityの同じところだけを見るようにしておく
U = len(A).bit_length()
sp = [None, A]
for i in range(2, U):
... | import sys
input = sys.stdin.readline
import numpy as np
from heapq import heappush, heappop
N = int(eval(input()))
A = np.array(input().split(), dtype=np.int32)
a_to_i = {a: i for i, a in enumerate(A)}
# sparse table を使ってRMQ
# parityの同じところだけを見るようにしておく
U = len(A).bit_length()
sp = [None, A]
for i in range(2, U):
... | false | 6.122449 | [
"- if (y - x) & 1:",
"- y -= 1",
"- x1 = RMQ(x, y)",
"+ x1 = RMQ(x, y - 1)",
"- if x != None:",
"- answer.append(x)",
"- answer.append(y)",
"+ answer.append(x)",
"+ answer.append(y)",
"-print((\" \".join(map(str, answer))))",
"+print((\" \".join(map(str, an... | false | 0.952797 | 0.177049 | 5.381555 | [
"s666870006",
"s152153996"
] |
u814986259 | p02720 | python | s258794398 | s578917248 | 530 | 138 | 62,196 | 12,384 | Accepted | Accepted | 73.96 | N = int(eval(input()))
tmp = [i for i in range(1, 10)]
ans = list(tmp)
for i in range(10):
tmp2 = []
for x in tmp:
k = int(str(x)[-1])
if k != 0:
ans.append(10*x-1 + k)
tmp2.append(10*x-1 + k)
if k != 9:
tmp2.append(10*x+1 + k)
... | import collections
K = int(eval(input()))
q = collections.deque([i for i in range(1, 10)])
count = 0
while(q):
count += 1
x = q.popleft()
if count == K:
print(x)
break
if x % 10 != 0:
q.append(x*10 + (x % 10 - 1))
q.append(x*10 + (x % 10))
if x % 10 != 9:
... | 19 | 16 | 451 | 352 | N = int(eval(input()))
tmp = [i for i in range(1, 10)]
ans = list(tmp)
for i in range(10):
tmp2 = []
for x in tmp:
k = int(str(x)[-1])
if k != 0:
ans.append(10 * x - 1 + k)
tmp2.append(10 * x - 1 + k)
if k != 9:
tmp2.append(10 * x + 1 + k)
... | import collections
K = int(eval(input()))
q = collections.deque([i for i in range(1, 10)])
count = 0
while q:
count += 1
x = q.popleft()
if count == K:
print(x)
break
if x % 10 != 0:
q.append(x * 10 + (x % 10 - 1))
q.append(x * 10 + (x % 10))
if x % 10 != 9:
q.ap... | false | 15.789474 | [
"-N = int(eval(input()))",
"-tmp = [i for i in range(1, 10)]",
"-ans = list(tmp)",
"-for i in range(10):",
"- tmp2 = []",
"- for x in tmp:",
"- k = int(str(x)[-1])",
"- if k != 0:",
"- ans.append(10 * x - 1 + k)",
"- tmp2.append(10 * x - 1 + k)",
"- ... | false | 1.311275 | 0.049215 | 26.64394 | [
"s258794398",
"s578917248"
] |
u930705402 | p02924 | python | s168882305 | s160365704 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | N=int(eval(input()))
print((N*(N-1)//2)) | N=int(eval(input()))
print(((1+N-1)*(N-1)//2)) | 2 | 2 | 33 | 39 | N = int(eval(input()))
print((N * (N - 1) // 2))
| N = int(eval(input()))
print(((1 + N - 1) * (N - 1) // 2))
| false | 0 | [
"-print((N * (N - 1) // 2))",
"+print(((1 + N - 1) * (N - 1) // 2))"
] | false | 0.042847 | 0.042323 | 1.012361 | [
"s168882305",
"s160365704"
] |
u191874006 | p02597 | python | s289838247 | s798369860 | 123 | 68 | 68,404 | 63,188 | Accepted | Accepted | 44.72 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | #!/usr/bin/env python3
n = int(eval(input()))
c = eval(input())
r = c.count('R')
ans = r - c[:r].count('R')
print(ans) | 27 | 6 | 678 | 111 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | #!/usr/bin/env python3
n = int(eval(input()))
c = eval(input())
r = c.count("R")
ans = r - c[:r].count("R")
print(ans)
| false | 77.777778 | [
"-import sys",
"-import math",
"-from bisect import bisect_right as br",
"-from bisect import bisect_left as bl",
"-",
"-sys.setrecursionlimit(2147483647)",
"-from heapq import heappush, heappop, heappushpop",
"-from collections import defaultdict",
"-from itertools import accumulate",
"-from coll... | false | 0.071934 | 0.043064 | 1.670397 | [
"s289838247",
"s798369860"
] |
u186838327 | p03855 | python | s888487555 | s589985068 | 1,551 | 888 | 110,040 | 99,932 | Accepted | Accepted | 42.75 | def Find(x, par):
if par[x] < 0:
return x
else:
# 経路圧縮
par[x] = Find(par[x], par)
return par[x]
def Unite(x, y, par, rank):
x = Find(x, par)
y = Find(y, par)
if x != y:
# rankの低い方を高い方につなげる
if rank[x] < rank[y]:
par[y] += par[x]
par[x] = y
else:
... | import sys
input = sys.stdin.readline
def Find(x, par):
if par[x] < 0:
return x
else:
# 経路圧縮
par[x] = Find(par[x], par)
return par[x]
def Unite(x, y, par, rank):
x = Find(x, par)
y = Find(y, par)
if x != y:
# rankの低い方を高い方につなげる
if rank[x] < rank[y]:
par[y] +... | 66 | 60 | 1,068 | 1,077 | def Find(x, par):
if par[x] < 0:
return x
else:
# 経路圧縮
par[x] = Find(par[x], par)
return par[x]
def Unite(x, y, par, rank):
x = Find(x, par)
y = Find(y, par)
if x != y:
# rankの低い方を高い方につなげる
if rank[x] < rank[y]:
par[y] += par[x]
... | import sys
input = sys.stdin.readline
def Find(x, par):
if par[x] < 0:
return x
else:
# 経路圧縮
par[x] = Find(par[x], par)
return par[x]
def Unite(x, y, par, rank):
x = Find(x, par)
y = Find(y, par)
if x != y:
# rankの低い方を高い方につなげる
if rank[x] < rank[y]... | false | 9.090909 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+"
] | false | 0.042454 | 0.043455 | 0.976969 | [
"s888487555",
"s589985068"
] |
u133936772 | p02646 | python | s786503440 | s293283245 | 23 | 20 | 9,096 | 9,164 | Accepted | Accepted | 13.04 | a,v,b,w,t=list(map(int,open(0).read().split()))
print((['NO','YES'][abs(b-a)<=(v-w)*t])) | a,v,b,w,t=list(map(int,open(0).read().split()))
print(('YNEOS'[abs(b-a)>(v-w)*t::2])) | 2 | 2 | 81 | 78 | a, v, b, w, t = list(map(int, open(0).read().split()))
print((["NO", "YES"][abs(b - a) <= (v - w) * t]))
| a, v, b, w, t = list(map(int, open(0).read().split()))
print(("YNEOS"[abs(b - a) > (v - w) * t :: 2]))
| false | 0 | [
"-print(([\"NO\", \"YES\"][abs(b - a) <= (v - w) * t]))",
"+print((\"YNEOS\"[abs(b - a) > (v - w) * t :: 2]))"
] | false | 0.077784 | 0.10262 | 0.757985 | [
"s786503440",
"s293283245"
] |
u073852194 | p04021 | python | s284966920 | s667771001 | 338 | 255 | 19,880 | 19,876 | Accepted | Accepted | 24.56 | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
D = {a:i for i,a in enumerate(sorted(A))}
A = [D[A[i]] for i in range(N)]
odd = [A[i] for i in range(N) if i%2 == 0]
even = [A[i] for i in range(N) if i%2 == 1]
odd.sort()
even.sort()
B = []
for i in range(N):
if i%2 == 0:
... | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
D = {a:i for i,a in enumerate(sorted(A))}
A = [D[A[i]] for i in range(N)]
count = 0
for i in range(N):
if i%2 == 0 and A[i]%2 != 0:
count += 1
print(count) | 28 | 14 | 477 | 239 | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
D = {a: i for i, a in enumerate(sorted(A))}
A = [D[A[i]] for i in range(N)]
odd = [A[i] for i in range(N) if i % 2 == 0]
even = [A[i] for i in range(N) if i % 2 == 1]
odd.sort()
even.sort()
B = []
for i in range(N):
if i % 2 == 0:
B.append(od... | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
D = {a: i for i, a in enumerate(sorted(A))}
A = [D[A[i]] for i in range(N)]
count = 0
for i in range(N):
if i % 2 == 0 and A[i] % 2 != 0:
count += 1
print(count)
| false | 50 | [
"-odd = [A[i] for i in range(N) if i % 2 == 0]",
"-even = [A[i] for i in range(N) if i % 2 == 1]",
"-odd.sort()",
"-even.sort()",
"-B = []",
"-for i in range(N):",
"- if i % 2 == 0:",
"- B.append(odd[i // 2])",
"- else:",
"- B.append(even[i // 2])",
"- if i % 2 == 0 and B[... | false | 0.047383 | 0.056356 | 0.840772 | [
"s284966920",
"s667771001"
] |
u312025627 | p03818 | python | s362121827 | s248361093 | 249 | 213 | 64,552 | 62,124 | Accepted | Accepted | 14.46 | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
from collections import Counter
c = Counter(A)
mc = c.most_common()
ans = len(mc)
need = 0
for cnt in mc:
if cnt[1] > 1:
need += cnt[1] - 1
print((ans if need % 2 == 0 else ans - 1... | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
from collections import Counter
c = Counter(A)
even = len([v for v in list(c.values()) if v % 2 == 0])
ans = len(list(c.keys()))
if even % 2 == 1:
ans -= 1
print(ans)
if __name__ == '__main__':... | 16 | 14 | 359 | 315 | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
from collections import Counter
c = Counter(A)
mc = c.most_common()
ans = len(mc)
need = 0
for cnt in mc:
if cnt[1] > 1:
need += cnt[1] - 1
print((ans if need % 2 == 0 else ans - 1))
if __... | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
from collections import Counter
c = Counter(A)
even = len([v for v in list(c.values()) if v % 2 == 0])
ans = len(list(c.keys()))
if even % 2 == 1:
ans -= 1
print(ans)
if __name__ == "__main__":
main()... | false | 12.5 | [
"- mc = c.most_common()",
"- ans = len(mc)",
"- need = 0",
"- for cnt in mc:",
"- if cnt[1] > 1:",
"- need += cnt[1] - 1",
"- print((ans if need % 2 == 0 else ans - 1))",
"+ even = len([v for v in list(c.values()) if v % 2 == 0])",
"+ ans = len(list(c.keys()))"... | false | 0.040665 | 0.047499 | 0.856122 | [
"s362121827",
"s248361093"
] |
u326609687 | p02549 | python | s118724353 | s373277049 | 525 | 366 | 109,752 | 24,596 | Accepted | Accepted | 30.29 | import numpy as np
from numba import njit
from numba.types import i8
ni8 = np.int64
MOD = 998244353
@njit((i8[:,::-1], i8[:], i8, i8), cache=True)
def solve(lr, dp, n, k):
acc_dp = np.ones_like(dp)
for i in range(1, n):
val = 0
for j in range(k):
a = i - lr[j, 0]
... | MOD = 998244353
def solve(lr, dp, n):
acc_dp = [1] * n
for i in range(1, n):
val = 0
for d in lr:
a = i - d[0]
if a < 0:
continue
b = i - d[1] - 1
val += acc_dp[a] - (acc_dp[b] if b >= 0 else 0)
dp[i] = val % ... | 33 | 28 | 807 | 638 | import numpy as np
from numba import njit
from numba.types import i8
ni8 = np.int64
MOD = 998244353
@njit((i8[:, ::-1], i8[:], i8, i8), cache=True)
def solve(lr, dp, n, k):
acc_dp = np.ones_like(dp)
for i in range(1, n):
val = 0
for j in range(k):
a = i - lr[j, 0]
if a... | MOD = 998244353
def solve(lr, dp, n):
acc_dp = [1] * n
for i in range(1, n):
val = 0
for d in lr:
a = i - d[0]
if a < 0:
continue
b = i - d[1] - 1
val += acc_dp[a] - (acc_dp[b] if b >= 0 else 0)
dp[i] = val % MOD
a... | false | 15.151515 | [
"-import numpy as np",
"-from numba import njit",
"-from numba.types import i8",
"-",
"-ni8 = np.int64",
"-@njit((i8[:, ::-1], i8[:], i8, i8), cache=True)",
"-def solve(lr, dp, n, k):",
"- acc_dp = np.ones_like(dp)",
"+def solve(lr, dp, n):",
"+ acc_dp = [1] * n",
"- for j in range(... | false | 0.300403 | 0.087104 | 3.448766 | [
"s118724353",
"s373277049"
] |
u638456847 | p02684 | python | s877232599 | s408635821 | 183 | 134 | 34,228 | 32,416 | Accepted | Accepted | 26.78 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N,K = list(map(int, readline().split()))
A = [int(i) for i in readline().split()]
d = [0] * (N+1)
d[1] = 1
now = 1
next_ = A[0]
c = [0] * (N+1)
cnt = 0
while d[... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N,K = list(map(int, readline().split()))
A = [int(i) - 1 for i in readline().split()]
p = 0
route = []
seen = set()
while True:
route.append(p)
seen.add(p)
... | 36 | 33 | 688 | 666 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N, K = list(map(int, readline().split()))
A = [int(i) for i in readline().split()]
d = [0] * (N + 1)
d[1] = 1
now = 1
next_ = A[0]
c = [0] * (N + 1)
cnt = 0
while d[next_] ==... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N, K = list(map(int, readline().split()))
A = [int(i) - 1 for i in readline().split()]
p = 0
route = []
seen = set()
while True:
route.append(p)
seen.add(p)
p = A... | false | 8.333333 | [
"- A = [int(i) for i in readline().split()]",
"- d = [0] * (N + 1)",
"- d[1] = 1",
"- now = 1",
"- next_ = A[0]",
"- c = [0] * (N + 1)",
"- cnt = 0",
"- while d[next_] == 0:",
"- d[next_] = d[now] + 1",
"- now = next_",
"- next_ = A[next_ - 1]",
"- ... | false | 0.076943 | 0.03685 | 2.088014 | [
"s877232599",
"s408635821"
] |
u730769327 | p03111 | python | s476682972 | s475963836 | 164 | 99 | 74,148 | 68,604 | Accepted | Accepted | 39.63 | import bisect
INF=10**18
n,*a=list(map(int,input().split()))
l=[int(eval(input())) for _ in range(n)]
ans=INF
for i in range(4**n):
x=[[] for _ in range(3)]
for j in range(n):
if (i>>2*j)&1 and not (i>>2*j+1)&1:x[0].append(l[j])
if not (i>>2*j)&1 and (i>>2*j+1)&1:x[1].append(l[j])
if (i>>2*j)&... | n,a,b,c=list(map(int,input().split()))
l=[int(eval(input())) for _ in range(n)]
ans=10**18
for i in range(4**n):
la,lb,lc,ca,cb,cc=0,0,0,0,0,0
for j in range(n):
if (i>>2*j)&1 and not (i>>2*j+1)&1:
ca+=1
la+=l[j]
if not (i>>2*j)&1 and (i>>2*j+1)&1:
cb+=1
lb+=l[j]
if (... | 17 | 17 | 483 | 450 | import bisect
INF = 10**18
n, *a = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
ans = INF
for i in range(4**n):
x = [[] for _ in range(3)]
for j in range(n):
if (i >> 2 * j) & 1 and not (i >> 2 * j + 1) & 1:
x[0].append(l[j])
if not (i >> 2 * j) & 1 and... | n, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
ans = 10**18
for i in range(4**n):
la, lb, lc, ca, cb, cc = 0, 0, 0, 0, 0, 0
for j in range(n):
if (i >> 2 * j) & 1 and not (i >> 2 * j + 1) & 1:
ca += 1
la += l[j]
if not (i >> 2 * j)... | false | 0 | [
"-import bisect",
"-",
"-INF = 10**18",
"-n, *a = list(map(int, input().split()))",
"+n, a, b, c = list(map(int, input().split()))",
"-ans = INF",
"+ans = 10**18",
"- x = [[] for _ in range(3)]",
"+ la, lb, lc, ca, cb, cc = 0, 0, 0, 0, 0, 0",
"- x[0].append(l[j])",
"+ ... | false | 0.422703 | 0.545733 | 0.774559 | [
"s476682972",
"s475963836"
] |
u554954744 | p02793 | python | s133836205 | s184645889 | 899 | 362 | 67,560 | 44,508 | Accepted | Accepted | 59.73 | from functools import reduce
from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7
lcm = reduce(lambda x,y: x*(y//gcd(x,y)), A)
lcm %= MOD
coef = sum(pow(a, MOD-2, MOD) for a in A)
ans = lcm * coef % MOD
print(ans) | N = int(eval(input()))
A = list(map(int, input().split()))
from collections import defaultdict
MOD = 10**9 + 7
primes = defaultdict(int)
for a in A:
p = 2
while p * p <= a:
if a % p == 0:
cnt = 0
while a % p == 0:
cnt += 1
a //=... | 15 | 33 | 278 | 621 | from functools import reduce
from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
lcm = reduce(lambda x, y: x * (y // gcd(x, y)), A)
lcm %= MOD
coef = sum(pow(a, MOD - 2, MOD) for a in A)
ans = lcm * coef % MOD
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
from collections import defaultdict
MOD = 10**9 + 7
primes = defaultdict(int)
for a in A:
p = 2
while p * p <= a:
if a % p == 0:
cnt = 0
while a % p == 0:
cnt += 1
a //= p
prim... | false | 54.545455 | [
"-from functools import reduce",
"-from fractions import gcd",
"-",
"+from collections import defaultdict",
"+",
"-lcm = reduce(lambda x, y: x * (y // gcd(x, y)), A)",
"-lcm %= MOD",
"-coef = sum(pow(a, MOD - 2, MOD) for a in A)",
"-ans = lcm * coef % MOD",
"+primes = defaultdict(int)",
"+for a ... | false | 0.107393 | 0.036258 | 2.961869 | [
"s133836205",
"s184645889"
] |
u413165887 | p03420 | python | s780330834 | s583437630 | 116 | 88 | 3,060 | 2,940 | Accepted | Accepted | 24.14 | n, k = list(map(int, input().split(' ')))
result = 0
for i in range(1, n+1):
p = n//i
result += p*max(0,i-k)
result += max(0, n%i-k+1)
if k == 0:
result -= 1
print(result) | def main():
n, k = list(map(int, input().split(' ')))
result = 0
for i in range(1, n+1):
p = n//i
result += p*max(0,i-k)
result += max(0, n%i-k+1)
if k == 0:
result -= 1
print(result)
main() | 9 | 11 | 197 | 254 | n, k = list(map(int, input().split(" ")))
result = 0
for i in range(1, n + 1):
p = n // i
result += p * max(0, i - k)
result += max(0, n % i - k + 1)
if k == 0:
result -= 1
print(result)
| def main():
n, k = list(map(int, input().split(" ")))
result = 0
for i in range(1, n + 1):
p = n // i
result += p * max(0, i - k)
result += max(0, n % i - k + 1)
if k == 0:
result -= 1
print(result)
main()
| false | 18.181818 | [
"-n, k = list(map(int, input().split(\" \")))",
"-result = 0",
"-for i in range(1, n + 1):",
"- p = n // i",
"- result += p * max(0, i - k)",
"- result += max(0, n % i - k + 1)",
"- if k == 0:",
"- result -= 1",
"-print(result)",
"+def main():",
"+ n, k = list(map(int, inpu... | false | 0.077555 | 0.045294 | 1.712261 | [
"s780330834",
"s583437630"
] |
u428747123 | p03494 | python | s837253546 | s561966708 | 188 | 19 | 38,512 | 3,060 | Accepted | Accepted | 89.89 | N = int(eval(input()))
A = [int(i) for i in input().split()]
ans = [0]*N
for i in range(N):
while A[i] % 2 == 0:
A[i] //= 2
ans[i] += 1
print((min(ans)))
| eval(input())
A = list(map(int, input().split()))
count = 0
while all(a % 2 == 0 for a in A):
A = [a/2 for a in A]
count += 1
print(count) | 8 | 7 | 173 | 146 | N = int(eval(input()))
A = [int(i) for i in input().split()]
ans = [0] * N
for i in range(N):
while A[i] % 2 == 0:
A[i] //= 2
ans[i] += 1
print((min(ans)))
| eval(input())
A = list(map(int, input().split()))
count = 0
while all(a % 2 == 0 for a in A):
A = [a / 2 for a in A]
count += 1
print(count)
| false | 12.5 | [
"-N = int(eval(input()))",
"-A = [int(i) for i in input().split()]",
"-ans = [0] * N",
"-for i in range(N):",
"- while A[i] % 2 == 0:",
"- A[i] //= 2",
"- ans[i] += 1",
"-print((min(ans)))",
"+eval(input())",
"+A = list(map(int, input().split()))",
"+count = 0",
"+while all(a ... | false | 0.120786 | 0.041117 | 2.937607 | [
"s837253546",
"s561966708"
] |
u034128150 | p03112 | python | s605309751 | s810420974 | 1,154 | 512 | 104,936 | 93,696 | Accepted | Accepted | 55.63 | import bisect
left_sentinel = -2 * (10 ** 10)
right_sentinel = 3 * (10 ** 10)
A, B, Q = list(map(int, input().split()))
ss = [left_sentinel] + [int(eval(input())) for _ in range(A)] + [right_sentinel]
ts = [left_sentinel] + [int(eval(input())) for _ in range(B)] + [right_sentinel]
for _ in range(Q):
x ... | import sys
from bisect import *
input = sys.stdin.buffer.readline
INF = 10 ** 13
A, B, Q = list(map(int, input().split()))
shrines = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]
temples = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]
queries = [int(eval(input())) for _ in range(Q)]
fo... | 25 | 26 | 742 | 720 | import bisect
left_sentinel = -2 * (10**10)
right_sentinel = 3 * (10**10)
A, B, Q = list(map(int, input().split()))
ss = [left_sentinel] + [int(eval(input())) for _ in range(A)] + [right_sentinel]
ts = [left_sentinel] + [int(eval(input())) for _ in range(B)] + [right_sentinel]
for _ in range(Q):
x = int(eval(input... | import sys
from bisect import *
input = sys.stdin.buffer.readline
INF = 10**13
A, B, Q = list(map(int, input().split()))
shrines = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]
temples = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]
queries = [int(eval(input())) for _ in range(Q)]
for x in queries:... | false | 3.846154 | [
"-import bisect",
"+import sys",
"+from bisect import *",
"-left_sentinel = -2 * (10**10)",
"-right_sentinel = 3 * (10**10)",
"+input = sys.stdin.buffer.readline",
"+INF = 10**13",
"-ss = [left_sentinel] + [int(eval(input())) for _ in range(A)] + [right_sentinel]",
"-ts = [left_sentinel] + [int(eval... | false | 0.042719 | 0.04193 | 1.018824 | [
"s605309751",
"s810420974"
] |
u623819879 | p03330 | python | s928300360 | s931680760 | 376 | 341 | 47,836 | 44,888 | Accepted | Accepted | 9.31 | import sys
sys.setrecursionlimit(1000000)
#def input():
# return sys.stdin.readline()[:-1]
'''
n=int(input())
for i in range(n):
a[i]=int(input())
a[i],b[i]=map(int,input().split())
a=[int(x) for x in input().split()]
n,m=map(int,input.split())
from operator import itemgetter
a = [(1, "c", 1), ... | from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from functools import *
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def Golf():
*a,=map(int,open(0))
def... | 111 | 129 | 2,944 | 3,245 | import sys
sys.setrecursionlimit(1000000)
# def input():
# return sys.stdin.readline()[:-1]
"""
n=int(input())
for i in range(n):
a[i]=int(input())
a[i],b[i]=map(int,input().split())
a=[int(x) for x in input().split()]
n,m=map(int,input.split())
from operator import itemgetter
a = [(1, "c", 1), (1, "b", 3),... | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from functools import *
from itertools import permutations, combinations, groupby
import sys
import bisect
import string
import math
import time
import random
def Golf():
(*a,) = map(int, open(0))
d... | false | 13.953488 | [
"+from heapq import heappush, heappop, heapify",
"+from collections import deque, defaultdict, Counter",
"+import itertools",
"+from functools import *",
"+from itertools import permutations, combinations, groupby",
"-",
"-sys.setrecursionlimit(1000000)",
"-# def input():",
"-# return sys.stdin.r... | false | 0.040331 | 0.045573 | 0.884975 | [
"s928300360",
"s931680760"
] |
u761529120 | p03503 | python | s303294422 | s016058744 | 225 | 116 | 42,732 | 74,096 | Accepted | Accepted | 48.44 | N = int(eval(input()))
F = [[int(i) for i in input().split()] for i in range(N)]
P = [[int(i) for i in input().split()] for i in range(N)]
ans = - 10 ** 16
for i in range(1 << 10):
output = [0] * 10
for j in range(10):
if (i>>j) & 1:
output[j] = 1
if output.count(0) == 10:
... | def main():
N = int(eval(input()))
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
ans = -(10**15)
for i in range(2**10):
tmp = []
for j in range(10):
if ((i >> j) & 1):
tmp.append(j)... | 22 | 25 | 557 | 658 | N = int(eval(input()))
F = [[int(i) for i in input().split()] for i in range(N)]
P = [[int(i) for i in input().split()] for i in range(N)]
ans = -(10**16)
for i in range(1 << 10):
output = [0] * 10
for j in range(10):
if (i >> j) & 1:
output[j] = 1
if output.count(0) == 10:
conti... | def main():
N = int(eval(input()))
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
ans = -(10**15)
for i in range(2**10):
tmp = []
for j in range(10):
if (i >> j) & 1:
tmp.append(j)
if... | false | 12 | [
"-N = int(eval(input()))",
"-F = [[int(i) for i in input().split()] for i in range(N)]",
"-P = [[int(i) for i in input().split()] for i in range(N)]",
"-ans = -(10**16)",
"-for i in range(1 << 10):",
"- output = [0] * 10",
"- for j in range(10):",
"- if (i >> j) & 1:",
"- out... | false | 0.099808 | 0.049268 | 2.025827 | [
"s303294422",
"s016058744"
] |
u046187684 | p02948 | python | s444278687 | s261896064 | 409 | 308 | 25,832 | 33,848 | Accepted | Accepted | 24.69 | import heapq
def solve(string):
n, m, *ab = list(map(int, string.split()))
ab = sorted([(a, b) for a, b in zip(*[iter(ab)] * 2)])
hq, index, cap, count, ans = [], 0, 1, m, 0
while index < n:
_a, _b = ab[index]
if _a > m:
break
if _a <= cap:
h... | from heapq import heappop, heappush
from collections import defaultdict
def solve(string):
n, m, *ab = list(map(int, string.split()))
dd = defaultdict(list)
for a, b in zip(*[iter(ab)] * 2):
dd[a].append(-b)
hq, ans = [], 0
for d in range(1, m + 1):
if d in dd:
... | 25 | 22 | 733 | 592 | import heapq
def solve(string):
n, m, *ab = list(map(int, string.split()))
ab = sorted([(a, b) for a, b in zip(*[iter(ab)] * 2)])
hq, index, cap, count, ans = [], 0, 1, m, 0
while index < n:
_a, _b = ab[index]
if _a > m:
break
if _a <= cap:
heapq.heappus... | from heapq import heappop, heappush
from collections import defaultdict
def solve(string):
n, m, *ab = list(map(int, string.split()))
dd = defaultdict(list)
for a, b in zip(*[iter(ab)] * 2):
dd[a].append(-b)
hq, ans = [], 0
for d in range(1, m + 1):
if d in dd:
for _b i... | false | 12 | [
"-import heapq",
"+from heapq import heappop, heappush",
"+from collections import defaultdict",
"- ab = sorted([(a, b) for a, b in zip(*[iter(ab)] * 2)])",
"- hq, index, cap, count, ans = [], 0, 1, m, 0",
"- while index < n:",
"- _a, _b = ab[index]",
"- if _a > m:",
"- ... | false | 0.126824 | 0.072533 | 1.7485 | [
"s444278687",
"s261896064"
] |
u227082700 | p03112 | python | s544174276 | s063184497 | 1,733 | 1,117 | 12,804 | 16,132 | Accepted | Accepted | 35.55 | from bisect import bisect_left,bisect_right
a,b,q=list(map(int,input().split()))
s=[-(10**21)]+[int(eval(input()))for _ in range(a)]+[10**21]
t=[-(10**21)]+[int(eval(input()))for _ in range(b)]+[10**21]
for _ in range(q):
x=int(eval(input()))
s1,s2=s[bisect_right(s,x)-1],s[bisect_right(s,x)]
t1,t2=t[bisect... | a,b,q=list(map(int,input().split()))
s=[-10**30]+[int(eval(input()))for _ in range(a)]+[10**30]
t=[-10**30]+[int(eval(input()))for _ in range(b)]+[10**30]
x=[int(eval(input()))for _ in range(q)]
from bisect import bisect_left,bisect_right
for xx in x:
s1=s[bisect_right(s,xx)-1]
s2=s[bisect_right(s,xx)]
t1... | 13 | 16 | 455 | 589 | from bisect import bisect_left, bisect_right
a, b, q = list(map(int, input().split()))
s = [-(10**21)] + [int(eval(input())) for _ in range(a)] + [10**21]
t = [-(10**21)] + [int(eval(input())) for _ in range(b)] + [10**21]
for _ in range(q):
x = int(eval(input()))
s1, s2 = s[bisect_right(s, x) - 1], s[bisect_r... | a, b, q = list(map(int, input().split()))
s = [-(10**30)] + [int(eval(input())) for _ in range(a)] + [10**30]
t = [-(10**30)] + [int(eval(input())) for _ in range(b)] + [10**30]
x = [int(eval(input())) for _ in range(q)]
from bisect import bisect_left, bisect_right
for xx in x:
s1 = s[bisect_right(s, xx) - 1]
... | false | 18.75 | [
"+a, b, q = list(map(int, input().split()))",
"+s = [-(10**30)] + [int(eval(input())) for _ in range(a)] + [10**30]",
"+t = [-(10**30)] + [int(eval(input())) for _ in range(b)] + [10**30]",
"+x = [int(eval(input())) for _ in range(q)]",
"-a, b, q = list(map(int, input().split()))",
"-s = [-(10**21)] + [in... | false | 0.037762 | 0.038049 | 0.99246 | [
"s544174276",
"s063184497"
] |
u157232135 | p02623 | python | s588570860 | s153842248 | 303 | 274 | 47,464 | 48,768 | Accepted | Accepted | 9.57 | N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
a.append(a[i] + A[i])
for i in range(M):
b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
if a[i] > K:
break
while b[j] >... | import itertools as it
def main():
n,m,k=list(map(int,input().split()))
Aa = list(map(int,input().split()))
Bb = list(map(int, input().split()))
a, b = [0],[0]
for i in range(n):
a.append(a[i] + Aa[i])
for i in range(m):
b.append(b[i] + Bb[i])
M = m
ans = 0
... | 18 | 26 | 380 | 619 | N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
a.append(a[i] + A[i])
for i in range(M):
b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
if a[i] > K:
break
while b[j] > K - a[i]:
... | import itertools as it
def main():
n, m, k = list(map(int, input().split()))
Aa = list(map(int, input().split()))
Bb = list(map(int, input().split()))
a, b = [0], [0]
for i in range(n):
a.append(a[i] + Aa[i])
for i in range(m):
b.append(b[i] + Bb[i])
M = m
ans = 0
f... | false | 30.769231 | [
"-N, M, K = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-B = list(map(int, input().split()))",
"-a, b = [0], [0]",
"-for i in range(N):",
"- a.append(a[i] + A[i])",
"-for i in range(M):",
"- b.append(b[i] + B[i])",
"-ans, j = 0, M",
"-for i in range(N + 1):",
... | false | 0.110962 | 0.034061 | 3.257754 | [
"s588570860",
"s153842248"
] |
u054514819 | p02762 | python | s871441659 | s138593359 | 1,313 | 339 | 43,736 | 84,540 | Accepted | Accepted | 74.18 | N, M, K = list(map(int, input().split()))
block_list = [[i] for i in range(N)]
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(... | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N, M, K = mapint()
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents... | 50 | 68 | 1,300 | 1,620 | N, M, K = list(map(int, input().split()))
block_list = [[i] for i in range(N)]
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[... | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N, M, K = mapint()
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[... | false | 26.470588 | [
"-N, M, K = list(map(int, input().split()))",
"-block_list = [[i] for i in range(N)]",
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",
"+def mapint():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+sys.setrecursionlimit(10**9)",... | false | 0.074659 | 0.104125 | 0.717009 | [
"s871441659",
"s138593359"
] |
u030879708 | p02628 | python | s095171460 | s031881264 | 30 | 27 | 9,128 | 9,116 | Accepted | Accepted | 10 | l=list(map(int,open(0).read().split()));print((sum(sorted(l[2:])[:l[1]]))) | a,b,*l=list(map(int,open(0).read().split()));print((sum(sorted(l)[:b]))) | 1 | 1 | 72 | 70 | l = list(map(int, open(0).read().split()))
print((sum(sorted(l[2:])[: l[1]])))
| a, b, *l = list(map(int, open(0).read().split()))
print((sum(sorted(l)[:b])))
| false | 0 | [
"-l = list(map(int, open(0).read().split()))",
"-print((sum(sorted(l[2:])[: l[1]])))",
"+a, b, *l = list(map(int, open(0).read().split()))",
"+print((sum(sorted(l)[:b])))"
] | false | 0.040334 | 0.041011 | 0.98349 | [
"s095171460",
"s031881264"
] |
u861466636 | p03108 | python | s041137312 | s247882702 | 555 | 407 | 25,504 | 26,068 | Accepted | Accepted | 26.67 | N, M = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(M)]
class UnionFind:
def __init__(self, size):
self.rank = [-1]*(size+1)
self.number = [1]*(size+1)
def find(self, x):
while self.rank[x] >= 0:
x = self.rank[x]
... | import sys
readline = sys.stdin.readline
N, M = map(int, input().split())
ab = [tuple(map(int, readline().split())) for _ in range(M)]
class UnionFind:
def __init__(self, size):
self.rank = [-1]*(size+1)
self.number = [1]*(size+1)
def find(self, x):
while self.rank... | 41 | 44 | 1,043 | 1,091 | N, M = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(M)]
class UnionFind:
def __init__(self, size):
self.rank = [-1] * (size + 1)
self.number = [1] * (size + 1)
def find(self, x):
while self.rank[x] >= 0:
x = self.rank[x]
return x
... | import sys
readline = sys.stdin.readline
N, M = map(int, input().split())
ab = [tuple(map(int, readline().split())) for _ in range(M)]
class UnionFind:
def __init__(self, size):
self.rank = [-1] * (size + 1)
self.number = [1] * (size + 1)
def find(self, x):
while self.rank[x] >= 0:
... | false | 6.818182 | [
"+import sys",
"+",
"+readline = sys.stdin.readline",
"-ab = [tuple(map(int, input().split())) for _ in range(M)]",
"+ab = [tuple(map(int, readline().split())) for _ in range(M)]",
"-for a, b in ab[::-1]:",
"+for a, b in ab[1:][::-1]:",
"-print(*ans[::-1][1:], sep=\"\\n\")",
"+print(*ans[::-1], sep=... | false | 0.188008 | 0.106458 | 1.766034 | [
"s041137312",
"s247882702"
] |
u806257533 | p03478 | python | s081553649 | s950295442 | 34 | 29 | 3,060 | 3,060 | Accepted | Accepted | 14.71 | in_all = list(map(int, input().split()))
total = 0
for n in range(1, in_all[0]+1):
tmp = str(n)
all = 0
for t in tmp:
all += int(t)
if all>=in_all[1] and all<=in_all[2]:
total += int(tmp)
print(total) | in_all = list(map(int, input().split()))
total = 0
for n in range(1, in_all[0]+1):
all = 0
tmp = n
while tmp!=0:
all += tmp%10
tmp = tmp//10
if all>=in_all[1] and all<=in_all[2]:
total += n
print(total) | 12 | 13 | 245 | 256 | in_all = list(map(int, input().split()))
total = 0
for n in range(1, in_all[0] + 1):
tmp = str(n)
all = 0
for t in tmp:
all += int(t)
if all >= in_all[1] and all <= in_all[2]:
total += int(tmp)
print(total)
| in_all = list(map(int, input().split()))
total = 0
for n in range(1, in_all[0] + 1):
all = 0
tmp = n
while tmp != 0:
all += tmp % 10
tmp = tmp // 10
if all >= in_all[1] and all <= in_all[2]:
total += n
print(total)
| false | 7.692308 | [
"- tmp = str(n)",
"- for t in tmp:",
"- all += int(t)",
"+ tmp = n",
"+ while tmp != 0:",
"+ all += tmp % 10",
"+ tmp = tmp // 10",
"- total += int(tmp)",
"+ total += n"
] | false | 0.037605 | 0.038531 | 0.975973 | [
"s081553649",
"s950295442"
] |
u207097826 | p02537 | python | s105053863 | s948262458 | 738 | 674 | 121,876 | 128,372 | Accepted | Accepted | 8.67 |
#参考https://qiita.com/takayg1/items/c811bd07c21923d7ec69
#####segfunc#####
def segfunc(x, y):
return max(x,y)
#################
#####ide_ele初期値#####
ide_ele = 0
#################
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)
query... | #参考https://qiita.com/takayg1/items/c811bd07c21923d7ec69
#####segfunc#####
def segfunc(x, y):
return max(x,y)
#################
#####ide_ele初期値#####
ide_ele = 0
#################
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)
query(l... | 85 | 83 | 2,178 | 2,147 | # 参考https://qiita.com/takayg1/items/c811bd07c21923d7ec69
#####segfunc#####
def segfunc(x, y):
return max(x, y)
#################
#####ide_ele初期値#####
ide_ele = 0
#################
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)
query(l, r): 区間[l, r)... | # 参考https://qiita.com/takayg1/items/c811bd07c21923d7ec69
#####segfunc#####
def segfunc(x, y):
return max(x, y)
#################
#####ide_ele初期値#####
ide_ele = 0
#################
class SegTree:
"""
init(init_val, ide_ele): 配列init_valで初期化 O(N)
update(k, x): k番目の値をxに更新 O(logN)
query(l, r): 区間[l, r)... | false | 2.352941 | [
"- if answer < now + 1:",
"- answer = now + 1",
"-print(answer)",
"+print((seg.query(0, 300001)))"
] | false | 0.649361 | 0.671589 | 0.966902 | [
"s105053863",
"s948262458"
] |
u789436713 | p02765 | python | s176331994 | s623638737 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | [N,R]=[int(item)for item in input().split()]
print((R if N>=10 else R+100*(10-N))) | [N,R]=[int(item)for item in input().split()]
print((max(R, R+100*(10-N)))) | 2 | 2 | 81 | 73 | [N, R] = [int(item) for item in input().split()]
print((R if N >= 10 else R + 100 * (10 - N)))
| [N, R] = [int(item) for item in input().split()]
print((max(R, R + 100 * (10 - N))))
| false | 0 | [
"-print((R if N >= 10 else R + 100 * (10 - N)))",
"+print((max(R, R + 100 * (10 - N))))"
] | false | 0.042195 | 0.041896 | 1.007142 | [
"s176331994",
"s623638737"
] |
u627600101 | p02787 | python | s848487070 | s001052322 | 274 | 46 | 18,736 | 18,716 | Accepted | Accepted | 83.21 | import sys
sys.setrecursionlimit(10**9)
H, N = list(map(int, input().split()))
magic = [_ for _ in range(N)]
for k in range(N):
magic[k] = list(map(int, input().split()))
magic[k].append(magic[k][0]/magic[k][1])
magic.sort(key = lambda x: x[2], reverse=True)
ans = [0 for _ in range(H+1)]
visited = [0... | import sys
sys.setrecursionlimit(10**9)
H, N = list(map(int, input().split()))
magic = [_ for _ in range(N)]
for k in range(N):
magic[k] = list(map(int, input().split()))
magic[k].append(magic[k][0]/magic[k][1])
magic.sort(key = lambda x: x[2], reverse=True)
ans = [0 for _ in range(H+1)]
visited = [0... | 36 | 36 | 883 | 885 | import sys
sys.setrecursionlimit(10**9)
H, N = list(map(int, input().split()))
magic = [_ for _ in range(N)]
for k in range(N):
magic[k] = list(map(int, input().split()))
magic[k].append(magic[k][0] / magic[k][1])
magic.sort(key=lambda x: x[2], reverse=True)
ans = [0 for _ in range(H + 1)]
visited = [0]
anskou... | import sys
sys.setrecursionlimit(10**9)
H, N = list(map(int, input().split()))
magic = [_ for _ in range(N)]
for k in range(N):
magic[k] = list(map(int, input().split()))
magic[k].append(magic[k][0] / magic[k][1])
magic.sort(key=lambda x: x[2], reverse=True)
ans = [0 for _ in range(H + 1)]
visited = [0]
anskou... | false | 0 | [
"- visited.sort(reverse=True)",
"+ # visited.sort(reverse=True)",
"- visited.sort(reverse=True)",
"+ # visited.sort(reverse=True)"
] | false | 0.082438 | 0.03996 | 2.063023 | [
"s848487070",
"s001052322"
] |
u497596438 | p03326 | python | s797919629 | s419637397 | 221 | 33 | 40,304 | 3,288 | Accepted | Accepted | 85.07 | N,M=list(map(int,input().split()))
xyz=[list(map(int,input().split()))for i in range(N)]
ans=0
for i in range(8):
i=bin(i)[2:].zfill(3)
k=[]
for j in range(3):
if i[j]=="0":
k.append(1)
else:
k.append(-1)
l=[k[0]*x+k[1]*y+k[2]*z for x,y,z in xyz]
l... | N,M=list(map(int,input().split()))
xyz=[]
for i in range(N):
x,y,z=list(map(int,input().split()))
xyz.append([x,y,z])
ans=0
for k in range(8):
A=[k>>2 &1,k>>1 &1,k>>0 &1]
l=[]
for i in range(N):
t=0
for j in range(3):
if A[j]==0:
t+=xyz[i][j]
... | 15 | 20 | 375 | 445 | N, M = list(map(int, input().split()))
xyz = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(8):
i = bin(i)[2:].zfill(3)
k = []
for j in range(3):
if i[j] == "0":
k.append(1)
else:
k.append(-1)
l = [k[0] * x + k[1] * y + k[2] * z for x, ... | N, M = list(map(int, input().split()))
xyz = []
for i in range(N):
x, y, z = list(map(int, input().split()))
xyz.append([x, y, z])
ans = 0
for k in range(8):
A = [k >> 2 & 1, k >> 1 & 1, k >> 0 & 1]
l = []
for i in range(N):
t = 0
for j in range(3):
if A[j] == 0:
... | false | 25 | [
"-xyz = [list(map(int, input().split())) for i in range(N)]",
"+xyz = []",
"+for i in range(N):",
"+ x, y, z = list(map(int, input().split()))",
"+ xyz.append([x, y, z])",
"-for i in range(8):",
"- i = bin(i)[2:].zfill(3)",
"- k = []",
"- for j in range(3):",
"- if i[j] == \"... | false | 0.007734 | 0.054656 | 0.141497 | [
"s797919629",
"s419637397"
] |
u271934630 | p03160 | python | s838439596 | s067237208 | 239 | 142 | 52,208 | 13,592 | Accepted | Accepted | 40.59 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2, n):
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print((dp[-1]))
| import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [0 for _ in range(N)]
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
one = abs(h[i]-h[i-1])+dp[i-1]
two = abs(h[i]-h[i-2])+dp[i-2]
dp[i] = min(one, two)
p... | 8 | 17 | 210 | 327 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(eval(input()))
h = list(map(int, input().split()))
dp = [0 for _ in range(N)]
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
one = abs(h[i] - h[i - 1]) + dp[i - 1]
two = abs(h[i] - h[i - 2]) + dp[i - 2]
dp[i] = min(one, two)
print((... | false | 52.941176 | [
"-n = int(eval(input()))",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**7)",
"+N = int(eval(input()))",
"-dp = [0] * n",
"-dp[0] = 0",
"+dp = [0 for _ in range(N)]",
"-for i in range(2, n):",
"- dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[... | false | 0.101626 | 0.043838 | 2.318247 | [
"s838439596",
"s067237208"
] |
u094191970 | p02803 | python | s260310506 | s404444314 | 549 | 452 | 3,572 | 3,436 | Accepted | Accepted | 17.67 | from collections import deque
import copy
h,w=list(map(int,input().split()))
ss=[list(eval(input())) for i in range(h)]
ans=0
for hh in range(h):
for ww in range(w):
dist=[[-1]*(w+1) for i in range(h+1)]
c=copy.deepcopy(ss)
xx=c[hh][ww]
if xx=='#':
continue
dist[hh][ww]=0
dq=deque()
... | from collections import deque
import copy
def BFS(sy,sx,xy_list):
dist=[[-1]*w for i in range(h)]
dist[sy][sx]=0
xy_list[sy][sx]='#'
dq=deque()
dq.append((sy,sx))
while dq:
y,x=dq.popleft()
for dy,dx in [[1,0],[-1,0],[0,1],[0,-1]]:
ny=y+dy
nx=x+dx
if 0<=ny<h and 0<=nx<w and xy_list... | 31 | 37 | 630 | 697 | from collections import deque
import copy
h, w = list(map(int, input().split()))
ss = [list(eval(input())) for i in range(h)]
ans = 0
for hh in range(h):
for ww in range(w):
dist = [[-1] * (w + 1) for i in range(h + 1)]
c = copy.deepcopy(ss)
xx = c[hh][ww]
if xx == "#":
... | from collections import deque
import copy
def BFS(sy, sx, xy_list):
dist = [[-1] * w for i in range(h)]
dist[sy][sx] = 0
xy_list[sy][sx] = "#"
dq = deque()
dq.append((sy, sx))
while dq:
y, x = dq.popleft()
for dy, dx in [[1, 0], [-1, 0], [0, 1], [0, -1]]:
ny = y + d... | false | 16.216216 | [
"+",
"+def BFS(sy, sx, xy_list):",
"+ dist = [[-1] * w for i in range(h)]",
"+ dist[sy][sx] = 0",
"+ xy_list[sy][sx] = \"#\"",
"+ dq = deque()",
"+ dq.append((sy, sx))",
"+ while dq:",
"+ y, x = dq.popleft()",
"+ for dy, dx in [[1, 0], [-1, 0], [0, 1], [0, -1]]:",
... | false | 0.114083 | 0.118278 | 0.964534 | [
"s260310506",
"s404444314"
] |
u179169725 | p02862 | python | s459795556 | s670624378 | 660 | 124 | 82,452 | 3,064 | Accepted | Accepted | 81.21 | # 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_matrix(H):
'''
H is number of rows
'''
return [list(map(int, read().split())) for _ in range(H)]
def ... | # 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_matrix(H):
'''
H is number of rows
'''
return [list(map(int, read().split())) for _ in range(H)]
def ... | 76 | 79 | 1,537 | 1,567 | # 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_matrix(H):
"""
H is number of rows
"""
return [list(map(int, read().split())) for _ in range(H)]
def read_map(H):
""... | # 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_matrix(H):
"""
H is number of rows
"""
return [list(map(int, read().split())) for _ in range(H)]
def read_map(H):
""... | false | 3.797468 | [
"-if (X + Y) % 3 != 0: # !=0",
"+if (X + Y) % 3 != 0 or Y / X > 2 or Y / X < 1 / 2: # !=0",
"-x, y = int((X + Y) * 2 / 3), (X + Y) / 3",
"+x = ((X + Y) * 2) // 3",
"-if pascal_k > pascal_depth / 2:",
"- pascal_k = pascal_depth - pascal_k",
"-def cmb(n, r, mod):",
"- if r < 0 or r > n:",
"- ... | false | 0.211233 | 0.082375 | 2.564271 | [
"s459795556",
"s670624378"
] |
u796942881 | p02681 | python | s264352669 | s877562819 | 23 | 21 | 8,964 | 9,020 | Accepted | Accepted | 8.7 | def main():
S = eval(input())
T = eval(input())
print(("Yes" if S == T[: len(S)] else "No"))
return
main()
| def main():
S = eval(input())
T = eval(input())
print(("Yes" if S == T[: -1] else "No"))
return
main()
| 8 | 8 | 118 | 114 | def main():
S = eval(input())
T = eval(input())
print(("Yes" if S == T[: len(S)] else "No"))
return
main()
| def main():
S = eval(input())
T = eval(input())
print(("Yes" if S == T[:-1] else "No"))
return
main()
| false | 0 | [
"- print((\"Yes\" if S == T[: len(S)] else \"No\"))",
"+ print((\"Yes\" if S == T[:-1] else \"No\"))"
] | false | 0.100802 | 0.038331 | 2.629786 | [
"s264352669",
"s877562819"
] |
u036514535 | p02691 | python | s668995646 | s501770533 | 979 | 369 | 78,492 | 67,688 | Accepted | Accepted | 62.31 | N = int(eval(input()))
A = list(map(int, input().split()))
A1 = [[-a-i,i] for i, a in enumerate(A)]
A2 = [[a-i,i] for i, a in enumerate(A)]
A1.sort()
A2.sort()
i = j = 0
cnt = 0
while i < N and j < N:
if A1[i][0] == A2[j][0]:
buf1 = 1
for k in range(i+1, N):
if A1[k][0] != A1... | N = int(eval(input()))
A = list(map(int, input().split()))
A1, A2 = {}, {}
for i, a in enumerate(A):
key1 = str(-a-i)
if key1 in A1:
A1[key1] = (key1 in A1) * A1[key1] + 1
else:
A1[key1] = 1
key2 = str(a-i)
if key2 in A2:
A2[key2] += 1
else:
A2[key2... | 28 | 22 | 655 | 427 | N = int(eval(input()))
A = list(map(int, input().split()))
A1 = [[-a - i, i] for i, a in enumerate(A)]
A2 = [[a - i, i] for i, a in enumerate(A)]
A1.sort()
A2.sort()
i = j = 0
cnt = 0
while i < N and j < N:
if A1[i][0] == A2[j][0]:
buf1 = 1
for k in range(i + 1, N):
if A1[k][0] != A1[i][... | N = int(eval(input()))
A = list(map(int, input().split()))
A1, A2 = {}, {}
for i, a in enumerate(A):
key1 = str(-a - i)
if key1 in A1:
A1[key1] = (key1 in A1) * A1[key1] + 1
else:
A1[key1] = 1
key2 = str(a - i)
if key2 in A2:
A2[key2] += 1
else:
A2[key2] = 1
cnt =... | false | 21.428571 | [
"-A1 = [[-a - i, i] for i, a in enumerate(A)]",
"-A2 = [[a - i, i] for i, a in enumerate(A)]",
"-A1.sort()",
"-A2.sort()",
"-i = j = 0",
"+A1, A2 = {}, {}",
"+for i, a in enumerate(A):",
"+ key1 = str(-a - i)",
"+ if key1 in A1:",
"+ A1[key1] = (key1 in A1) * A1[key1] + 1",
"+ el... | false | 0.09356 | 0.040739 | 2.29659 | [
"s668995646",
"s501770533"
] |
u528470578 | p03951 | python | s312468961 | s780480146 | 183 | 18 | 38,640 | 3,064 | Accepted | Accepted | 90.16 | N = int(eval(input()))
s = eval(input())
t = eval(input())
l = 2*N
kouho = []
for i in range(N):
ns = s[i:]
res = 0
for j, k in zip(ns, t):
if j == k:
res += 1
else:
break
kouho.append(res)
print((l - max(kouho)))
| N = int(eval(input()))
s = list(eval(input()))
t = list(eval(input()))
N2 = N * 2
ans = 0
for i in range(N):
temp = 0
ns = s[i:]
for j, k in zip(ns, t):
if j == k:
temp += 1
else:
break
else:
ans = max(ans, temp)
print((N2 - ans)) | 17 | 17 | 268 | 291 | N = int(eval(input()))
s = eval(input())
t = eval(input())
l = 2 * N
kouho = []
for i in range(N):
ns = s[i:]
res = 0
for j, k in zip(ns, t):
if j == k:
res += 1
else:
break
kouho.append(res)
print((l - max(kouho)))
| N = int(eval(input()))
s = list(eval(input()))
t = list(eval(input()))
N2 = N * 2
ans = 0
for i in range(N):
temp = 0
ns = s[i:]
for j, k in zip(ns, t):
if j == k:
temp += 1
else:
break
else:
ans = max(ans, temp)
print((N2 - ans))
| false | 0 | [
"-s = eval(input())",
"-t = eval(input())",
"-l = 2 * N",
"-kouho = []",
"+s = list(eval(input()))",
"+t = list(eval(input()))",
"+N2 = N * 2",
"+ans = 0",
"+ temp = 0",
"- res = 0",
"- res += 1",
"+ temp += 1",
"- kouho.append(res)",
"-print((l - max(kouho))... | false | 0.068702 | 0.033023 | 2.080453 | [
"s312468961",
"s780480146"
] |
u969190727 | p02889 | python | s595607724 | s902496695 | 1,453 | 751 | 19,440 | 20,836 | Accepted | Accepted | 48.31 |
from scipy.sparse.csgraph import floyd_warshall
n,m,l=list(map(int,input().split()))
table=[[0]*n for i in range(n)]
for i in range(m):
a,b,c=list(map(int,input().split()))
table[a-1][b-1]=c
table[b-1][a-1]=c
d=floyd_warshall(csgraph=table, directed=False, return_predecessors=False)
table2=[[0]*... | import sys
input=sys.stdin.readline
from scipy.sparse.csgraph import floyd_warshall
n,m,l=list(map(int,input().split()))
table=[[0]*n for i in range(n)]
for i in range(m):
a,b,c=list(map(int,input().split()))
table[a-1][b-1]=c
table[b-1][a-1]=c
d=floyd_warshall(csgraph=table, directed=False, return... | 24 | 25 | 674 | 710 | from scipy.sparse.csgraph import floyd_warshall
n, m, l = list(map(int, input().split()))
table = [[0] * n for i in range(n)]
for i in range(m):
a, b, c = list(map(int, input().split()))
table[a - 1][b - 1] = c
table[b - 1][a - 1] = c
d = floyd_warshall(csgraph=table, directed=False, return_predecessors=Fa... | import sys
input = sys.stdin.readline
from scipy.sparse.csgraph import floyd_warshall
n, m, l = list(map(int, input().split()))
table = [[0] * n for i in range(n)]
for i in range(m):
a, b, c = list(map(int, input().split()))
table[a - 1][b - 1] = c
table[b - 1][a - 1] = c
d = floyd_warshall(csgraph=table,... | false | 4 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.262481 | 0.404897 | 0.648266 | [
"s595607724",
"s902496695"
] |
u648868410 | p02572 | python | s073299353 | s036383307 | 1,106 | 151 | 32,936 | 31,356 | Accepted | Accepted | 86.35 | import math
class BitIndexedTree:
'''NOTES: 1-origin-indexed
'''
def __init__(self, itemCount):
self.itemCount = itemCount
self.items = [0 for i in range(itemCount+1)]
def add(self, i,value):
while i <= self.itemCount:
self.items[i] += value
i += (i & (-i))
def sumFromStart(self, end):... |
if __name__ == "__main__":
MOD = 10 ** 9 + 7
N=int(eval(input()))
A=list(map(int,input().split()))
Asum = sum(A) % MOD
ans = 0
for n in range(N-1):
Asum -= A[n]
ans += ((A[n] * Asum) % MOD)
print((ans % MOD))
| 50 | 14 | 898 | 229 | import math
class BitIndexedTree:
"""NOTES: 1-origin-indexed"""
def __init__(self, itemCount):
self.itemCount = itemCount
self.items = [0 for i in range(itemCount + 1)]
def add(self, i, value):
while i <= self.itemCount:
self.items[i] += value
i += i & (-i... | if __name__ == "__main__":
MOD = 10**9 + 7
N = int(eval(input()))
A = list(map(int, input().split()))
Asum = sum(A) % MOD
ans = 0
for n in range(N - 1):
Asum -= A[n]
ans += (A[n] * Asum) % MOD
print((ans % MOD))
| false | 72 | [
"-import math",
"-",
"-",
"-class BitIndexedTree:",
"- \"\"\"NOTES: 1-origin-indexed\"\"\"",
"-",
"- def __init__(self, itemCount):",
"- self.itemCount = itemCount",
"- self.items = [0 for i in range(itemCount + 1)]",
"-",
"- def add(self, i, value):",
"- while i ... | false | 0.062133 | 0.044934 | 1.382747 | [
"s073299353",
"s036383307"
] |
u605662776 | p02600 | python | s179151552 | s405305934 | 30 | 26 | 9,160 | 9,084 | Accepted | Accepted | 13.33 | a = int(eval(input()))
b = int(a//200)
if b == 2:
print((8))
elif b == 3:
print((7))
elif b== 4:
print((6))
elif b== 5:
print((5))
elif b==6:
print((4))
elif b==7:
print((3))
elif b==8:
print((2))
elif b==9:
print((1))
| a=int(eval(input()))
b=a//200
if b==2:
print((8))
elif b==3:
print((7))
elif b==4:
print((6))
elif b==5:
print((5))
elif b==6:
print((4))
elif b==7:
print((3))
elif b==8:
print((2))
elif b==9:
print((1)) | 20 | 18 | 236 | 214 | a = int(eval(input()))
b = int(a // 200)
if b == 2:
print((8))
elif b == 3:
print((7))
elif b == 4:
print((6))
elif b == 5:
print((5))
elif b == 6:
print((4))
elif b == 7:
print((3))
elif b == 8:
print((2))
elif b == 9:
print((1))
| a = int(eval(input()))
b = a // 200
if b == 2:
print((8))
elif b == 3:
print((7))
elif b == 4:
print((6))
elif b == 5:
print((5))
elif b == 6:
print((4))
elif b == 7:
print((3))
elif b == 8:
print((2))
elif b == 9:
print((1))
| false | 10 | [
"-b = int(a // 200)",
"+b = a // 200"
] | false | 0.201125 | 0.134052 | 1.500349 | [
"s179151552",
"s405305934"
] |
u714642969 | p03014 | python | s064063672 | s186515242 | 1,842 | 1,389 | 393,736 | 248,712 | Accepted | Accepted | 24.59 | import sys
sys.setrecursionlimit(10**9)
def input():
return sys.stdin.readline().rstrip()
def main():
H, W = list(map(int, input().split()))
S = [list(eval(input())) for i in range(H)]
ans = 0
memo_y = [[float(-1)]*W for i in range(H)]
memo_x = [[float(-1)]*W for i in range(H)]
... | import sys
sys.setrecursionlimit(10**9)
def input():
return sys.stdin.readline().rstrip()
def main():
H, W = list(map(int, input().split()))
S = [list(eval(input())) for i in range(H)]
ans = 0
memo_y = [[-1]*W for i in range(H)]
memo_x = [[-1]*W for i in range(H)]
for y in ... | 64 | 64 | 2,006 | 1,978 | import sys
sys.setrecursionlimit(10**9)
def input():
return sys.stdin.readline().rstrip()
def main():
H, W = list(map(int, input().split()))
S = [list(eval(input())) for i in range(H)]
ans = 0
memo_y = [[float(-1)] * W for i in range(H)]
memo_x = [[float(-1)] * W for i in range(H)]
for ... | import sys
sys.setrecursionlimit(10**9)
def input():
return sys.stdin.readline().rstrip()
def main():
H, W = list(map(int, input().split()))
S = [list(eval(input())) for i in range(H)]
ans = 0
memo_y = [[-1] * W for i in range(H)]
memo_x = [[-1] * W for i in range(H)]
for y in range(H):... | false | 0 | [
"- memo_y = [[float(-1)] * W for i in range(H)]",
"- memo_x = [[float(-1)] * W for i in range(H)]",
"+ memo_y = [[-1] * W for i in range(H)]",
"+ memo_x = [[-1] * W for i in range(H)]",
"- if memo_x[y][x] == float(-1):",
"+ if memo_x[y][x] == -1:",
"- ... | false | 0.036594 | 0.036966 | 0.989952 | [
"s064063672",
"s186515242"
] |
u753803401 | p03472 | python | s329780584 | s857680425 | 365 | 323 | 52,188 | 52,956 | Accepted | Accepted | 11.51 | def slove():
import sys
import heapq
input = sys.stdin.readline
n, h = list(map(int, input().rstrip('\n').split()))
m_k = 0
t = []
heapq.heapify(t)
for i in range(n):
a, b = list(map(int, input().rstrip('\n').split()))
m_k = max(m_k, a)
heapq.heappush(t... | def slove():
import sys
input = sys.stdin.readline
al = []
bl = []
n, h = list(map(int, input().rstrip('\n').split()))
for i in range(n):
a, b = list(map(int, input().rstrip('\n').split()))
al.append(a)
bl.append(b)
al.sort()
bl.sort()
cnt = 0
... | 31 | 32 | 739 | 741 | def slove():
import sys
import heapq
input = sys.stdin.readline
n, h = list(map(int, input().rstrip("\n").split()))
m_k = 0
t = []
heapq.heapify(t)
for i in range(n):
a, b = list(map(int, input().rstrip("\n").split()))
m_k = max(m_k, a)
heapq.heappush(t, -b)
... | def slove():
import sys
input = sys.stdin.readline
al = []
bl = []
n, h = list(map(int, input().rstrip("\n").split()))
for i in range(n):
a, b = list(map(int, input().rstrip("\n").split()))
al.append(a)
bl.append(b)
al.sort()
bl.sort()
cnt = 0
while True:... | false | 3.125 | [
"- import heapq",
"+ al = []",
"+ bl = []",
"- m_k = 0",
"- t = []",
"- heapq.heapify(t)",
"- m_k = max(m_k, a)",
"- heapq.heappush(t, -b)",
"+ al.append(a)",
"+ bl.append(b)",
"+ al.sort()",
"+ bl.sort()",
"- if len(t) != 0:",
"- ... | false | 0.040185 | 0.007681 | 5.231617 | [
"s329780584",
"s857680425"
] |
u037430802 | p03157 | python | s545636454 | s868052818 | 1,957 | 1,212 | 135,836 | 86,584 | Accepted | Accepted | 38.07 | from collections import defaultdict
H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
es = defaultdict(list)
for i in range(H):
for j in range(W):
# 縦の経路
if i == 0 and H != 1:
if S[i][j] != S[i+1][j]:
es[(i,j)].append((i+1... | from collections import defaultdict
H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
es = defaultdict(list)
# あるマスについて左右見なくても右に向かってみていけば逆もとれる
for i in range(H):
for j in range(W):
if j < W-1 and S[i][j] != S[i][j+1]:
es[(i,j)].append((i,j+1))
... | 85 | 58 | 2,354 | 1,365 | from collections import defaultdict
H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
es = defaultdict(list)
for i in range(H):
for j in range(W):
# 縦の経路
if i == 0 and H != 1:
if S[i][j] != S[i + 1][j]:
es[(i, j)].append((i + 1, j))
... | from collections import defaultdict
H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
es = defaultdict(list)
# あるマスについて左右見なくても右に向かってみていけば逆もとれる
for i in range(H):
for j in range(W):
if j < W - 1 and S[i][j] != S[i][j + 1]:
es[(i, j)].append((i, j + 1))
es[(... | false | 31.764706 | [
"+# あるマスについて左右見なくても右に向かってみていけば逆もとれる",
"- # 縦の経路",
"- if i == 0 and H != 1:",
"- if S[i][j] != S[i + 1][j]:",
"- es[(i, j)].append((i + 1, j))",
"- es[(i + 1, j)].append((i, j))",
"- elif 0 < i < H - 1:",
"- if S[i][j] != S[i + 1]... | false | 0.039522 | 0.008191 | 4.824914 | [
"s545636454",
"s868052818"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.