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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u645250356 | p02787 | python | s062646446 | s349120468 | 1,149 | 469 | 295,916 | 74,328 | Accepted | Accepted | 59.18 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.rea... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
... | 29 | 21 | 853 | 593 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, pprint, fractions
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
mod2 = 998244353
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(in... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.read... | false | 27.586207 | [
"-import sys, bisect, math, itertools, pprint, fractions",
"+import sys, bisect, math, itertools, fractions, pprint",
"-mod2 = 998244353",
"-def inpln(n):",
"- return list(int(sys.stdin.readline()) for i in range(n))",
"-",
"-",
"-h, n = inpl()",
"-att = []",
"-cost = []",
"+W, n = inpl()",
... | false | 0.103147 | 0.066728 | 1.545791 | [
"s062646446",
"s349120468"
] |
u193264896 | p03171 | python | s599505887 | s088808739 | 1,109 | 272 | 390,944 | 145,596 | Accepted | Accepted | 75.47 | import sys
from functools import lru_cache
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
@lru_cache(maxsize=None)
def f(N, *A):
dp = [[INF] * (N + 1) for _ in range(N + 1)]
for i in range(N + 1):
dp[i][i] = 0
for l in range(1, N + 1):
for... | import sys
from functools import lru_cache
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
N = int(readline())
A = list(map(int, readline().split()))
dp = [[-1]*(N+1) for _ in range(N+1)]
for i in r... | 27 | 28 | 736 | 686 | import sys
from functools import lru_cache
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)
INF = float("inf")
@lru_cache(maxsize=None)
def f(N, *A):
dp = [[INF] * (N + 1) for _ in range(N + 1)]
for i in range(N + 1):
dp[i][i] = 0
for l in range(1, N + 1):
for i in range(... | import sys
from functools import lru_cache
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)
INF = float("inf")
MOD = 10**9 + 7
def main():
N = int(readline())
A = list(map(int, readline().split()))
dp = [[-1] * (N + 1) for _ in range(N + 1)]
for i in range(N + 1... | false | 3.571429 | [
"+read = sys.stdin.read",
"+MOD = 10**9 + 7",
"-@lru_cache(maxsize=None)",
"-def f(N, *A):",
"- dp = [[INF] * (N + 1) for _ in range(N + 1)]",
"+def main():",
"+ N = int(readline())",
"+ A = list(map(int, readline().split()))",
"+ dp = [[-1] * (N + 1) for _ in range(N + 1)]",
"-def mai... | false | 0.045697 | 0.08508 | 0.537105 | [
"s599505887",
"s088808739"
] |
u925782032 | p03055 | python | s267206184 | s691921021 | 547 | 449 | 82,512 | 98,020 | Accepted | Accepted | 17.92 | import sys
range = xrange
input = sys.stdin.readline
n = int(eval(input()))
coupl = [[] for _ in range(n)]
for _ in range(n-1):
u,v = [int(x)-1 for x in input().split()]
coupl[u].append(v)
coupl[v].append(u)
root = 0
for _ in range(2):
depth = [-1]*n
depth[root] = 1
Q = [r... | import sys
range = xrange
inp = [int(x) for x in sys.stdin.read().split()]
ii = 0
n = inp[ii]
ii += 1
coupl = [[] for _ in range(n)]
for _ in range(n-1):
u,v = inp[ii]-1, inp[ii+1]-1
ii += 2
coupl[u].append(v)
coupl[v].append(u)
root = 0
for _ in range(2):
depth = [-1]*n
... | 30 | 35 | 625 | 663 | import sys
range = xrange
input = sys.stdin.readline
n = int(eval(input()))
coupl = [[] for _ in range(n)]
for _ in range(n - 1):
u, v = [int(x) - 1 for x in input().split()]
coupl[u].append(v)
coupl[v].append(u)
root = 0
for _ in range(2):
depth = [-1] * n
depth[root] = 1
Q = [root]
for no... | import sys
range = xrange
inp = [int(x) for x in sys.stdin.read().split()]
ii = 0
n = inp[ii]
ii += 1
coupl = [[] for _ in range(n)]
for _ in range(n - 1):
u, v = inp[ii] - 1, inp[ii + 1] - 1
ii += 2
coupl[u].append(v)
coupl[v].append(u)
root = 0
for _ in range(2):
depth = [-1] * n
depth[root] ... | false | 14.285714 | [
"-input = sys.stdin.readline",
"-n = int(eval(input()))",
"+inp = [int(x) for x in sys.stdin.read().split()]",
"+ii = 0",
"+n = inp[ii]",
"+ii += 1",
"- u, v = [int(x) - 1 for x in input().split()]",
"+ u, v = inp[ii] - 1, inp[ii + 1] - 1",
"+ ii += 2"
] | false | 0.049672 | 0.046054 | 1.078567 | [
"s267206184",
"s691921021"
] |
u241159583 | p03862 | python | s389752411 | s215316810 | 158 | 115 | 14,592 | 20,036 | Accepted | Accepted | 27.22 | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
for i in range(N):
if i != N -1:
if a[i] + a[i + 1] > x:
ans += a[i] + a[i + 1] - x
a[i + 1] -= min(a[i + 1], a[i] + a[i + 1] - x)
print(ans) | n,x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
for i in range(n-1):
if a[i] <= x:
if a[i]+a[i+1] <= x: continue
else:
ans += (a[i]+a[i+1])-x
a[i+1] -= (a[i]+a[i+1])-x
else:
ans += a[i]-x + a[i+1]
a[i], a[i+1] =... | 10 | 14 | 246 | 361 | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
for i in range(N):
if i != N - 1:
if a[i] + a[i + 1] > x:
ans += a[i] + a[i + 1] - x
a[i + 1] -= min(a[i + 1], a[i] + a[i + 1] - x)
print(ans)
| n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
if a[i] <= x:
if a[i] + a[i + 1] <= x:
continue
else:
ans += (a[i] + a[i + 1]) - x
a[i + 1] -= (a[i] + a[i + 1]) - x
else:
ans += a[i] - x + a[i +... | false | 28.571429 | [
"-N, x = list(map(int, input().split()))",
"+n, x = list(map(int, input().split()))",
"-for i in range(N):",
"- if i != N - 1:",
"- if a[i] + a[i + 1] > x:",
"- ans += a[i] + a[i + 1] - x",
"- a[i + 1] -= min(a[i + 1], a[i] + a[i + 1] - x)",
"+for i in range(n - 1):",
... | false | 0.116951 | 0.036991 | 3.161574 | [
"s389752411",
"s215316810"
] |
u974336656 | p02791 | python | s865199344 | s451808903 | 235 | 93 | 73,308 | 24,436 | Accepted | Accepted | 60.43 | n = int(eval(input()))
arr = input().split(' ')
arr = [int(i) for i in arr]
count = 0
minimum = arr[0]
for num in arr:
if num <= minimum:
minimum = num
count += 1
print(count) | import sys
input = sys.stdin.readline
n = int(eval(input()))
arr = list(map(int,input().split()))
count = 0
minimum = arr[0]
for num in arr:
if num <= minimum:
minimum = num
count += 1
print(count) | 10 | 12 | 188 | 214 | n = int(eval(input()))
arr = input().split(" ")
arr = [int(i) for i in arr]
count = 0
minimum = arr[0]
for num in arr:
if num <= minimum:
minimum = num
count += 1
print(count)
| import sys
input = sys.stdin.readline
n = int(eval(input()))
arr = list(map(int, input().split()))
count = 0
minimum = arr[0]
for num in arr:
if num <= minimum:
minimum = num
count += 1
print(count)
| false | 16.666667 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-arr = input().split(\" \")",
"-arr = [int(i) for i in arr]",
"+arr = list(map(int, input().split()))"
] | false | 0.153559 | 0.089143 | 1.722623 | [
"s865199344",
"s451808903"
] |
u144913062 | p03112 | python | s339948615 | s925881227 | 1,166 | 903 | 111,068 | 79,708 | Accepted | Accepted | 22.56 | from bisect import bisect
import sys
input = sys.stdin.readline
A, B, Q = list(map(int, input().split()))
s = [int(eval(input())) for _ in range(A)]
s.sort()
t = [int(eval(input())) for _ in range(B)]
t.sort()
for _ in range(Q):
x = int(eval(input()))
i = bisect(s, x)
sl = sr = 0
if i == 0... | from bisect import bisect
import sys
input = sys.stdin.readline
A, B, Q = list(map(int, input().split()))
INF = float('inf')
s = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]
for _ in range(Q):
x = int(eval(input()))
i = bisect(s, ... | 35 | 17 | 786 | 482 | from bisect import bisect
import sys
input = sys.stdin.readline
A, B, Q = list(map(int, input().split()))
s = [int(eval(input())) for _ in range(A)]
s.sort()
t = [int(eval(input())) for _ in range(B)]
t.sort()
for _ in range(Q):
x = int(eval(input()))
i = bisect(s, x)
sl = sr = 0
if i == 0:
sl ... | from bisect import bisect
import sys
input = sys.stdin.readline
A, B, Q = list(map(int, input().split()))
INF = float("inf")
s = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]
for _ in range(Q):
x = int(eval(input()))
i = bisect(s, x)
j =... | false | 51.428571 | [
"-s = [int(eval(input())) for _ in range(A)]",
"-s.sort()",
"-t = [int(eval(input())) for _ in range(B)]",
"-t.sort()",
"+INF = float(\"inf\")",
"+s = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]",
"+t = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]",
"- sl = sr = 0",
"- i... | false | 0.050165 | 0.049034 | 1.023047 | [
"s339948615",
"s925881227"
] |
u554784585 | p03478 | python | s173405854 | s080509526 | 47 | 43 | 9,184 | 9,048 | Accepted | Accepted | 8.51 | N,A,B=list(map(int,input().split()))
ans=0
for i in range(1,N+1):
i=str(i)
l=len(i)
s=0
for j in range(l):
s+=int(i[j])
if A<=s<=B:
ans+=int(i)
print(ans)
| N,A,B=list(map(int,input().split()))
ans=0
for i in range(1,N+1):
temp=0
i=str(i)
for j in range(len(i)):
temp+=int(i[j])
if A<=temp<=B:
ans+=int(i)
print(ans)
| 12 | 11 | 205 | 197 | N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
i = str(i)
l = len(i)
s = 0
for j in range(l):
s += int(i[j])
if A <= s <= B:
ans += int(i)
print(ans)
| N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
temp = 0
i = str(i)
for j in range(len(i)):
temp += int(i[j])
if A <= temp <= B:
ans += int(i)
print(ans)
| false | 8.333333 | [
"+ temp = 0",
"- l = len(i)",
"- s = 0",
"- for j in range(l):",
"- s += int(i[j])",
"- if A <= s <= B:",
"+ for j in range(len(i)):",
"+ temp += int(i[j])",
"+ if A <= temp <= B:"
] | false | 0.047556 | 0.069242 | 0.686808 | [
"s173405854",
"s080509526"
] |
u396518935 | p02960 | python | s974285703 | s463326111 | 1,794 | 1,398 | 14,588 | 3,244 | Accepted | Accepted | 22.07 | import numpy as np
s = eval(input())
p = np.array([0]*13)
p[0] = 1
amari = [[0]*13 for _ in range(13)]
for j in range(10):
for i in range(13):
amari[i][(i*10+j)%13] += 1
M = np.array(amari)
for si in range(len(s)):
a = np.array([0]*13)
if s[si] == '?':
a = np.dot(p,M)
else:
c = i... | def main():
M=10**9+7
r=tuple(tuple((j-k)*9%13for j in range(10))for k in range(13))
d=[1]+[0]*12
for c in eval(input()):
d = [sum(d[j]for j in k)%M for k in r] if c>'9' else [d[(int(c)-k)*9%13]for k in range(13)]
print((d[5]))
main() | 22 | 8 | 419 | 247 | import numpy as np
s = eval(input())
p = np.array([0] * 13)
p[0] = 1
amari = [[0] * 13 for _ in range(13)]
for j in range(10):
for i in range(13):
amari[i][(i * 10 + j) % 13] += 1
M = np.array(amari)
for si in range(len(s)):
a = np.array([0] * 13)
if s[si] == "?":
a = np.dot(p, M)
else:... | def main():
M = 10**9 + 7
r = tuple(tuple((j - k) * 9 % 13 for j in range(10)) for k in range(13))
d = [1] + [0] * 12
for c in eval(input()):
d = (
[sum(d[j] for j in k) % M for k in r]
if c > "9"
else [d[(int(c) - k) * 9 % 13] for k in range(13)]
)
... | false | 63.636364 | [
"-import numpy as np",
"+def main():",
"+ M = 10**9 + 7",
"+ r = tuple(tuple((j - k) * 9 % 13 for j in range(10)) for k in range(13))",
"+ d = [1] + [0] * 12",
"+ for c in eval(input()):",
"+ d = (",
"+ [sum(d[j] for j in k) % M for k in r]",
"+ if c > \"9\""... | false | 0.207674 | 0.037486 | 5.540023 | [
"s974285703",
"s463326111"
] |
u968166680 | p02780 | python | s834164279 | s217180124 | 437 | 109 | 100,508 | 105,396 | Accepted | Accepted | 75.06 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K, *P = list(map(int, read().split()))
csum = [0] * (N + 1)
for i, p in enumerate(P):
csum[i + 1] = csum[i] +... | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K, *P = list(map(int, read().split()))
csum = [0]
csum.extend(accumulate(P))
... | 28 | 28 | 530 | 520 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K, *P = list(map(int, read().split()))
csum = [0] * (N + 1)
for i, p in enumerate(P):
csum[i + 1] = csum[i] + p
ans = 0
... | import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K, *P = list(map(int, read().split()))
csum = [0]
csum.extend(accumulate(P))
ans = 0
for i in ... | false | 0 | [
"+from itertools import accumulate",
"- csum = [0] * (N + 1)",
"- for i, p in enumerate(P):",
"- csum[i + 1] = csum[i] + p",
"+ csum = [0]",
"+ csum.extend(accumulate(P))"
] | false | 0.043563 | 0.036876 | 1.181336 | [
"s834164279",
"s217180124"
] |
u691018832 | p03569 | python | s288951664 | s151534034 | 92 | 85 | 3,316 | 3,316 | Accepted | Accepted | 7.61 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
s = eval(input())
cnt_1 = 0
cnt_2 = len(s) - 1
ans = 0
m = len(s)
end = m // 2
for i in range(cnt_2 + 1):
if s[cnt_1] == s[cnt_2]:
if end != cnt_1... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
s = read().rstrip().decode()
ans = 0
m = len(s)
size = m // 2
cnt_ss = m - 1
cnt_s = 0
for i in range(m):
if s[cnt_s] == s[cnt_ss]:
if cnt_s != si... | 33 | 33 | 682 | 690 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
s = eval(input())
cnt_1 = 0
cnt_2 = len(s) - 1
ans = 0
m = len(s)
end = m // 2
for i in range(cnt_2 + 1):
if s[cnt_1] == s[cnt_2]:
if end != cnt_1:
cn... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
s = read().rstrip().decode()
ans = 0
m = len(s)
size = m // 2
cnt_ss = m - 1
cnt_s = 0
for i in range(m):
if s[cnt_s] == s[cnt_ss]:
if cnt_s != size:
... | false | 0 | [
"-s = eval(input())",
"-cnt_1 = 0",
"-cnt_2 = len(s) - 1",
"+s = read().rstrip().decode()",
"-end = m // 2",
"-for i in range(cnt_2 + 1):",
"- if s[cnt_1] == s[cnt_2]:",
"- if end != cnt_1:",
"- cnt_1 += 1",
"- if end != cnt_2:",
"- cnt_2 -= 1",
"- eli... | false | 0.044277 | 0.044231 | 1.00104 | [
"s288951664",
"s151534034"
] |
u734169929 | p02777 | python | s482173653 | s965155905 | 28 | 24 | 9,084 | 9,116 | Accepted | Accepted | 14.29 | S,T = list(map(str, input().split()))
A,B = list(map(int, input().split()))
U = eval(input())
if U == S:
A -= 1
elif U == T:
B -= 1
print((A,B)) | S,T = input().split()
A,B = list(map(int,input().split()))
U = eval(input())
if S == U:
print((A-1, B))
else:
print((A, B-1)) | 10 | 8 | 145 | 127 | S, T = list(map(str, input().split()))
A, B = list(map(int, input().split()))
U = eval(input())
if U == S:
A -= 1
elif U == T:
B -= 1
print((A, B))
| S, T = input().split()
A, B = list(map(int, input().split()))
U = eval(input())
if S == U:
print((A - 1, B))
else:
print((A, B - 1))
| false | 20 | [
"-S, T = list(map(str, input().split()))",
"+S, T = input().split()",
"-if U == S:",
"- A -= 1",
"-elif U == T:",
"- B -= 1",
"-print((A, B))",
"+if S == U:",
"+ print((A - 1, B))",
"+else:",
"+ print((A, B - 1))"
] | false | 0.038366 | 0.0763 | 0.502836 | [
"s482173653",
"s965155905"
] |
u072717685 | p03478 | python | s364507188 | s889423015 | 200 | 37 | 42,732 | 9,140 | Accepted | Accepted | 81.5 | n, a, b = list(map(int, input().split()))
nl = [str(i) for i in range(1, n+1)]
r = 0
for ns in nl:
score = sum(list(map(int, ns)))
if a <= score <= b:
r += int(ns)
print(r) | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
n, a, b = list(map(int, input().split()))
r = 0
for i1 in range(1, n + 1):
i1sum = sum(tuple(map(int, str(i1))))
if a <= i1sum <= b:
r += i1
print(r)
if __name__ == '__main__':
main... | 10 | 14 | 193 | 316 | n, a, b = list(map(int, input().split()))
nl = [str(i) for i in range(1, n + 1)]
r = 0
for ns in nl:
score = sum(list(map(int, ns)))
if a <= score <= b:
r += int(ns)
print(r)
| import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
n, a, b = list(map(int, input().split()))
r = 0
for i1 in range(1, n + 1):
i1sum = sum(tuple(map(int, str(i1))))
if a <= i1sum <= b:
r += i1
print(r)
if __name__ == "__main__":
main()
| false | 28.571429 | [
"-n, a, b = list(map(int, input().split()))",
"-nl = [str(i) for i in range(1, n + 1)]",
"-r = 0",
"-for ns in nl:",
"- score = sum(list(map(int, ns)))",
"- if a <= score <= b:",
"- r += int(ns)",
"-print(r)",
"+import sys",
"+",
"+read = sys.stdin.read",
"+readlines = sys.stdin.r... | false | 0.035098 | 0.036373 | 0.964936 | [
"s364507188",
"s889423015"
] |
u496821919 | p03037 | python | s232416959 | s706051472 | 326 | 298 | 3,060 | 10,996 | Accepted | Accepted | 8.59 | n,m = list(map(int,input().split()))
ansl = 0
ansr = n+1
for i in range(m):
l,r = list(map(int,input().split()))
ansl = max(ansl,l)
ansr = min(ansr,r)
print((0 if ansl > ansr else ansr-ansl+1)) | n,m = list(map(int,input().split()))
L = []
R = []
for i in range(m):
l,r = list(map(int,input().split()))
L.append(l)
R.append(r)
ansl = max(L)
ansr = min(R)
print((0 if ansl > ansr else ansr-ansl+1)) | 8 | 10 | 198 | 208 | n, m = list(map(int, input().split()))
ansl = 0
ansr = n + 1
for i in range(m):
l, r = list(map(int, input().split()))
ansl = max(ansl, l)
ansr = min(ansr, r)
print((0 if ansl > ansr else ansr - ansl + 1))
| n, m = list(map(int, input().split()))
L = []
R = []
for i in range(m):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
ansl = max(L)
ansr = min(R)
print((0 if ansl > ansr else ansr - ansl + 1))
| false | 20 | [
"-ansl = 0",
"-ansr = n + 1",
"+L = []",
"+R = []",
"- ansl = max(ansl, l)",
"- ansr = min(ansr, r)",
"+ L.append(l)",
"+ R.append(r)",
"+ansl = max(L)",
"+ansr = min(R)"
] | false | 0.035417 | 0.040555 | 0.87331 | [
"s232416959",
"s706051472"
] |
u548977313 | p03163 | python | s059649103 | s786313401 | 381 | 214 | 22,136 | 15,468 | Accepted | Accepted | 43.83 | import numpy as np
n,W = (int(i) for i in input().split())
weights = []
values = []
for j in range(n):
wt, val = [int(i) for i in input().split()]
weights.append(wt)
values.append(val)
dp = np.zeros(W+1)
for i in range(1,n+1):
w = weights[i-1]
v = values[i-1]
dp[w:] = np.maxim... | import numpy as np
n,W = (int(i) for i in input().split())
items=[[int(i) for i in input().split()]for j in range(n)]
dp = np.zeros(W+1)
for w,v in items:
dp[w:] = np.maximum(dp[w:],v+dp[:-w])
print((int(dp[-1])))
| 18 | 11 | 363 | 231 | import numpy as np
n, W = (int(i) for i in input().split())
weights = []
values = []
for j in range(n):
wt, val = [int(i) for i in input().split()]
weights.append(wt)
values.append(val)
dp = np.zeros(W + 1)
for i in range(1, n + 1):
w = weights[i - 1]
v = values[i - 1]
dp[w:] = np.maximum(dp[w:... | import numpy as np
n, W = (int(i) for i in input().split())
items = [[int(i) for i in input().split()] for j in range(n)]
dp = np.zeros(W + 1)
for w, v in items:
dp[w:] = np.maximum(dp[w:], v + dp[:-w])
print((int(dp[-1])))
| false | 38.888889 | [
"-weights = []",
"-values = []",
"-for j in range(n):",
"- wt, val = [int(i) for i in input().split()]",
"- weights.append(wt)",
"- values.append(val)",
"+items = [[int(i) for i in input().split()] for j in range(n)]",
"-for i in range(1, n + 1):",
"- w = weights[i - 1]",
"- v = val... | false | 0.179974 | 0.243739 | 0.738387 | [
"s059649103",
"s786313401"
] |
u631277801 | p03283 | python | s724740667 | s975691757 | 774 | 687 | 44,492 | 13,756 | Accepted | Accepted | 11.24 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.re... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readl... | 51 | 44 | 1,210 | 1,062 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 13.72549 | [
"-train = []",
"-query = []",
"-field = [[0 for _ in range(n + 1)] for _ in range(n + 1)]",
"+grid = [[0 for _ in range(n + 1)] for _ in range(n + 1)]",
"- train.append(tuple(li()))",
"+ l, r = li()",
"+ grid[l][r] += 1",
"+grid = cum_2d(grid)",
"- query.append(tuple(li()))",
"-for ts,... | false | 0.067132 | 0.068897 | 0.974377 | [
"s724740667",
"s975691757"
] |
u576432509 | p02953 | python | s547711065 | s335129790 | 93 | 70 | 14,396 | 14,396 | Accepted | Accepted | 24.73 | n=int(eval(input()))
hi=[]
for i in map(int,input().split()):
hi.append(i)
YesNo="Yes"
for i in range(n-1,1,-1):
if hi[i]+2<=hi[i-1]:
YesNo="No"
# print("No")
break
elif hi[i]+1==hi[i-1]:
hi[i-1]=hi[i-1]-1
print(YesNo) |
n=int(eval(input()))
h=list(map(int,input().split()))
yn=""
for i in range(n-2,-1,-1):
if h[i]<=h[i+1]:
continue
elif h[i]==h[i+1]+1:
h[i]-=1
continue
else:
yn="No"
break
if yn=="No":
print("No")
else:
print("Yes")
| 13 | 20 | 275 | 304 | n = int(eval(input()))
hi = []
for i in map(int, input().split()):
hi.append(i)
YesNo = "Yes"
for i in range(n - 1, 1, -1):
if hi[i] + 2 <= hi[i - 1]:
YesNo = "No"
# print("No")
break
elif hi[i] + 1 == hi[i - 1]:
hi[i - 1] = hi[i - 1] - 1
print(YesNo)
| n = int(eval(input()))
h = list(map(int, input().split()))
yn = ""
for i in range(n - 2, -1, -1):
if h[i] <= h[i + 1]:
continue
elif h[i] == h[i + 1] + 1:
h[i] -= 1
continue
else:
yn = "No"
break
if yn == "No":
print("No")
else:
print("Yes")
| false | 35 | [
"-hi = []",
"-for i in map(int, input().split()):",
"- hi.append(i)",
"-YesNo = \"Yes\"",
"-for i in range(n - 1, 1, -1):",
"- if hi[i] + 2 <= hi[i - 1]:",
"- YesNo = \"No\"",
"- # print(\"No\")",
"+h = list(map(int, input().split()))",
"+yn = \"\"",
"+for i in range(n... | false | 0.035886 | 0.04532 | 0.791844 | [
"s547711065",
"s335129790"
] |
u499381410 | p03472 | python | s074900049 | s437682498 | 858 | 294 | 71,516 | 54,492 | Accepted | Accepted | 65.73 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_... | 48 | 51 | 1,414 | 1,473 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_left, bise... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_left, bise... | false | 5.882353 | [
"-power = []",
"-for a, b in LIR(n):",
"- power += [(a, 1)]",
"- power += [(b, 0)]",
"-power.sort(reverse=True)",
"-for i in range(2 * n):",
"- p, flag = power[i]",
"- h -= p",
"+A = []",
"+B = []",
"+for _ in range(n):",
"+ a, b = LI()",
"+ A += [a]",
"+ B += [b]",
... | false | 0.043638 | 0.039864 | 1.094694 | [
"s074900049",
"s437682498"
] |
u634079249 | p03000 | python | s864952516 | s991144138 | 172 | 37 | 14,544 | 10,140 | Accepted | Accepted | 78.49 | import sys, os, math, bisect, itertools, collections, heapq, queue
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict
# import fractions
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il... | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
# import fractions
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstr... | 41 | 43 | 1,175 | 1,212 | import sys, os, math, bisect, itertools, collections, heapq, queue
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict
# import fractions
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: l... | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
# import fractions
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il =... | false | 4.651163 | [
"-from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall",
"+",
"+# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall",
"-from collections import defaultdict",
"+from collections import defaultdict, deque",
"- now, ret = 0, 1",
"+ d, ret = 0, 1",
"- now += l... | false | 0.037842 | 0.236816 | 0.159796 | [
"s864952516",
"s991144138"
] |
u395202850 | p02755 | python | s151069895 | s520025634 | 625 | 18 | 3,060 | 3,060 | Accepted | Accepted | 97.12 | import math as m
a, b = list(map(int, input().split()))
cost = -1
flg = 0
while flg == 0 and cost < 10 ** 6 / 1.5:
cost += 1
aAns = m.floor(cost * 0.08)
bAns = m.floor(cost * 0.1)
if aAns == a and bAns == b:
flg = 1
print((cost if flg == 1 else -1))
| import math as m
a, b = list(map(int, input().split()))
cost = -1
flg = 0
while flg == 0 and cost < 10 ** 6 / 1.5:
cost += 1
aAns = m.floor(cost * 0.08)
bAns = m.floor(cost * 0.1)
if aAns == a and bAns == b:
flg = 1
if a - aAns < 0 or b - bAns < 0:
break
print((cost... | 14 | 16 | 282 | 335 | import math as m
a, b = list(map(int, input().split()))
cost = -1
flg = 0
while flg == 0 and cost < 10**6 / 1.5:
cost += 1
aAns = m.floor(cost * 0.08)
bAns = m.floor(cost * 0.1)
if aAns == a and bAns == b:
flg = 1
print((cost if flg == 1 else -1))
| import math as m
a, b = list(map(int, input().split()))
cost = -1
flg = 0
while flg == 0 and cost < 10**6 / 1.5:
cost += 1
aAns = m.floor(cost * 0.08)
bAns = m.floor(cost * 0.1)
if aAns == a and bAns == b:
flg = 1
if a - aAns < 0 or b - bAns < 0:
break
print((cost if flg == 1 else -... | false | 12.5 | [
"+ if a - aAns < 0 or b - bAns < 0:",
"+ break"
] | false | 0.832453 | 0.037486 | 22.207068 | [
"s151069895",
"s520025634"
] |
u273345915 | p02696 | python | s928887069 | s881888551 | 24 | 21 | 8,976 | 9,168 | Accepted | Accepted | 12.5 | import math
A,B,N=list(map(int,input().split()))
x=B-1 if N >= B else N
ans=math.floor(A*x/B)-A*math.floor(x/B)
print(ans) | import math
A,B,N=list(map(int,input().split()))
x=min(B-1,N)
ans=math.floor(A*x/B)-A*math.floor(x/B)
print(ans) | 5 | 5 | 120 | 110 | import math
A, B, N = list(map(int, input().split()))
x = B - 1 if N >= B else N
ans = math.floor(A * x / B) - A * math.floor(x / B)
print(ans)
| import math
A, B, N = list(map(int, input().split()))
x = min(B - 1, N)
ans = math.floor(A * x / B) - A * math.floor(x / B)
print(ans)
| false | 0 | [
"-x = B - 1 if N >= B else N",
"+x = min(B - 1, N)"
] | false | 0.042693 | 0.0482 | 0.885754 | [
"s928887069",
"s881888551"
] |
u763534154 | p02266 | python | s519086994 | s022399037 | 80 | 70 | 8,420 | 8,336 | Accepted | Accepted | 12.5 | from collections import deque
s = eval(input())
d = deque()
l = deque()
def calc_area(j, i):
return i - j
for i, c in enumerate(s):
if c == "\\":
d.append(i)
if c == "/":
if len(d) == 0:
continue
j = d.pop()
s = calc_area(j, i)
... | from collections import deque
if __name__ == '__main__':
s = eval(input())
d = deque()
l = deque()
for i, c in enumerate(s):
if c == "\\":
d.append(i)
if c == "/":
if len(d) == 0:
continue
j = d.pop()
s =... | 40 | 37 | 658 | 773 | from collections import deque
s = eval(input())
d = deque()
l = deque()
def calc_area(j, i):
return i - j
for i, c in enumerate(s):
if c == "\\":
d.append(i)
if c == "/":
if len(d) == 0:
continue
j = d.pop()
s = calc_area(j, i)
while len(l) > 0:
... | from collections import deque
if __name__ == "__main__":
s = eval(input())
d = deque()
l = deque()
for i, c in enumerate(s):
if c == "\\":
d.append(i)
if c == "/":
if len(d) == 0:
continue
j = d.pop()
s = i - j
... | false | 7.5 | [
"-s = eval(input())",
"-d = deque()",
"-l = deque()",
"-",
"-",
"-def calc_area(j, i):",
"- return i - j",
"-",
"-",
"-for i, c in enumerate(s):",
"- if c == \"\\\\\":",
"- d.append(i)",
"- if c == \"/\":",
"- if len(d) == 0:",
"- continue",
"- ... | false | 0.04248 | 0.041624 | 1.020566 | [
"s519086994",
"s022399037"
] |
u827202523 | p03250 | python | s428040123 | s941298285 | 20 | 18 | 3,316 | 2,940 | Accepted | Accepted | 10 | def getN():
return int(eval(input()))
def getMN():
a = input().split()
b = [int(i) for i in a]
return b[0],b[1]
def getlist():
a = input().split()
b = [int(i) for i in a]
return b
a,b,c = getlist()
m = max([a,b,c])
print((10*m + a+ b+ c -m)) | a, b, c = list(map(int, input().split()))
big = max([a,b,c])
print((sum([a,b,c]) + 9*big)) | 16 | 5 | 279 | 94 | def getN():
return int(eval(input()))
def getMN():
a = input().split()
b = [int(i) for i in a]
return b[0], b[1]
def getlist():
a = input().split()
b = [int(i) for i in a]
return b
a, b, c = getlist()
m = max([a, b, c])
print((10 * m + a + b + c - m))
| a, b, c = list(map(int, input().split()))
big = max([a, b, c])
print((sum([a, b, c]) + 9 * big))
| false | 68.75 | [
"-def getN():",
"- return int(eval(input()))",
"-",
"-",
"-def getMN():",
"- a = input().split()",
"- b = [int(i) for i in a]",
"- return b[0], b[1]",
"-",
"-",
"-def getlist():",
"- a = input().split()",
"- b = [int(i) for i in a]",
"- return b",
"-",
"-",
"-a, ... | false | 0.07088 | 0.006708 | 10.565806 | [
"s428040123",
"s941298285"
] |
u425762225 | p03645 | python | s696952119 | s673063156 | 679 | 623 | 70,960 | 70,760 | Accepted | Accepted | 8.25 | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**9)
# from numba import njit
# from collections import Counter
# from itertools import accumulate
# import numpy as np
# from heapq import heappop,heappush
# from bisect import bisect_left
# @njit
def solve(n,m,l):
edges = {i+1:[] for i in ... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**9)
# from numba import njit
# from collections import Counter
# from itertools import accumulate
# import numpy as np
# from heapq import heappop,heappush
# from bisect import bisect_left
# @njit
def solve(n,m,l):
edges = {i+1:[] for i in ... | 38 | 32 | 814 | 691 | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**9)
# from numba import njit
# from collections import Counter
# from itertools import accumulate
# import numpy as np
# from heapq import heappop,heappush
# from bisect import bisect_left
# @njit
def solve(n, m, l):
edges = {i + 1: [] for i in range(n)}
... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**9)
# from numba import njit
# from collections import Counter
# from itertools import accumulate
# import numpy as np
# from heapq import heappop,heappush
# from bisect import bisect_left
# @njit
def solve(n, m, l):
edges = {i + 1: [] for i in range(n)}
... | false | 15.789474 | [
"-",
"- def dfs(start, end, rest):",
"- if rest == 0:",
"- return start == end",
"- else:",
"- return any(dfs(nextNode, end, rest - 1) for nextNode in edges[start])",
"-",
"- return dfs(1, n, 2)",
"+ return any(1 in v and n in v for k, v in list(edges.ite... | false | 0.088308 | 0.06895 | 1.280753 | [
"s696952119",
"s673063156"
] |
u186838327 | p03436 | python | s416169836 | s454533847 | 184 | 72 | 40,048 | 70,504 | Accepted | Accepted | 60.87 | h, w = list(map(int, input().split()))
M = [str(eval(input())) for _ in range(h)]
ans = 0
for i in range(h):
for j in range(w):
if M[i][j] == '.':
ans += 1
M = ['#'*w] + M + ['#'*w]
M = ['#'+c+'#' for c in M]
from collections import deque
q = deque()
q.append((1, 1))
visit = ... | h, w = list(map(int, input().split()))
M = [str(eval(input())) for _ in range(h)]
cnt = 0
for i in range(h):
cnt += M[i].count('.')
M = ['#'*w] + M + ['#'*w]
M = ['#'+c+'#' for c in M]
sy, sx = 1, 1
from collections import deque
stack = deque()
stack.append((sy, sx))
visit = [[-1]*(w+2) for _ in ... | 32 | 32 | 697 | 734 | h, w = list(map(int, input().split()))
M = [str(eval(input())) for _ in range(h)]
ans = 0
for i in range(h):
for j in range(w):
if M[i][j] == ".":
ans += 1
M = ["#" * w] + M + ["#" * w]
M = ["#" + c + "#" for c in M]
from collections import deque
q = deque()
q.append((1, 1))
visit = [[-1] * (w ... | h, w = list(map(int, input().split()))
M = [str(eval(input())) for _ in range(h)]
cnt = 0
for i in range(h):
cnt += M[i].count(".")
M = ["#" * w] + M + ["#" * w]
M = ["#" + c + "#" for c in M]
sy, sx = 1, 1
from collections import deque
stack = deque()
stack.append((sy, sx))
visit = [[-1] * (w + 2) for _ in range(... | false | 0 | [
"-ans = 0",
"+cnt = 0",
"- for j in range(w):",
"- if M[i][j] == \".\":",
"- ans += 1",
"+ cnt += M[i].count(\".\")",
"+sy, sx = 1, 1",
"-q = deque()",
"-q.append((1, 1))",
"+stack = deque()",
"+stack.append((sy, sx))",
"-visit[1][1] = 0",
"-while q:",
"- y, x = ... | false | 0.039493 | 0.041889 | 0.942804 | [
"s416169836",
"s454533847"
] |
u279493135 | p02885 | python | s323211785 | s655182980 | 138 | 39 | 5,712 | 5,192 | Accepted | Accepted | 71.74 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | 23 | 22 | 677 | 809 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | false | 4.347826 | [
"-from itertools import permutations, combinations, product, accumulate",
"+from itertools import accumulate, permutations, combinations, product",
"+from bisect import bisect, bisect_left",
"+from heapq import heappush, heappop",
"+from functools import reduce",
"+def ZIP(n):",
"+ return list(zip(*(... | false | 0.073552 | 0.033763 | 2.178457 | [
"s323211785",
"s655182980"
] |
u349724238 | p02848 | python | s107080745 | s029379908 | 45 | 24 | 3,060 | 3,060 | Accepted | Accepted | 46.67 | N = int(eval(input()))
S = eval(input())
A = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = ''
for i in range(len(S)):
for j in range(len(A)):
if S[i] == A[j]:
ans += A[j+N]
break
print(ans) | N = int(eval(input()))
S = eval(input())
ans = ''
for i in range(len(S)):
if ord(S[i])+N <= ord('Z'):
ans += chr(ord(S[i])+N)
else:
ans +=chr(ord(S[i])+N-26)
print(ans) | 10 | 9 | 237 | 188 | N = int(eval(input()))
S = eval(input())
A = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for i in range(len(S)):
for j in range(len(A)):
if S[i] == A[j]:
ans += A[j + N]
break
print(ans)
| N = int(eval(input()))
S = eval(input())
ans = ""
for i in range(len(S)):
if ord(S[i]) + N <= ord("Z"):
ans += chr(ord(S[i]) + N)
else:
ans += chr(ord(S[i]) + N - 26)
print(ans)
| false | 10 | [
"-A = \"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ\"",
"- for j in range(len(A)):",
"- if S[i] == A[j]:",
"- ans += A[j + N]",
"- break",
"+ if ord(S[i]) + N <= ord(\"Z\"):",
"+ ans += chr(ord(S[i]) + N)",
"+ else:",
"+ ans += chr(ord(S[i... | false | 0.046315 | 0.085365 | 0.54255 | [
"s107080745",
"s029379908"
] |
u222668979 | p02991 | python | s105915541 | s572132800 | 482 | 423 | 217,256 | 178,400 | Accepted | Accepted | 12.24 | from collections import deque
def nearlist(N, LIST): # 隣接リスト
NEAR = [set() for _ in range(3 * N)]
for a, b in LIST:
a, b = 3 * (a - 1), 3 * (b - 1)
NEAR[a].add(b + 1)
NEAR[a + 1].add(b + 2)
NEAR[a + 2].add(b)
return NEAR
def bfs(S, T, N): # 幅優先探索 # キュー
... | from collections import deque
def nearlist(N, LIST): # 隣接リスト
NEAR = [set() for _ in range(3 * N)]
for a, b in LIST:
a, b = 3 * (a - 1), 3 * (b - 1)
NEAR[a].add(b + 1)
NEAR[a + 1].add(b + 2)
NEAR[a + 2].add(b)
return NEAR
def bfs(S, T, N): # 幅優先探索 # キュー
... | 37 | 37 | 885 | 907 | from collections import deque
def nearlist(N, LIST): # 隣接リスト
NEAR = [set() for _ in range(3 * N)]
for a, b in LIST:
a, b = 3 * (a - 1), 3 * (b - 1)
NEAR[a].add(b + 1)
NEAR[a + 1].add(b + 2)
NEAR[a + 2].add(b)
return NEAR
def bfs(S, T, N): # 幅優先探索 # キュー
S, T = 3 * (... | from collections import deque
def nearlist(N, LIST): # 隣接リスト
NEAR = [set() for _ in range(3 * N)]
for a, b in LIST:
a, b = 3 * (a - 1), 3 * (b - 1)
NEAR[a].add(b + 1)
NEAR[a + 1].add(b + 2)
NEAR[a + 2].add(b)
return NEAR
def bfs(S, T, N): # 幅優先探索 # キュー
S, T = 3 * (... | false | 0 | [
"- dist = [-3] * (3 * N) # 前処理",
"- dist[S] = 0",
"- que, flag = deque([S]), set([S])",
"+ dist, flag = [-3] * (3 * N), [0] * (3 * N) # 前処理",
"+ dist[S], flag[S], que = 0, 1, deque([S])",
"- if i in flag: # 処理済みか否か",
"+ if flag[i]: # 処理済みか否か",
"- que... | false | 0.038897 | 0.061957 | 0.6278 | [
"s105915541",
"s572132800"
] |
u170183831 | p03645 | python | s991187674 | s547516238 | 1,257 | 718 | 114,136 | 54,792 | Accepted | Accepted | 42.88 | from collections import deque
def solve(n, m, AB):
g = [[] for _ in range(n)]
for a, b in AB:
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
q = deque(maxlen = n)
q.append((0, 0))
used = {0}
while len(q) > 0:
i, d = q.popleft()
if d >= 2:
... | n, m = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(m)]
cands = set(b if a == 1 else a for a, b in AB if a == 1 or b == 1)
if any(a in cands and b == n or b in cands and a == n for a, b in AB):
print('POSSIBLE')
else:
print('IMPOSSIBLE')
| 27 | 7 | 682 | 286 | from collections import deque
def solve(n, m, AB):
g = [[] for _ in range(n)]
for a, b in AB:
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
q = deque(maxlen=n)
q.append((0, 0))
used = {0}
while len(q) > 0:
i, d = q.popleft()
if d >= 2:
break
... | n, m = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(m)]
cands = set(b if a == 1 else a for a, b in AB if a == 1 or b == 1)
if any(a in cands and b == n or b in cands and a == n for a, b in AB):
print("POSSIBLE")
else:
print("IMPOSSIBLE")
| false | 74.074074 | [
"-from collections import deque",
"-",
"-",
"-def solve(n, m, AB):",
"- g = [[] for _ in range(n)]",
"- for a, b in AB:",
"- g[a - 1].append(b - 1)",
"- g[b - 1].append(a - 1)",
"- q = deque(maxlen=n)",
"- q.append((0, 0))",
"- used = {0}",
"- while len(q) > 0:"... | false | 0.03982 | 0.042122 | 0.945358 | [
"s991187674",
"s547516238"
] |
u319818856 | p03111 | python | s350244506 | s973473014 | 170 | 82 | 17,780 | 3,064 | Accepted | Accepted | 51.76 | N = 0
N, A, B, C = [int(s) for s in input().split()]
bamboos = [int(eval(input())) for _ in range(N)]
def divide(l):
if len(l) == 0:
return []
if len(l) == 1:
return [
[[], [], []], # 使わない
[[l[0]], [], []], # A で使う
[[], [l[0]], []], # B で使う
... | N = 0
N, A, B, C = [int(s) for s in input().split()]
bamboos = [int(eval(input())) for _ in range(N)]
# def divide(l):
# if len(l) == 0:
# return []
# if len(l) == 1:
# return [
# [[], [], []], # 使わない
# [[l[0]], [], []], # A で使う
# [[], [l[0]]... | 48 | 70 | 1,070 | 1,734 | N = 0
N, A, B, C = [int(s) for s in input().split()]
bamboos = [int(eval(input())) for _ in range(N)]
def divide(l):
if len(l) == 0:
return []
if len(l) == 1:
return [
[[], [], []], # 使わない
[[l[0]], [], []], # A で使う
[[], [l[0]], []], # B で使う
[[... | N = 0
N, A, B, C = [int(s) for s in input().split()]
bamboos = [int(eval(input())) for _ in range(N)]
# def divide(l):
# if len(l) == 0:
# return []
# if len(l) == 1:
# return [
# [[], [], []], # 使わない
# [[l[0]], [], []], # A で使う
# [[], [l[0]], []], # B で使う
... | false | 31.428571 | [
"+# def divide(l):",
"+# if len(l) == 0:",
"+# return []",
"+# if len(l) == 1:",
"+# return [",
"+# [[], [], []], # 使わない",
"+# [[l[0]], [], []], # A で使う",
"+# [[], [l[0]], []], # B で使う",
"+# [[], [], [l[0]]], # C で使う",
"+#... | false | 0.113111 | 0.060642 | 1.865223 | [
"s350244506",
"s973473014"
] |
u933341648 | p03673 | python | s950227518 | s440708324 | 110 | 52 | 25,668 | 26,180 | Accepted | Accepted | 52.73 | n = int(eval(input()))
a = input().split()
if n % 2 == 0:
b = a[::-2] + a[::2]
else:
b = a[::-2] + a[1::2]
print((*b)) | n = int(eval(input()))
a = input().split()
if n % 2 == 0:
b = a[::-2] + a[::2]
else:
b = a[::-2] + a[1::2]
print((' '.join(b))) | 9 | 9 | 128 | 137 | n = int(eval(input()))
a = input().split()
if n % 2 == 0:
b = a[::-2] + a[::2]
else:
b = a[::-2] + a[1::2]
print((*b))
| n = int(eval(input()))
a = input().split()
if n % 2 == 0:
b = a[::-2] + a[::2]
else:
b = a[::-2] + a[1::2]
print((" ".join(b)))
| false | 0 | [
"-print((*b))",
"+print((\" \".join(b)))"
] | false | 0.085398 | 0.045644 | 1.870951 | [
"s950227518",
"s440708324"
] |
u102461423 | p03988 | python | s576538219 | s262066346 | 21 | 18 | 3,316 | 3,064 | Accepted | Accepted | 14.29 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from collections import Counter
# 直径が分かる。中心からの距離が分かる。
N = int(eval(input()))
A = [int(x) for x in input().split()]
diag = max(A)
def solve_even():
# 中心が1頂点
depth = [x-diag//2 for x in A]
if any(x < 0 for x in depth):
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
"""
・直径の長さをdとする。だいたい、半径より下の長さは存在できない
・だいたいd/2より上は任意に足せる。ただし中心は1組のみ
"""
N,*A = list(map(int,read().split()))
def test(A):
D = max(A)
r = (D+1)//2
counter = [0] * (D+1)
fo... | 42 | 31 | 942 | 687 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter
# 直径が分かる。中心からの距離が分かる。
N = int(eval(input()))
A = [int(x) for x in input().split()]
diag = max(A)
def solve_even():
# 中心が1頂点
depth = [x - diag // 2 for x in A]
if any(x < 0 for x in depth):
return F... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
"""
・直径の長さをdとする。だいたい、半径より下の長さは存在できない
・だいたいd/2より上は任意に足せる。ただし中心は1組のみ
"""
N, *A = list(map(int, read().split()))
def test(A):
D = max(A)
r = (D + 1) // 2
counter = [0] * (D + 1)
for x in A... | false | 26.190476 | [
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**7)",
"-from collections import Counter",
"-",
"-# 直径が分かる。中心からの距離が分かる。",
"-N = int(eval(input()))",
"-A = [int(x) for x in input().split()]",
"-diag = max(A)",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+re... | false | 0.044865 | 0.093179 | 0.481494 | [
"s576538219",
"s262066346"
] |
u156815136 | p04047 | python | s802494819 | s325588175 | 39 | 36 | 5,276 | 5,276 | Accepted | Accepted | 7.69 | from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] -... | from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] -... | 34 | 33 | 742 | 729 | from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] - k[j... | from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
# d = m - k[i] - k[j... | false | 2.941176 | [
"- n = int(eval(input())) * 2",
"- L = readInts()",
"- L = sorted(L)",
"- res = 0",
"- for i in range(0, n, 2):",
"- res += L[i]",
"- print(res)",
"+ n = int(eval(input()))",
"+ L = sorted(readInts())",
"+ ans = 0",
"+ for i in range(0, n * 2, 2):",
"+ ... | false | 0.043826 | 0.044037 | 0.995226 | [
"s802494819",
"s325588175"
] |
u994988729 | p03695 | python | s213639625 | s355043269 | 20 | 17 | 3,316 | 3,064 | Accepted | Accepted | 15 | from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
d = defaultdict(int)
strong = 0
for a in A:
if a >= 3200:
strong += 1
continue
d[a // 400] += 1
Cmin = max(len(d), 1)
Cmax = len(d) + strong
print((Cmin, Cmax)) | N = int(eval(input()))
A = list(map(int, input().split()))
d = [0] * 9
for a in A:
if a < 400:
d[0] = 1
elif a < 800:
d[1] = 1
elif a < 1200:
d[2] = 1
elif a < 1600:
d[3] = 1
elif a < 2000:
d[4] = 1
elif a < 2400:
d[5] = 1
eli... | 16 | 28 | 289 | 485 | from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
d = defaultdict(int)
strong = 0
for a in A:
if a >= 3200:
strong += 1
continue
d[a // 400] += 1
Cmin = max(len(d), 1)
Cmax = len(d) + strong
print((Cmin, Cmax))
| N = int(eval(input()))
A = list(map(int, input().split()))
d = [0] * 9
for a in A:
if a < 400:
d[0] = 1
elif a < 800:
d[1] = 1
elif a < 1200:
d[2] = 1
elif a < 1600:
d[3] = 1
elif a < 2000:
d[4] = 1
elif a < 2400:
d[5] = 1
elif a < 2800:
... | false | 42.857143 | [
"-from collections import defaultdict",
"-",
"-d = defaultdict(int)",
"-strong = 0",
"+d = [0] * 9",
"- if a >= 3200:",
"- strong += 1",
"- continue",
"- d[a // 400] += 1",
"-Cmin = max(len(d), 1)",
"-Cmax = len(d) + strong",
"-print((Cmin, Cmax))",
"+ if a < 400:",
... | false | 0.04798 | 0.047045 | 1.019867 | [
"s213639625",
"s355043269"
] |
u186838327 | p02803 | python | s220510644 | s291466057 | 1,907 | 298 | 137,436 | 3,444 | Accepted | Accepted | 84.37 | import sys
input = sys.stdin.readline
def warshal_floyd(d, n):
for k in range(n):
for i in range(n):
for j in range(n):
d[i][j] = min(d[i][j], d[i][k]+d[k][j])
return d
h, w = list(map(int, input().split()))
m = [str(eval(input())) for _ in range(h)]
d = [[float('inf') for... | h, w = list(map(int, input().split()))
M = [str(eval(input())) for _ in range(h)]
M = ['#'*w] + M + ['#'*w]
M = ['#'+c+'#' for c in M]
from collections import deque
ans = 0
for sy in range(1, h+1):
for sx in range(1, w+1):
if M[sy][sx] == '#':
continue
q = deque()
... | 37 | 25 | 851 | 772 | import sys
input = sys.stdin.readline
def warshal_floyd(d, n):
for k in range(n):
for i in range(n):
for j in range(n):
d[i][j] = min(d[i][j], d[i][k] + d[k][j])
return d
h, w = list(map(int, input().split()))
m = [str(eval(input())) for _ in range(h)]
d = [[float("inf")... | h, w = list(map(int, input().split()))
M = [str(eval(input())) for _ in range(h)]
M = ["#" * w] + M + ["#" * w]
M = ["#" + c + "#" for c in M]
from collections import deque
ans = 0
for sy in range(1, h + 1):
for sx in range(1, w + 1):
if M[sy][sx] == "#":
continue
q = deque()
q.... | false | 32.432432 | [
"-import sys",
"+h, w = list(map(int, input().split()))",
"+M = [str(eval(input())) for _ in range(h)]",
"+M = [\"#\" * w] + M + [\"#\" * w]",
"+M = [\"#\" + c + \"#\" for c in M]",
"+from collections import deque",
"-input = sys.stdin.readline",
"-",
"-",
"-def warshal_floyd(d, n):",
"- for ... | false | 0.087792 | 0.061662 | 1.423764 | [
"s220510644",
"s291466057"
] |
u349449706 | p03486 | python | s915627774 | s339403464 | 339 | 63 | 81,304 | 61,752 | Accepted | Accepted | 81.42 | print('Yes') if ''.join(sorted(input())) < ''.join(sorted(input(), reverse=True)) else print('No')
| if ''.join(sorted(eval(input()))) < ''.join(sorted(eval(input()), reverse=True)):
print('Yes')
else:
print('No')
| 1 | 4 | 99 | 112 | print("Yes") if "".join(sorted(input())) < "".join(
sorted(input(), reverse=True)
) else print("No")
| if "".join(sorted(eval(input()))) < "".join(sorted(eval(input()), reverse=True)):
print("Yes")
else:
print("No")
| false | 75 | [
"-print(\"Yes\") if \"\".join(sorted(input())) < \"\".join(",
"- sorted(input(), reverse=True)",
"-) else print(\"No\")",
"+if \"\".join(sorted(eval(input()))) < \"\".join(sorted(eval(input()), reverse=True)):",
"+ print(\"Yes\")",
"+else:",
"+ print(\"No\")"
] | false | 0.045557 | 0.104123 | 0.437527 | [
"s915627774",
"s339403464"
] |
u063896676 | p03208 | python | s057311418 | s597000709 | 238 | 164 | 8,240 | 14,148 | Accepted | Accepted | 31.09 | N, K = list(map(int, input().split()))
h = [None] * N
for i in range(N):
h[i] = int(eval(input()))
h = sorted(h)
sub_min = h[N-1] - h[0]
for i in range(N-K+1):
if h[i+K-1] - h[i] < sub_min:
sub_min = h[i+K-1] - h[i]
print(sub_min) | # coding: utf-8
# https://atcoder.jp/contests/abc115
def main():
N, K = list(map(int, input().split()))
h = [None] * N
for i in range(N):
h[i] = int(eval(input()))
h = sorted(h)
diff = 10**10
for i in range(N-K+1):
newdiff = h[i+K-1]-h[i]
if newdiff <... | 13 | 23 | 249 | 381 | N, K = list(map(int, input().split()))
h = [None] * N
for i in range(N):
h[i] = int(eval(input()))
h = sorted(h)
sub_min = h[N - 1] - h[0]
for i in range(N - K + 1):
if h[i + K - 1] - h[i] < sub_min:
sub_min = h[i + K - 1] - h[i]
print(sub_min)
| # coding: utf-8
# https://atcoder.jp/contests/abc115
def main():
N, K = list(map(int, input().split()))
h = [None] * N
for i in range(N):
h[i] = int(eval(input()))
h = sorted(h)
diff = 10**10
for i in range(N - K + 1):
newdiff = h[i + K - 1] - h[i]
if newdiff < diff:
... | false | 43.478261 | [
"-N, K = list(map(int, input().split()))",
"-h = [None] * N",
"-for i in range(N):",
"- h[i] = int(eval(input()))",
"-h = sorted(h)",
"-sub_min = h[N - 1] - h[0]",
"-for i in range(N - K + 1):",
"- if h[i + K - 1] - h[i] < sub_min:",
"- sub_min = h[i + K - 1] - h[i]",
"-print(sub_min)... | false | 0.043952 | 0.044339 | 0.991272 | [
"s057311418",
"s597000709"
] |
u440180827 | p02380 | python | s714242039 | s404700057 | 30 | 20 | 7,796 | 7,780 | Accepted | Accepted | 33.33 | import math
a, b, C = list(map(int, input().split()))
C = C / 180 * math.pi
S = a * b * math.sin(C) / 2
c = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(C))
print(('{0}'.format(S)))
print(('{0}'.format(a + b + c)))
print(('{0}'.format(2 * S / a))) | import math
a, b, C = list(map(int, input().split()))
C = C / 180 * math.pi
S = a * b * math.sin(C) / 2
print(S)
print((a + b + math.sqrt(a**2 + b**2 - 2*a*b*math.cos(C))))
print((2 * S / a)) | 8 | 7 | 236 | 187 | import math
a, b, C = list(map(int, input().split()))
C = C / 180 * math.pi
S = a * b * math.sin(C) / 2
c = math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(C))
print(("{0}".format(S)))
print(("{0}".format(a + b + c)))
print(("{0}".format(2 * S / a)))
| import math
a, b, C = list(map(int, input().split()))
C = C / 180 * math.pi
S = a * b * math.sin(C) / 2
print(S)
print((a + b + math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(C))))
print((2 * S / a))
| false | 12.5 | [
"-c = math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(C))",
"-print((\"{0}\".format(S)))",
"-print((\"{0}\".format(a + b + c)))",
"-print((\"{0}\".format(2 * S / a)))",
"+print(S)",
"+print((a + b + math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(C))))",
"+print((2 * S / a))"
] | false | 0.052814 | 0.053047 | 0.995596 | [
"s714242039",
"s404700057"
] |
u102278909 | p03103 | python | s195090118 | s592552637 | 449 | 291 | 29,020 | 28,940 | Accepted | Accepted | 35.19 | # coding: utf-8
# import sys
# input = sys.stdin.readline
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for __ in range(N)]
AB.sort(key=lambda x : x[0])
k = 0
ans = 0
while M > 0:
if M > AB[k][1]:
M -= AB[k][1]
ans += AB[k][0] * AB[k][1]
else:
... | # coding: utf-8
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for __ in range(N)]
AB.sort(key=lambda x : x[0])
k = 0
ans = 0
while M > 0:
if M > AB[k][1]:
M -= AB[k][1]
ans += AB[k][0] * AB[k][1]
else:
... | 24 | 24 | 391 | 387 | # coding: utf-8
# import sys
# input = sys.stdin.readline
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for __ in range(N)]
AB.sort(key=lambda x: x[0])
k = 0
ans = 0
while M > 0:
if M > AB[k][1]:
M -= AB[k][1]
ans += AB[k][0] * AB[k][1]
else:
ans += AB[k][0... | # coding: utf-8
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for __ in range(N)]
AB.sort(key=lambda x: x[0])
k = 0
ans = 0
while M > 0:
if M > AB[k][1]:
M -= AB[k][1]
ans += AB[k][0] * AB[k][1]
else:
ans += AB[k][0] *... | false | 0 | [
"-# import sys",
"-# input = sys.stdin.readline",
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.038113 | 0.037226 | 1.023829 | [
"s195090118",
"s592552637"
] |
u227082700 | p02620 | python | s417922307 | s366854057 | 433 | 323 | 22,180 | 22,092 | Accepted | Accepted | 25.4 | from bisect import bisect_left,insort_left
d=int(eval(input()))
c=list(map(int,input().split()))
s=[list(map(int,input().split()))for _ in range(d)]
t=[int(eval(input()))for _ in range(d)]
m=int(eval(input()))
dq=[list(map(int,input().split()))for _ in range(m)]
x=[[0]for _ in range(26)]
ans=0
for i in range(d... | import sys
input=sys.stdin.readline
from bisect import bisect_left,insort_left
d=int(eval(input()))
c=list(map(int,input().split()))
s=[list(map(int,input().split()))for _ in range(d)]
t=[int(eval(input()))for _ in range(d)]
m=int(eval(input()))
dq=[list(map(int,input().split()))for _ in range(m)]
x=[[0]for _ ... | 31 | 34 | 769 | 838 | from bisect import bisect_left, insort_left
d = int(eval(input()))
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
t = [int(eval(input())) for _ in range(d)]
m = int(eval(input()))
dq = [list(map(int, input().split())) for _ in range(m)]
x = [[0] for _ in range(26)]
ans = 0
... | import sys
input = sys.stdin.readline
from bisect import bisect_left, insort_left
d = int(eval(input()))
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
t = [int(eval(input())) for _ in range(d)]
m = int(eval(input()))
dq = [list(map(int, input().split())) for _ in range(m)... | false | 8.823529 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"- x[t[i] - 1].append(i + 1)",
"- ans += s[i][t[i] - 1]",
"- for j in range(26):",
"- ans -= ((i + 1) - x[j][-1]) * c[j]",
"+ v = t[i] - 1",
"+ ans += s[i][v] - c[v] * (i - x[v][-1] + 1) * (i - x[v][-1]) // 2",
"+ x[v].app... | false | 0.081491 | 0.096646 | 0.84319 | [
"s417922307",
"s366854057"
] |
u626891113 | p03799 | python | s282024147 | s658518315 | 269 | 76 | 63,964 | 64,172 | Accepted | Accepted | 71.75 | n, m = list(map(int, input().split()))
if n*2 < m:
while n*2 <= m:
if m-n - n > 10000:
m -= 6000
n += 3000
else:
m -= 2
n += 1
print((n - 1))
else:
print((m//2)) | n, m = list(map(int, input().split()))
if n*2 < m:
while n*2 <= m:
if m - 2*n > 100000:
m -= 60000
n += 30000
elif m - 2*n > 10000:
m -= 6000
n += 3000
else:
m -= 2
n += 1
print((n - 1))
else:
print... | 12 | 15 | 238 | 318 | n, m = list(map(int, input().split()))
if n * 2 < m:
while n * 2 <= m:
if m - n - n > 10000:
m -= 6000
n += 3000
else:
m -= 2
n += 1
print((n - 1))
else:
print((m // 2))
| n, m = list(map(int, input().split()))
if n * 2 < m:
while n * 2 <= m:
if m - 2 * n > 100000:
m -= 60000
n += 30000
elif m - 2 * n > 10000:
m -= 6000
n += 3000
else:
m -= 2
n += 1
print((n - 1))
else:
print((m //... | false | 20 | [
"- if m - n - n > 10000:",
"+ if m - 2 * n > 100000:",
"+ m -= 60000",
"+ n += 30000",
"+ elif m - 2 * n > 10000:"
] | false | 0.044572 | 0.03835 | 1.162238 | [
"s282024147",
"s658518315"
] |
u193264896 | p03309 | python | s290345600 | s001036748 | 219 | 146 | 27,724 | 40,104 | Accepted | Accepted | 33.33 |
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from functools import reduce
from collections import deque, Counter, defaultdict
from itertools import product, p... | import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
import numpy as np
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
n = int(readline())
a = np.array(readline().split(), np.int64)
a -= np.arange(1, n + 1)
median = np.median(a).astype(np.... | 38 | 22 | 1,044 | 414 | from scipy.sparse.csgraph import (
shortest_path,
floyd_warshall,
dijkstra,
bellman_ford,
johnson,
minimum_spanning_tree,
)
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from functools import reduce
from collections import deque, Counter, defaultdict
from itertoo... | import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
import numpy as np
sys.setrecursionlimit(10**8)
INF = float("inf")
MOD = 10**9 + 7
def main():
n = int(readline())
a = np.array(readline().split(), np.int64)
a -= np.arange(1, n + 1)
median = np.median(a).astype(np.int64)
prin... | false | 42.105263 | [
"-from scipy.sparse.csgraph import (",
"- shortest_path,",
"- floyd_warshall,",
"- dijkstra,",
"- bellman_ford,",
"- johnson,",
"- minimum_spanning_tree,",
"-)",
"-from scipy.sparse import csr_matrix, coo_matrix, lil_matrix",
"-import numpy as np",
"-from functools import reduc... | false | 0.726399 | 0.480872 | 1.510585 | [
"s290345600",
"s001036748"
] |
u458315482 | p02862 | python | s294780240 | s406581479 | 1,328 | 985 | 122,220 | 87,700 | Accepted | Accepted | 25.83 | x, y = list(map(int, input().split()))
MOD = int(1.0e+9 + 7)
DP_max = 3333334
DP = []
X = int((2 * y - x) / 3)
Y = int((2 * x - y) / 3)
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n-r] % p
p = 10 ** 9 + 7
N = 10 ** 6... | x, y = list(map(int, input().split()))
def cmb(n, r, mod):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n-r] % mod
X = int((2 * y - x) / 3)
Y = int((2 * x - y) / 3)
MOD = int(1.0e+9 + 7)
N = int(7.0e+5) # N は必要分だけ用意する
fact = [1, 1] # fact[n... | 32 | 27 | 758 | 727 | x, y = list(map(int, input().split()))
MOD = int(1.0e9 + 7)
DP_max = 3333334
DP = []
X = int((2 * y - x) / 3)
Y = int((2 * x - y) / 3)
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n - r] % p
p = 10**9 + 7
N = 10**6 # N は必要分だけ用意する
fact... | x, y = list(map(int, input().split()))
def cmb(n, r, mod):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n - r] % mod
X = int((2 * y - x) / 3)
Y = int((2 * x - y) / 3)
MOD = int(1.0e9 + 7)
N = int(7.0e5) # N は必要分だけ用意する
fact = [1, 1] # fact[n] = (n! mod... | false | 15.625 | [
"-MOD = int(1.0e9 + 7)",
"-DP_max = 3333334",
"-DP = []",
"-X = int((2 * y - x) / 3)",
"-Y = int((2 * x - y) / 3)",
"-def cmb(n, r, p):",
"+def cmb(n, r, mod):",
"- return fact[n] * factinv[r] * factinv[n - r] % p",
"+ return fact[n] * factinv[r] * factinv[n - r] % mod",
"-p = 10**9 + 7",
... | false | 1.839082 | 1.791128 | 1.026773 | [
"s294780240",
"s406581479"
] |
u738898077 | p03252 | python | s716748289 | s856528401 | 133 | 103 | 14,000 | 3,632 | Accepted | Accepted | 22.56 | s = str(eval(input()))
t = str(eval(input()))
ls = [[0] for i in range(26)]
lt = [[0] for i in range(26)]
for i in range(len(s)):
ls[ord(s[i])-97].append(i)
lt[ord(t[i])-97].append(i)
# print(ls)
# print(lt)
for i in ls:
f = 0
for j in lt:
if i==j:
f = 1
b... | """
嘘解法です.通るかな?
コーナーケース:
in:
abab
aabb
Out:
Yes
(本当はNo)
"""
s = str(eval(input()))
t = str(eval(input()))
ls = [0]*26
lt = [0]*26
for i in range(len(s)):
ls[ord(s[i])-97] += 1
lt[ord(t[i])-97] += 1
ls.sort()
lt.sort()
if lt == ls:
print("Yes")
else:
print("No") | 20 | 23 | 379 | 303 | s = str(eval(input()))
t = str(eval(input()))
ls = [[0] for i in range(26)]
lt = [[0] for i in range(26)]
for i in range(len(s)):
ls[ord(s[i]) - 97].append(i)
lt[ord(t[i]) - 97].append(i)
# print(ls)
# print(lt)
for i in ls:
f = 0
for j in lt:
if i == j:
f = 1
break
i... | """
嘘解法です.通るかな?
コーナーケース:
in:
abab
aabb
Out:
Yes
(本当はNo)
"""
s = str(eval(input()))
t = str(eval(input()))
ls = [0] * 26
lt = [0] * 26
for i in range(len(s)):
ls[ord(s[i]) - 97] += 1
lt[ord(t[i]) - 97] += 1
ls.sort()
lt.sort()
if lt == ls:
print("Yes")
else:
print("No")
| false | 13.043478 | [
"+\"\"\"",
"+嘘解法です.通るかな?",
"+コーナーケース:",
"+in:",
"+ abab",
"+ aabb",
"+Out:",
"+ Yes",
"+ (本当はNo)",
"+\"\"\"",
"-ls = [[0] for i in range(26)]",
"-lt = [[0] for i in range(26)]",
"+ls = [0] * 26",
"+lt = [0] * 26",
"- ls[ord(s[i]) - 97].append(i)",
"- lt[ord(t[i]) - 97... | false | 0.062152 | 0.061195 | 1.015638 | [
"s716748289",
"s856528401"
] |
u094999522 | p02912 | python | s322803508 | s370005141 | 1,204 | 128 | 84,864 | 19,988 | Accepted | Accepted | 89.37 | #!/usr/bin/env python3
from bisect import insort_right
n, m, *a = list(map(int, open(0).read().split()))
a.sort()
for _ in range(m):
insort_right(a, a.pop() >> 1)
print((sum(a)))
| #!/usr/bin/env python3
import heapq
n, m, *a = list(map(int, open(0).read().split()))
a = [*[-x for x in a]]
heapq.heapify(a)
for _ in range(m):
heapq.heappush(a, -(-heapq.heappop(a) >> 1))
print((-sum(a)))
| 9 | 11 | 185 | 221 | #!/usr/bin/env python3
from bisect import insort_right
n, m, *a = list(map(int, open(0).read().split()))
a.sort()
for _ in range(m):
insort_right(a, a.pop() >> 1)
print((sum(a)))
| #!/usr/bin/env python3
import heapq
n, m, *a = list(map(int, open(0).read().split()))
a = [*[-x for x in a]]
heapq.heapify(a)
for _ in range(m):
heapq.heappush(a, -(-heapq.heappop(a) >> 1))
print((-sum(a)))
| false | 18.181818 | [
"-from bisect import insort_right",
"+import heapq",
"-a.sort()",
"+a = [*[-x for x in a]]",
"+heapq.heapify(a)",
"- insort_right(a, a.pop() >> 1)",
"-print((sum(a)))",
"+ heapq.heappush(a, -(-heapq.heappop(a) >> 1))",
"+print((-sum(a)))"
] | false | 0.052693 | 0.04151 | 1.269411 | [
"s322803508",
"s370005141"
] |
u185896732 | p03497 | python | s750143285 | s466098307 | 358 | 198 | 97,084 | 39,288 | Accepted | Accepted | 44.69 | import os,re,sys,operator,math
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations,groupby
from sys import stdin,setrecursionlimit
from copy import deepcopy
import heapq
setrecursionlimit(10**6)
n,k=list(map(int,stdin.readline().rstrip().split())... |
from collections import Counter
n,k=list(map(int,input().split()))
a=[int(i) for i in input().split()]
c=Counter(a).most_common()
c.sort(key=lambda x: x[1])
#print(c)
l=len(c)
print((sum(c[i][1] for i in range(l-k)))) | 17 | 10 | 475 | 220 | import os, re, sys, operator, math
from collections import Counter, deque
from operator import itemgetter
from itertools import accumulate, combinations, groupby
from sys import stdin, setrecursionlimit
from copy import deepcopy
import heapq
setrecursionlimit(10**6)
n, k = list(map(int, stdin.readline().rstrip().split... | from collections import Counter
n, k = list(map(int, input().split()))
a = [int(i) for i in input().split()]
c = Counter(a).most_common()
c.sort(key=lambda x: x[1])
# print(c)
l = len(c)
print((sum(c[i][1] for i in range(l - k))))
| false | 41.176471 | [
"-import os, re, sys, operator, math",
"-from collections import Counter, deque",
"-from operator import itemgetter",
"-from itertools import accumulate, combinations, groupby",
"-from sys import stdin, setrecursionlimit",
"-from copy import deepcopy",
"-import heapq",
"+from collections import Counte... | false | 0.04719 | 0.128907 | 0.366076 | [
"s750143285",
"s466098307"
] |
u867848444 | p03164 | python | s925749997 | s379082411 | 1,134 | 467 | 311,632 | 119,772 | Accepted | Accepted | 58.82 | N,W=list(map(int,input().split()))
w=[]
v=[]
for i in range(N):
x,y=list(map(int,input().split()))
w+=[x]
v+=[y]
V_sum=sum(v)+1
dp=[[float('inf')]*(V_sum) for i in range(N+1)]
dp[0][0]=0
for i in range(1,N+1):
for sum_v in range(V_sum):
#同価値の場合より軽いほうを入れる
if sum_v-v[i-1]>=0... | n, W = list(map(int,input().split()))
wv = [list(map(int,input().split())) for i in range(n)]
inf = 10 ** 10
dp = [[inf] * (1000 * n + 1) for i in range(n + 1)]
dp[0][0] = 0
for i in range(n):
for j in range(1000 * n + 1):
if dp[i][j] == inf:continue
dp[i + 1][j] = min(dp[i + 1][j], dp[i][... | 24 | 19 | 531 | 551 | N, W = list(map(int, input().split()))
w = []
v = []
for i in range(N):
x, y = list(map(int, input().split()))
w += [x]
v += [y]
V_sum = sum(v) + 1
dp = [[float("inf")] * (V_sum) for i in range(N + 1)]
dp[0][0] = 0
for i in range(1, N + 1):
for sum_v in range(V_sum):
# 同価値の場合より軽いほうを入れる
i... | n, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for i in range(n)]
inf = 10**10
dp = [[inf] * (1000 * n + 1) for i in range(n + 1)]
dp[0][0] = 0
for i in range(n):
for j in range(1000 * n + 1):
if dp[i][j] == inf:
continue
dp[i + 1][j] = min(dp[i + 1][j], dp[... | false | 20.833333 | [
"-N, W = list(map(int, input().split()))",
"-w = []",
"-v = []",
"-for i in range(N):",
"- x, y = list(map(int, input().split()))",
"- w += [x]",
"- v += [y]",
"-V_sum = sum(v) + 1",
"-dp = [[float(\"inf\")] * (V_sum) for i in range(N + 1)]",
"+n, W = list(map(int, input().split()))",
"... | false | 0.043378 | 0.048359 | 0.896987 | [
"s925749997",
"s379082411"
] |
u021019433 | p02947 | python | s712363061 | s530295194 | 404 | 357 | 23,908 | 18,236 | Accepted | Accepted | 11.63 | from collections import Counter
c = Counter(tuple(sorted(eval(input()))) for _ in range(int(eval(input()))))
print((sum(x * (x - 1) // 2 for x in list(c.values()))))
| from collections import Counter
c = Counter(''.join(sorted(eval(input()))) for _ in range(int(eval(input()))))
print((sum(x * (x - 1) // 2 for x in list(c.values()))))
| 3 | 3 | 148 | 150 | from collections import Counter
c = Counter(tuple(sorted(eval(input()))) for _ in range(int(eval(input()))))
print((sum(x * (x - 1) // 2 for x in list(c.values()))))
| from collections import Counter
c = Counter("".join(sorted(eval(input()))) for _ in range(int(eval(input()))))
print((sum(x * (x - 1) // 2 for x in list(c.values()))))
| false | 0 | [
"-c = Counter(tuple(sorted(eval(input()))) for _ in range(int(eval(input()))))",
"+c = Counter(\"\".join(sorted(eval(input()))) for _ in range(int(eval(input()))))"
] | false | 0.038732 | 0.040563 | 0.954856 | [
"s712363061",
"s530295194"
] |
u997641430 | p03160 | python | s058157967 | s284208964 | 151 | 119 | 13,976 | 13,980 | Accepted | Accepted | 21.19 | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [10 ** 10] * N
# dp[n]はあとnのところからのN-1に行くのに支払うコストの最小値
dp[0] = 0
dp[1] = abs(h[N-1]-h[N-2])
for n in range(0, N-2):
dp[n+2] = min(dp[n+1]+abs(h[(N-1)-(n+2)]-h[(N-1)-(n+1)]),
dp[n]+abs(h[(N-1)-(n+2)]-h[(N-1)-n]))
print((dp[N-1]))... | N = int(eval(input()))
h = list(map(int, input().split()))
a, b = 0, abs(h[0] - h[1])
for n in range(N - 2):
a, b = b, min(a + abs(h[n] - h[n + 2]), b + abs(h[n + 1] - h[n + 2]))
print(b)
| 10 | 6 | 313 | 191 | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [10**10] * N
# dp[n]はあとnのところからのN-1に行くのに支払うコストの最小値
dp[0] = 0
dp[1] = abs(h[N - 1] - h[N - 2])
for n in range(0, N - 2):
dp[n + 2] = min(
dp[n + 1] + abs(h[(N - 1) - (n + 2)] - h[(N - 1) - (n + 1)]),
dp[n] + abs(h[(N - 1) - (n + 2)] - h[(... | N = int(eval(input()))
h = list(map(int, input().split()))
a, b = 0, abs(h[0] - h[1])
for n in range(N - 2):
a, b = b, min(a + abs(h[n] - h[n + 2]), b + abs(h[n + 1] - h[n + 2]))
print(b)
| false | 40 | [
"-dp = [10**10] * N",
"-# dp[n]はあとnのところからのN-1に行くのに支払うコストの最小値",
"-dp[0] = 0",
"-dp[1] = abs(h[N - 1] - h[N - 2])",
"-for n in range(0, N - 2):",
"- dp[n + 2] = min(",
"- dp[n + 1] + abs(h[(N - 1) - (n + 2)] - h[(N - 1) - (n + 1)]),",
"- dp[n] + abs(h[(N - 1) - (n + 2)] - h[(N - 1) - n]... | false | 0.061425 | 0.093703 | 0.655532 | [
"s058157967",
"s284208964"
] |
u372144784 | p03167 | python | s640118008 | s218302489 | 316 | 239 | 87,792 | 51,312 | Accepted | Accepted | 24.37 | #Educational DP Contest
#H-Grid1
h,w = list(map(int,input().split()))
maze = [list(list(eval(input()))) for i in range(h)]
mod = 10**9+7
#dp table
#座標をそのままdpテーブルとして見立てることができる。
#要素はその場所まで行ける手順の数
dp = [[0]*w for _ in range(h)]
dp[0][0] = 1
#process1
#移動は→↓の2通りのみなので、その方向に探索していけば良い。
for i in range(h):... | import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
h,w = list(map(int,readline().split()))
maze = []
for _ in range(h):
maze.append(readline().rstrip().decode('utf-8'))
dp = [[0]*w for _ in range(h)]
dp[0][0] = 1
for i in range(h):
for j in range(w):
if maze[i][j] ... | 30 | 22 | 578 | 456 | # Educational DP Contest
# H-Grid1
h, w = list(map(int, input().split()))
maze = [list(list(eval(input()))) for i in range(h)]
mod = 10**9 + 7
# dp table
# 座標をそのままdpテーブルとして見立てることができる。
# 要素はその場所まで行ける手順の数
dp = [[0] * w for _ in range(h)]
dp[0][0] = 1
# process1
# 移動は→↓の2通りのみなので、その方向に探索していけば良い。
for i in range(h):
for ... | import sys
readline = sys.stdin.buffer.readline
def even(n):
return 1 if n % 2 == 0 else 0
h, w = list(map(int, readline().split()))
maze = []
for _ in range(h):
maze.append(readline().rstrip().decode("utf-8"))
dp = [[0] * w for _ in range(h)]
dp[0][0] = 1
for i in range(h):
for j in range(w):
... | false | 26.666667 | [
"-# Educational DP Contest",
"-# H-Grid1",
"-h, w = list(map(int, input().split()))",
"-maze = [list(list(eval(input()))) for i in range(h)]",
"-mod = 10**9 + 7",
"-# dp table",
"-# 座標をそのままdpテーブルとして見立てることができる。",
"-# 要素はその場所まで行ける手順の数",
"+import sys",
"+",
"+readline = sys.stdin.buffer.readline",
... | false | 0.038846 | 0.034774 | 1.117081 | [
"s640118008",
"s218302489"
] |
u899308536 | p02726 | python | s685006014 | s509338774 | 1,628 | 1,330 | 3,444 | 3,444 | Accepted | Accepted | 18.3 | N,X,Y = list(map(int,input().split()))
D= [0]*(N-1)
# print(X,Y)
for i in range(1,N+1):
for j in range(i+1,N+1): # i<j
# print((i,j))
# ver 1
if j<=X or Y<=i:
d = j-i
# ver 2
elif i<=X and Y<=j:
d = X-i + 1 + j-Y
... | N,X,Y = list(map(int,input().split()))
D= [0]*(N-1)
for i in range(1,N+1):
for j in range(i+1,N+1): # i<j
d = min(j-i,abs(X-i)+abs(Y-j)+1)
D[d-1] += 1
for d in D:
print(d) | 24 | 8 | 475 | 196 | N, X, Y = list(map(int, input().split()))
D = [0] * (N - 1)
# print(X,Y)
for i in range(1, N + 1):
for j in range(i + 1, N + 1): # i<j
# print((i,j))
# ver 1
if j <= X or Y <= i:
d = j - i
# ver 2
elif i <= X and Y <= j:
d = X - i + 1 + j - Y
... | N, X, Y = list(map(int, input().split()))
D = [0] * (N - 1)
for i in range(1, N + 1):
for j in range(i + 1, N + 1): # i<j
d = min(j - i, abs(X - i) + abs(Y - j) + 1)
D[d - 1] += 1
for d in D:
print(d)
| false | 66.666667 | [
"-# print(X,Y)",
"- # print((i,j))",
"- # ver 1",
"- if j <= X or Y <= i:",
"- d = j - i",
"- # ver 2",
"- elif i <= X and Y <= j:",
"- d = X - i + 1 + j - Y",
"- # ver 3",
"- else:",
"- d = min(j - i, abs(X - i) +... | false | 0.09675 | 0.139696 | 0.692576 | [
"s685006014",
"s509338774"
] |
u151503168 | p02990 | python | s086870081 | s861147562 | 521 | 20 | 3,316 | 3,316 | Accepted | Accepted | 96.16 | # -*- coding:utf-8 -*-
def cmb(n, r):
if n == 0 or r == 0:
return 1
if n < r:
return 0
a = b = 1
r = min(n-r,r)
for i in range(1, r + 1):
a *= i
for i in range(n-r+1,n+1):
b *= i
return b//a
N = list(map(int,input().split()))
M = 10**9 + 7
r... | N = list(map(int,input().split()))
M = 10**9 + 7
red = N[0] - N[1]
x = red+1
print(x)
for i in range(2,N[1]+1):
x = x*(red+2-i)*(N[1]-i+1)//(i*(i-1))
print((int(x%M))) | 21 | 8 | 423 | 180 | # -*- coding:utf-8 -*-
def cmb(n, r):
if n == 0 or r == 0:
return 1
if n < r:
return 0
a = b = 1
r = min(n - r, r)
for i in range(1, r + 1):
a *= i
for i in range(n - r + 1, n + 1):
b *= i
return b // a
N = list(map(int, input().split()))
M = 10**9 + 7
red =... | N = list(map(int, input().split()))
M = 10**9 + 7
red = N[0] - N[1]
x = red + 1
print(x)
for i in range(2, N[1] + 1):
x = x * (red + 2 - i) * (N[1] - i + 1) // (i * (i - 1))
print((int(x % M)))
| false | 61.904762 | [
"-# -*- coding:utf-8 -*-",
"-def cmb(n, r):",
"- if n == 0 or r == 0:",
"- return 1",
"- if n < r:",
"- return 0",
"- a = b = 1",
"- r = min(n - r, r)",
"- for i in range(1, r + 1):",
"- a *= i",
"- for i in range(n - r + 1, n + 1):",
"- b *= i",
... | false | 0.092726 | 0.035968 | 2.577991 | [
"s086870081",
"s861147562"
] |
u869919400 | p02554 | python | s808458609 | s484920008 | 69 | 62 | 61,684 | 61,756 | Accepted | Accepted | 10.14 | N = int(eval(input()))
mod = 10**9+7
ans = pow(10, N, mod) - ((pow(9, N, mod) * 2) - pow(8, N, mod))
ans %= mod
print(ans) | N = int(eval(input()))
mod = 10**9+7
print(((pow(10, N, mod) - ((pow(9, N, mod) * 2 % mod) - pow(8, N, mod))) % mod)) | 5 | 3 | 120 | 111 | N = int(eval(input()))
mod = 10**9 + 7
ans = pow(10, N, mod) - ((pow(9, N, mod) * 2) - pow(8, N, mod))
ans %= mod
print(ans)
| N = int(eval(input()))
mod = 10**9 + 7
print(((pow(10, N, mod) - ((pow(9, N, mod) * 2 % mod) - pow(8, N, mod))) % mod))
| false | 40 | [
"-ans = pow(10, N, mod) - ((pow(9, N, mod) * 2) - pow(8, N, mod))",
"-ans %= mod",
"-print(ans)",
"+print(((pow(10, N, mod) - ((pow(9, N, mod) * 2 % mod) - pow(8, N, mod))) % mod))"
] | false | 0.079985 | 0.06559 | 1.219467 | [
"s808458609",
"s484920008"
] |
u977389981 | p03213 | python | s678421991 | s792612824 | 20 | 18 | 3,188 | 3,064 | Accepted | Accepted | 10 | n = int(eval(input()))
e = [0] * (n+1)
for i in range(2, n+1):
for j in range(2, i+1):
while i % j == 0:
e[j] += 1
i //= j
def count(m):
return len(list([x for x in e if x >= m-1]))
a = count(75)
b = count(25) * (count(3) - 1)
c = count(15) * (count(5... | n = int(eval(input()))
def nprf(m):
pf = {}
for i in range(2, m + 1):
for j in range(2, i + 1):
while i % j == 0:
pf[j] = pf.get(j, 0) + 1
i //= j
return pf
def c(P, m):
count = 0
for i in P:
if P[i] >= m - 1:
c... | 18 | 26 | 400 | 541 | n = int(eval(input()))
e = [0] * (n + 1)
for i in range(2, n + 1):
for j in range(2, i + 1):
while i % j == 0:
e[j] += 1
i //= j
def count(m):
return len(list([x for x in e if x >= m - 1]))
a = count(75)
b = count(25) * (count(3) - 1)
c = count(15) * (count(5) - 1)
d = count(... | n = int(eval(input()))
def nprf(m):
pf = {}
for i in range(2, m + 1):
for j in range(2, i + 1):
while i % j == 0:
pf[j] = pf.get(j, 0) + 1
i //= j
return pf
def c(P, m):
count = 0
for i in P:
if P[i] >= m - 1:
count += 1
... | false | 30.769231 | [
"-e = [0] * (n + 1)",
"-for i in range(2, n + 1):",
"- for j in range(2, i + 1):",
"- while i % j == 0:",
"- e[j] += 1",
"- i //= j",
"-def count(m):",
"- return len(list([x for x in e if x >= m - 1]))",
"+def nprf(m):",
"+ pf = {}",
"+ for i in range(2, ... | false | 0.041111 | 0.035883 | 1.145687 | [
"s678421991",
"s792612824"
] |
u832039789 | p02833 | python | s777936138 | s799596306 | 36 | 18 | 5,044 | 2,940 | Accepted | Accepted | 50 | import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
if f:
print('Yes')
... | n = int(eval(input()))
if n <= 4:
print((0))
exit()
if n % 2 == 0:
m = n // 2
res = 0
for i in range(1, 100):
res += m // (5 ** i)
print(res)
else:
print((0))
| 42 | 14 | 762 | 200 | import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
if f:
print("Yes")
else:... | n = int(eval(input()))
if n <= 4:
print((0))
exit()
if n % 2 == 0:
m = n // 2
res = 0
for i in range(1, 100):
res += m // (5**i)
print(res)
else:
print((0))
| false | 66.666667 | [
"-import sys",
"-from fractions import gcd",
"-from itertools import groupby as gb",
"-from itertools import permutations as perm",
"-from itertools import combinations as comb",
"-from collections import Counter as C",
"-from collections import defaultdict as dd",
"-",
"-sys.setrecursionlimit(10**5... | false | 0.039034 | 0.048405 | 0.806392 | [
"s777936138",
"s799596306"
] |
u391540332 | p02715 | python | s759822776 | s647783169 | 395 | 354 | 20,656 | 20,656 | Accepted | Accepted | 10.38 | n, k = (int(x) for x in input().split())
c = {}
t = 0
MOD = 1000000007
for x in range(k, 0, -1):
q = k // x
c[x] = pow(q, n, MOD) - sum(c[x * y] for y in range(2, q + 1))
t += c[x] * x
t = t % 1000000007
print(t)
| n, k = (int(x) for x in input().split())
c = {}
t = 0
MOD = 1000000007
for x in range(k, 0, -1):
q = k // x
c[x] = pow(q, n, MOD) - sum(c[x * y] for y in range(2, q + 1))
t += c[x] * x
t = t % MOD
print(t) | 10 | 10 | 239 | 231 | n, k = (int(x) for x in input().split())
c = {}
t = 0
MOD = 1000000007
for x in range(k, 0, -1):
q = k // x
c[x] = pow(q, n, MOD) - sum(c[x * y] for y in range(2, q + 1))
t += c[x] * x
t = t % 1000000007
print(t)
| n, k = (int(x) for x in input().split())
c = {}
t = 0
MOD = 1000000007
for x in range(k, 0, -1):
q = k // x
c[x] = pow(q, n, MOD) - sum(c[x * y] for y in range(2, q + 1))
t += c[x] * x
t = t % MOD
print(t)
| false | 0 | [
"- t = t % 1000000007",
"+ t = t % MOD"
] | false | 0.139601 | 0.318881 | 0.437784 | [
"s759822776",
"s647783169"
] |
u497952650 | p02773 | python | s062530783 | s425067361 | 1,028 | 921 | 45,084 | 45,036 | Accepted | Accepted | 10.41 | from collections import Counter
N = int(eval(input()))
S = []
for i in range(N):
S.append(eval(input()))
S.sort()
c = Counter(S).most_common()
m = c[0][1]
c.sort()
for i in range(len(c)):
if c[i][1] == m:
print((c[i][0])) | from collections import Counter
N = int(eval(input()))
S = []
for i in range(N):
S.append(eval(input()))
count = Counter(S).most_common()
mode = count[0][1]
count.sort()
##print("--")
for i in range(len(count)):
if count[i][1] == mode:
print((count[i][0]))
| 13 | 14 | 232 | 274 | from collections import Counter
N = int(eval(input()))
S = []
for i in range(N):
S.append(eval(input()))
S.sort()
c = Counter(S).most_common()
m = c[0][1]
c.sort()
for i in range(len(c)):
if c[i][1] == m:
print((c[i][0]))
| from collections import Counter
N = int(eval(input()))
S = []
for i in range(N):
S.append(eval(input()))
count = Counter(S).most_common()
mode = count[0][1]
count.sort()
##print("--")
for i in range(len(count)):
if count[i][1] == mode:
print((count[i][0]))
| false | 7.142857 | [
"-S.sort()",
"-c = Counter(S).most_common()",
"-m = c[0][1]",
"-c.sort()",
"-for i in range(len(c)):",
"- if c[i][1] == m:",
"- print((c[i][0]))",
"+count = Counter(S).most_common()",
"+mode = count[0][1]",
"+count.sort()",
"+##print(\"--\")",
"+for i in range(len(count)):",
"+ ... | false | 0.045386 | 0.047364 | 0.958239 | [
"s062530783",
"s425067361"
] |
u102126195 | p03785 | python | s028743156 | s395252752 | 1,725 | 255 | 7,384 | 7,440 | Accepted | Accepted | 85.22 | N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for i in range(N)]
T.sort()
#print(T)
Bcnt = 0
while True:
if len(T) <= 0:
break
BS = T[0] + K
Bcnt += 1
del T[0]
cnt = 1
while cnt < C and len(T) > 0:
if T[0] <= BS:
del T[0]
... | N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for i in range(N)]
T.sort()
#print(T)
Bcnt = 0
i = 0
while True:
if len(T) <= i:
break
BS = T[i] + K
Bcnt += 1
i += 1
cnt = 1
while cnt < C and len(T) > i:
if T[i] <= BS:
i += 1
... | 19 | 20 | 365 | 368 | N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for i in range(N)]
T.sort()
# print(T)
Bcnt = 0
while True:
if len(T) <= 0:
break
BS = T[0] + K
Bcnt += 1
del T[0]
cnt = 1
while cnt < C and len(T) > 0:
if T[0] <= BS:
del T[0]
cnt += 1
... | N, C, K = list(map(int, input().split()))
T = [int(eval(input())) for i in range(N)]
T.sort()
# print(T)
Bcnt = 0
i = 0
while True:
if len(T) <= i:
break
BS = T[i] + K
Bcnt += 1
i += 1
cnt = 1
while cnt < C and len(T) > i:
if T[i] <= BS:
i += 1
cnt += 1
... | false | 5 | [
"+i = 0",
"- if len(T) <= 0:",
"+ if len(T) <= i:",
"- BS = T[0] + K",
"+ BS = T[i] + K",
"- del T[0]",
"+ i += 1",
"- while cnt < C and len(T) > 0:",
"- if T[0] <= BS:",
"- del T[0]",
"+ while cnt < C and len(T) > i:",
"+ if T[i] <= BS:",
"+ ... | false | 0.084325 | 0.081721 | 1.031864 | [
"s028743156",
"s395252752"
] |
u539281377 | p02844 | python | s943811435 | s275316122 | 858 | 20 | 3,188 | 3,064 | Accepted | Accepted | 97.67 | N=int(eval(input()))
S=eval(input())
ans=[set(),set(),set()]
for i in S:
for j in ans[1]:
ans[2].add(j+i)
for j in ans[0]:
ans[1].add(j+i)
ans[0].add(i)
print((len(ans[2]))) | N=int(eval(input()))
S=eval(input())
ans=0
for i in range(1000):
t=str(i).zfill(3)
a=S.find(t[0])
b=S.find(t[1],a+1)
c=S.find(t[2],b+1)
if a!=-1 and b!=-1 and c!=-1:
ans+=1
print(ans) | 10 | 11 | 196 | 209 | N = int(eval(input()))
S = eval(input())
ans = [set(), set(), set()]
for i in S:
for j in ans[1]:
ans[2].add(j + i)
for j in ans[0]:
ans[1].add(j + i)
ans[0].add(i)
print((len(ans[2])))
| N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1000):
t = str(i).zfill(3)
a = S.find(t[0])
b = S.find(t[1], a + 1)
c = S.find(t[2], b + 1)
if a != -1 and b != -1 and c != -1:
ans += 1
print(ans)
| false | 9.090909 | [
"-ans = [set(), set(), set()]",
"-for i in S:",
"- for j in ans[1]:",
"- ans[2].add(j + i)",
"- for j in ans[0]:",
"- ans[1].add(j + i)",
"- ans[0].add(i)",
"-print((len(ans[2])))",
"+ans = 0",
"+for i in range(1000):",
"+ t = str(i).zfill(3)",
"+ a = S.find(t[0])"... | false | 0.075182 | 0.032345 | 2.324367 | [
"s943811435",
"s275316122"
] |
u886274153 | p03964 | python | s240239128 | s616391656 | 94 | 38 | 5,032 | 5,076 | Accepted | Accepted | 59.57 | import math
from decimal import *
n = int(eval(input()))
l = [[int(i) for i in input().split()] for j in range(n)]
def newT(t, ratio):
a = Decimal(t[0]) / Decimal(ratio[0])
b = Decimal(t[1]) / Decimal(ratio[1])
if a <= 1 and b <= 1:
return ratio
else:
c = math.ceil(max([a, ... | import math
from decimal import *
n = int(eval(input()))
l = [[int(i) for i in input().split()] for j in range(n)]
def newT(t, ratio):
if t[0] <= ratio[0] and t[1] <= ratio[1]:
return ratio
else:
#切り上げ (x+p-1)//p
c = max((t[0]+ratio[0]-1)//ratio[0], (t[1]+ratio[1]-1)//ratio[... | 20 | 19 | 432 | 431 | import math
from decimal import *
n = int(eval(input()))
l = [[int(i) for i in input().split()] for j in range(n)]
def newT(t, ratio):
a = Decimal(t[0]) / Decimal(ratio[0])
b = Decimal(t[1]) / Decimal(ratio[1])
if a <= 1 and b <= 1:
return ratio
else:
c = math.ceil(max([a, b]))
... | import math
from decimal import *
n = int(eval(input()))
l = [[int(i) for i in input().split()] for j in range(n)]
def newT(t, ratio):
if t[0] <= ratio[0] and t[1] <= ratio[1]:
return ratio
else:
# 切り上げ (x+p-1)//p
c = max((t[0] + ratio[0] - 1) // ratio[0], (t[1] + ratio[1] - 1) // rat... | false | 5 | [
"- a = Decimal(t[0]) / Decimal(ratio[0])",
"- b = Decimal(t[1]) / Decimal(ratio[1])",
"- if a <= 1 and b <= 1:",
"+ if t[0] <= ratio[0] and t[1] <= ratio[1]:",
"- c = math.ceil(max([a, b]))",
"+ # 切り上げ (x+p-1)//p",
"+ c = max((t[0] + ratio[0] - 1) // ratio[0], (t[1] + ra... | false | 0.046123 | 0.072685 | 0.634562 | [
"s240239128",
"s616391656"
] |
u562935282 | p02621 | python | s675473674 | s189223753 | 32 | 29 | 9,136 | 8,916 | Accepted | Accepted | 9.38 | def main():
N = int(eval(input()))
print((N + N * N + N * N * N))
if __name__ == '__main__':
main()
# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
# while abs(ok... | def main():
a = int(eval(input()))
ret = a
ret += a * a
ret += a * a * a
print(ret)
if __name__ == '__main__':
main()
| 24 | 10 | 463 | 147 | def main():
N = int(eval(input()))
print((N + N * N + N * N * N))
if __name__ == "__main__":
main()
# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
# while abs(ok - ng) > 1:
# ... | def main():
a = int(eval(input()))
ret = a
ret += a * a
ret += a * a * a
print(ret)
if __name__ == "__main__":
main()
| false | 58.333333 | [
"- N = int(eval(input()))",
"- print((N + N * N + N * N * N))",
"+ a = int(eval(input()))",
"+ ret = a",
"+ ret += a * a",
"+ ret += a * a * a",
"+ print(ret)",
"-# import sys",
"-# input = sys.stdin.readline",
"-#",
"-# sys.setrecursionlimit(10 ** 7)",
"-#",
"-# (int(x)... | false | 0.08879 | 0.070297 | 1.26306 | [
"s675473674",
"s189223753"
] |
u414980766 | p02882 | python | s683085797 | s284325398 | 1,262 | 152 | 20,648 | 13,536 | Accepted | Accepted | 87.96 | import numpy as np
a, b, x = list(map(int, input().split()))
if x >= a*a*b/2:
l = 2*b - 2*x/(a**2)
print((np.rad2deg(np.arccos(a/np.sqrt(l**2 + a**2)))))
else:
l = 2*x/(a*b)
print((np.rad2deg(np.arcsin(b/np.sqrt(l**2 + b**2))))) | import numpy as np
a, b, x = list(map(int, input().split()))
if x >= a*a*b/2:
l = 2*b - 2*x/(a**2)
print((np.rad2deg(np.arctan(l/a))))
else:
l = 2*x/(a*b)
print((np.rad2deg(np.arctan(b/l)))) | 8 | 8 | 241 | 203 | import numpy as np
a, b, x = list(map(int, input().split()))
if x >= a * a * b / 2:
l = 2 * b - 2 * x / (a**2)
print((np.rad2deg(np.arccos(a / np.sqrt(l**2 + a**2)))))
else:
l = 2 * x / (a * b)
print((np.rad2deg(np.arcsin(b / np.sqrt(l**2 + b**2)))))
| import numpy as np
a, b, x = list(map(int, input().split()))
if x >= a * a * b / 2:
l = 2 * b - 2 * x / (a**2)
print((np.rad2deg(np.arctan(l / a))))
else:
l = 2 * x / (a * b)
print((np.rad2deg(np.arctan(b / l))))
| false | 0 | [
"- print((np.rad2deg(np.arccos(a / np.sqrt(l**2 + a**2)))))",
"+ print((np.rad2deg(np.arctan(l / a))))",
"- print((np.rad2deg(np.arcsin(b / np.sqrt(l**2 + b**2)))))",
"+ print((np.rad2deg(np.arctan(b / l))))"
] | false | 0.296245 | 0.307469 | 0.963496 | [
"s683085797",
"s284325398"
] |
u285891772 | p02973 | python | s908860558 | s868150818 | 356 | 127 | 15,024 | 16,032 | Accepted | Accepted | 64.33 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | 39 | 36 | 1,225 | 1,207 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | false | 7.692308 | [
"-color_max = deque([])",
"-cnt = 0",
"-for a in A:",
"- idx = bisect_left(color_max, a)",
"- if idx == 0:",
"- color_max.appendleft(a)",
"- cnt += 1",
"+seq = A[::-1]",
"+LIS = [seq[0]]",
"+for i in range(1, N):",
"+ if LIS[-1] <= seq[i]:",
"+ LIS.append(seq[i])"... | false | 0.087938 | 0.037504 | 2.344781 | [
"s908860558",
"s868150818"
] |
u297574184 | p02864 | python | s546819408 | s582950985 | 1,720 | 363 | 3,064 | 41,584 | Accepted | Accepted | 78.9 | def solve():
INF = float('inf')
def max2(x, y): return x if x >= y else y
N, K = list(map(int, input().split()))
Hs = [0] + list(map(int, input().split()))
if N == K:
return 0
dp = [INF] * (N+1)
dp[0] = 0
for j in range(1, N-K+1):
dp2 = [INF] * (N+1)
... | def solve():
INF = 10**12
def max2(x, y): return x if x >= y else y
def min2(x, y): return x if x <= y else y
N, K = list(map(int, input().split()))
Hs = [0] + list(map(int, input().split()))
dp = [[INF]*(N+1) for _ in range(N+1)]
dp[0][0] = 0
for i in range(1, N+1):
... | 24 | 28 | 524 | 717 | def solve():
INF = float("inf")
def max2(x, y):
return x if x >= y else y
N, K = list(map(int, input().split()))
Hs = [0] + list(map(int, input().split()))
if N == K:
return 0
dp = [INF] * (N + 1)
dp[0] = 0
for j in range(1, N - K + 1):
dp2 = [INF] * (N + 1)
... | def solve():
INF = 10**12
def max2(x, y):
return x if x >= y else y
def min2(x, y):
return x if x <= y else y
N, K = list(map(int, input().split()))
Hs = [0] + list(map(int, input().split()))
dp = [[INF] * (N + 1) for _ in range(N + 1)]
dp[0][0] = 0
for i in range(1, N... | false | 14.285714 | [
"- INF = float(\"inf\")",
"+ INF = 10**12",
"+ def min2(x, y):",
"+ return x if x <= y else y",
"+",
"- if N == K:",
"- return 0",
"- dp = [INF] * (N + 1)",
"- dp[0] = 0",
"- for j in range(1, N - K + 1):",
"- dp2 = [INF] * (N + 1)",
"- for i, H... | false | 0.034376 | 0.035598 | 0.965669 | [
"s546819408",
"s582950985"
] |
u139614630 | p03013 | python | s745420736 | s339009073 | 355 | 179 | 460,020 | 7,824 | Accepted | Accepted | 49.58 | #!/usr/bin/env python3
P_NUM = 1000000007
def solv(n, m, a):
comb = [1] * (n+1)
for i in a:
comb[i] = 0
for i in range(2, n+1):
if comb[i] != 0:
comb[i] = comb[i-1] + comb[i-2]
return comb[-1]
if __name__ == '__main__':
n, m = list(map(int, inpu... | #!/usr/bin/env python3
P_NUM = 1000000007
def solv(n, m, a):
comb = [1] * (n+1)
for i in a:
comb[i] = 0
for i in range(2, n+1):
if comb[i] != 0:
comb[i] = (comb[i-1] + comb[i-2]) % P_NUM
return comb[-1]
if __name__ == '__main__':
n, m = list(map... | 25 | 25 | 423 | 425 | #!/usr/bin/env python3
P_NUM = 1000000007
def solv(n, m, a):
comb = [1] * (n + 1)
for i in a:
comb[i] = 0
for i in range(2, n + 1):
if comb[i] != 0:
comb[i] = comb[i - 1] + comb[i - 2]
return comb[-1]
if __name__ == "__main__":
n, m = list(map(int, input().split()))
... | #!/usr/bin/env python3
P_NUM = 1000000007
def solv(n, m, a):
comb = [1] * (n + 1)
for i in a:
comb[i] = 0
for i in range(2, n + 1):
if comb[i] != 0:
comb[i] = (comb[i - 1] + comb[i - 2]) % P_NUM
return comb[-1]
if __name__ == "__main__":
n, m = list(map(int, input().s... | false | 0 | [
"- comb[i] = comb[i - 1] + comb[i - 2]",
"+ comb[i] = (comb[i - 1] + comb[i - 2]) % P_NUM",
"- print((ans % P_NUM))",
"+ print(ans)"
] | false | 0.070326 | 0.071925 | 0.977765 | [
"s745420736",
"s339009073"
] |
u766684188 | p02996 | python | s205578952 | s187451770 | 1,121 | 660 | 86,236 | 83,804 | Accepted | Accepted | 41.12 | import sys
input=sys.stdin.readline
n=int(eval(input()))
AB=[list(map(int,input().split())) for _ in range(n)]
AB.sort(key=lambda x: (x[1],-x[0]))
time=0
for a,b in AB:
time+=a
if time>b:
print('No')
break
else:
print('Yes') | import sys
input=sys.stdin.readline
n=int(eval(input()))
AB=[list(map(int,input().split())) for _ in range(n)]
AB.sort(key=lambda x: x[1])
time=0
for a,b in AB:
time+=a
if time>b:
print('No')
break
else:
print('Yes') | 13 | 13 | 258 | 250 | import sys
input = sys.stdin.readline
n = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(n)]
AB.sort(key=lambda x: (x[1], -x[0]))
time = 0
for a, b in AB:
time += a
if time > b:
print("No")
break
else:
print("Yes")
| import sys
input = sys.stdin.readline
n = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(n)]
AB.sort(key=lambda x: x[1])
time = 0
for a, b in AB:
time += a
if time > b:
print("No")
break
else:
print("Yes")
| false | 0 | [
"-AB.sort(key=lambda x: (x[1], -x[0]))",
"+AB.sort(key=lambda x: x[1])"
] | false | 0.072721 | 0.043072 | 1.688377 | [
"s205578952",
"s187451770"
] |
u833492079 | p03162 | python | s494983278 | s209949747 | 663 | 558 | 77,144 | 34,676 | Accepted | Accepted | 15.84 | N=int(eval(input()))
H=[[0,0,0]]+[ list(map(int, input().split())) for _ in range(N) ]
#print(N,H)
def chmax(dp, n, k, a):
b = (dp[n][k]<a)
if b: dp[n][k]=a
return b
#dp=[[0,0,0,0,0,0] for _ in range(N+1)]
dp=[[0,0,0] for _ in range(N+1)]
for i in range(1,N+1):
for j in range(3):
for k in r... | INF = float("inf") # 正の無限大
N = int(eval(input())) # 5
A=[0]*N
B=[0]*N
C=[0]*N
for i in range(N):
a,b,c = list(map(int, input().split())) # 5 7 2
A[i] = a
B[i] = b
C[i] = c
dp = [[0,0,0] for _ in range(N)]
for i in range(N):
dp[i][0] = A[i] + (max(dp[i-1][1], dp[i-1][2]) if i>0 else 0... | 23 | 26 | 411 | 503 | N = int(eval(input()))
H = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]
# print(N,H)
def chmax(dp, n, k, a):
b = dp[n][k] < a
if b:
dp[n][k] = a
return b
# dp=[[0,0,0,0,0,0] for _ in range(N+1)]
dp = [[0, 0, 0] for _ in range(N + 1)]
for i in range(1, N + 1):
for j in rang... | INF = float("inf") # 正の無限大
N = int(eval(input())) # 5
A = [0] * N
B = [0] * N
C = [0] * N
for i in range(N):
a, b, c = list(map(int, input().split())) # 5 7 2
A[i] = a
B[i] = b
C[i] = c
dp = [[0, 0, 0] for _ in range(N)]
for i in range(N):
dp[i][0] = A[i] + (max(dp[i - 1][1], dp[i - 1][2]) if i >... | false | 11.538462 | [
"-N = int(eval(input()))",
"-H = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]",
"-# print(N,H)",
"-def chmax(dp, n, k, a):",
"- b = dp[n][k] < a",
"- if b:",
"- dp[n][k] = a",
"- return b",
"-",
"-",
"-# dp=[[0,0,0,0,0,0] for _ in range(N+1)]",
"-dp = [[0, ... | false | 0.041908 | 0.060799 | 0.689293 | [
"s494983278",
"s209949747"
] |
u189023301 | p02888 | python | s478316662 | s441167236 | 1,845 | 790 | 58,716 | 45,244 | Accepted | Accepted | 57.18 | import bisect
n = int(eval(input()))
lis = list(map(int,input().split()))
a = sorted(lis, reverse=True)
c = sorted(lis)
d = 0
for i in range(n):
for j in range(i + 1, n):
e = c[:-j-1]
b = bisect.bisect_right(e, int(a[i]-a[j]))
d += max(0, len(e) - b)
print(d)
| import bisect
n = int(eval(input()))
lis = list(map(int,input().split()))
lis.sort()
d = 0
for i in range(n-2):
for j in range(i + 1, n-1):
b = bisect.bisect_left(lis, int(lis[i] + lis[j]))
d += max(0, b - j - 1)
print(d)
| 15 | 13 | 299 | 251 | import bisect
n = int(eval(input()))
lis = list(map(int, input().split()))
a = sorted(lis, reverse=True)
c = sorted(lis)
d = 0
for i in range(n):
for j in range(i + 1, n):
e = c[: -j - 1]
b = bisect.bisect_right(e, int(a[i] - a[j]))
d += max(0, len(e) - b)
print(d)
| import bisect
n = int(eval(input()))
lis = list(map(int, input().split()))
lis.sort()
d = 0
for i in range(n - 2):
for j in range(i + 1, n - 1):
b = bisect.bisect_left(lis, int(lis[i] + lis[j]))
d += max(0, b - j - 1)
print(d)
| false | 13.333333 | [
"-a = sorted(lis, reverse=True)",
"-c = sorted(lis)",
"+lis.sort()",
"-for i in range(n):",
"- for j in range(i + 1, n):",
"- e = c[: -j - 1]",
"- b = bisect.bisect_right(e, int(a[i] - a[j]))",
"- d += max(0, len(e) - b)",
"+for i in range(n - 2):",
"+ for j in range(i +... | false | 0.110345 | 0.03798 | 2.905335 | [
"s478316662",
"s441167236"
] |
u197615397 | p00009 | python | s517636853 | s316758459 | 430 | 220 | 80,672 | 56,004 | Accepted | Accepted | 48.84 | import bisect
import sys
n = 1000000
primes = {i for i in range(3, n, 2)}
for i in range(3, 1000, 2):
s = {j for j in range(i*2, n, i)}
primes -= s
primes = [2] + sorted(primes)
for l in sys.stdin:
print((bisect.bisect(primes, int(l)))) | import sys
import math
from bisect import bisect_right
n = 1000000
a = set(range(3, n, 2))
diff = a.difference_update
for i in range(3, int(math.sqrt(n)), 2):
if i in a:
diff(list(range(i*2, n+1, i)))
primes = [2] + list(a)
for l in map(int, sys.stdin.readlines()):
print((bisect_right(prime... | 11 | 13 | 257 | 319 | import bisect
import sys
n = 1000000
primes = {i for i in range(3, n, 2)}
for i in range(3, 1000, 2):
s = {j for j in range(i * 2, n, i)}
primes -= s
primes = [2] + sorted(primes)
for l in sys.stdin:
print((bisect.bisect(primes, int(l))))
| import sys
import math
from bisect import bisect_right
n = 1000000
a = set(range(3, n, 2))
diff = a.difference_update
for i in range(3, int(math.sqrt(n)), 2):
if i in a:
diff(list(range(i * 2, n + 1, i)))
primes = [2] + list(a)
for l in map(int, sys.stdin.readlines()):
print((bisect_right(primes, l)))
| false | 15.384615 | [
"-import bisect",
"+import math",
"+from bisect import bisect_right",
"-primes = {i for i in range(3, n, 2)}",
"-for i in range(3, 1000, 2):",
"- s = {j for j in range(i * 2, n, i)}",
"- primes -= s",
"-primes = [2] + sorted(primes)",
"-for l in sys.stdin:",
"- print((bisect.bisect(primes... | false | 0.941201 | 0.482974 | 1.948761 | [
"s517636853",
"s316758459"
] |
u729133443 | p02598 | python | s272123140 | s159781447 | 616 | 217 | 31,564 | 109,052 | Accepted | Accepted | 64.77 | n,k,*a=list(map(int,open(l:=0).read().split()))
r=10**9
while~l+r:
x=l+r>>1
if-sum(-b//x+1for b in a)>k:l=x
else:r=x
print(r) | n,k,*a=list(map(int,open(0).read().split()))
l,r=0,10**9
while~l+r:
x=l+r>>1
if-sum(-b//x+1for b in a)>k:l=x
else:r=x
print(r) | 7 | 7 | 128 | 129 | n, k, *a = list(map(int, open(l := 0).read().split()))
r = 10**9
while ~l + r:
x = l + r >> 1
if -sum(-b // x + 1 for b in a) > k:
l = x
else:
r = x
print(r)
| n, k, *a = list(map(int, open(0).read().split()))
l, r = 0, 10**9
while ~l + r:
x = l + r >> 1
if -sum(-b // x + 1 for b in a) > k:
l = x
else:
r = x
print(r)
| false | 0 | [
"-n, k, *a = list(map(int, open(l := 0).read().split()))",
"-r = 10**9",
"+n, k, *a = list(map(int, open(0).read().split()))",
"+l, r = 0, 10**9"
] | false | 0.070545 | 0.060024 | 1.175284 | [
"s272123140",
"s159781447"
] |
u600402037 | p03579 | python | s774183698 | s548338343 | 565 | 379 | 42,228 | 25,688 | Accepted | Accepted | 32.92 | import sys
sys.setrecursionlimit(10 ** 7)
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
graph = [[] for _ in range(N)]
for a, b in AB:
graph[a-1].append(b-1)
graph[b-1].append(a-1)
colors = [None] * N
# 二部グラフかどうかのチェック
colors[0] = 0
que = [0]
... | import sys
stdin = sys.stdin
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only
rs = lambda: stdin.readline().rstrip() # ignores trailing space
N, M = rl()
graph = [[] for _ in range(N+1)] # 0は使わない、直接行ける頂点
for _ in range(M):
a, b = rl()
graph[... | 36 | 37 | 677 | 848 | import sys
sys.setrecursionlimit(10**7)
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
graph = [[] for _ in range(N)]
for a, b in AB:
graph[a - 1].append(b - 1)
graph[b - 1].append(a - 1)
colors = [None] * N
# 二部グラフかどうかのチェック
colors[0] = 0
que = [0]
while que:
... | import sys
stdin = sys.stdin
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only
rs = lambda: stdin.readline().rstrip() # ignores trailing space
N, M = rl()
graph = [[] for _ in range(N + 1)] # 0は使わない、直接行ける頂点
for _ in range(M):
a, b = rl()
graph[a].append(b... | false | 2.702703 | [
"-sys.setrecursionlimit(10**7)",
"-N, M = list(map(int, input().split()))",
"-AB = [list(map(int, input().split())) for _ in range(M)]",
"-graph = [[] for _ in range(N)]",
"-for a, b in AB:",
"- graph[a - 1].append(b - 1)",
"- graph[b - 1].append(a - 1)",
"-colors = [None] * N",
"-# 二部グラフかどうかの... | false | 0.040573 | 0.042485 | 0.954991 | [
"s774183698",
"s548338343"
] |
u998741086 | p03286 | python | s524095619 | s184025603 | 29 | 24 | 9,052 | 9,168 | Accepted | Accepted | 17.24 | #!/usr/bin/env python
n = int(eval(input()))
if n == 0:
print((0))
exit()
ans = ''
while abs(n) > 0:
r = n%2
ans += str(r)
n //= 2
n = -n
if abs(n)%2 == 1:
print(ans)
else:
print((ans[::-1]))
| #!/usr/bin/env python
n = int(eval(input()))
if n == 0:
print((0))
exit()
ans = ''
while abs(n) > 0:
r = n%2
ans = str(r) + ans
if r == 1:
n -= 1
n //= (-2)
print(ans)
| 19 | 18 | 238 | 220 | #!/usr/bin/env python
n = int(eval(input()))
if n == 0:
print((0))
exit()
ans = ""
while abs(n) > 0:
r = n % 2
ans += str(r)
n //= 2
n = -n
if abs(n) % 2 == 1:
print(ans)
else:
print((ans[::-1]))
| #!/usr/bin/env python
n = int(eval(input()))
if n == 0:
print((0))
exit()
ans = ""
while abs(n) > 0:
r = n % 2
ans = str(r) + ans
if r == 1:
n -= 1
n //= -2
print(ans)
| false | 5.263158 | [
"- ans += str(r)",
"- n //= 2",
"- n = -n",
"-if abs(n) % 2 == 1:",
"- print(ans)",
"-else:",
"- print((ans[::-1]))",
"+ ans = str(r) + ans",
"+ if r == 1:",
"+ n -= 1",
"+ n //= -2",
"+print(ans)"
] | false | 0.044322 | 0.041796 | 1.060431 | [
"s524095619",
"s184025603"
] |
u077291787 | p03283 | python | s610394181 | s271929463 | 284 | 254 | 57,672 | 57,672 | Accepted | Accepted | 10.56 | # ABC106D - AtCoder Express 2
from itertools import accumulate as acc
def main():
# 2D cumulative sum
N, M, Q, *X = list(map(int, open(0).read().split()))
LR, PQ = X[: 2 * M], X[2 * M :]
imos = [[0] * (N + 1) for _ in range(N + 1)]
for l, r in zip(*[iter(LR)] * 2):
imos[l][r] += ... | # ABC106D - AtCoder Express 2
from itertools import accumulate as acc
def main():
# 2D cumulative sum
N, M, Q, *X = list(map(int, open(0).read().split()))
LR, PQ = X[: 2 * M], X[2 * M :]
imos = [[0] * (N + 1) for _ in range(N + 1)]
for l, r in zip(*[iter(LR)] * 2):
imos[l][r] += ... | 21 | 20 | 620 | 558 | # ABC106D - AtCoder Express 2
from itertools import accumulate as acc
def main():
# 2D cumulative sum
N, M, Q, *X = list(map(int, open(0).read().split()))
LR, PQ = X[: 2 * M], X[2 * M :]
imos = [[0] * (N + 1) for _ in range(N + 1)]
for l, r in zip(*[iter(LR)] * 2):
imos[l][r] += 1
imos... | # ABC106D - AtCoder Express 2
from itertools import accumulate as acc
def main():
# 2D cumulative sum
N, M, Q, *X = list(map(int, open(0).read().split()))
LR, PQ = X[: 2 * M], X[2 * M :]
imos = [[0] * (N + 1) for _ in range(N + 1)]
for l, r in zip(*[iter(LR)] * 2):
imos[l][r] += 1
imos... | false | 4.761905 | [
"- imos = [list(acc(a)) for a in zip(*[acc(a) for a in imos])]",
"+ imos = [list(acc(a[::-1]))[::-1] for a in zip(*[acc(a) for a in imos])]",
"- cur = imos[q][q] - imos[p - 1][q] - imos[q][p - 1] + imos[p - 1][q - 1]",
"- ans.append(cur)",
"+ ans.append(imos[q][p])"
] | false | 0.081984 | 0.061399 | 1.335274 | [
"s610394181",
"s271929463"
] |
u124498235 | p03329 | python | s873395643 | s753703094 | 605 | 499 | 7,064 | 7,064 | Accepted | Accepted | 17.52 | n = int(eval(input()))
ary = [1]
x = 1
for i in range(6):
x *= 6
ary.append(x)
x = 1
for i in range(5):
x *= 9
ary.append(x)
ary.sort()
dp = [i for i in range(n+1)]
for i in range(1,n+1):
for j in ary:
if j > i:
break
dp[i] = min(dp[i],dp[i-j]+1)
print((dp[n])) | n = int(eval(input()))
ary = [1]
x = 1
for i in range(6):
x *= 6
ary.append(x)
x = 1
for i in range(5):
x *= 9
ary.append(x)
ary.sort()
dp = [i for i in range(n+1)]
for i in range(1,n+1):
for j in ary:
if j > i:
continue
dp[i] = min(dp[i],dp[i-j]+1)
print((dp[n])) | 20 | 20 | 287 | 290 | n = int(eval(input()))
ary = [1]
x = 1
for i in range(6):
x *= 6
ary.append(x)
x = 1
for i in range(5):
x *= 9
ary.append(x)
ary.sort()
dp = [i for i in range(n + 1)]
for i in range(1, n + 1):
for j in ary:
if j > i:
break
dp[i] = min(dp[i], dp[i - j] + 1)
print((dp[n]))
| n = int(eval(input()))
ary = [1]
x = 1
for i in range(6):
x *= 6
ary.append(x)
x = 1
for i in range(5):
x *= 9
ary.append(x)
ary.sort()
dp = [i for i in range(n + 1)]
for i in range(1, n + 1):
for j in ary:
if j > i:
continue
dp[i] = min(dp[i], dp[i - j] + 1)
print((dp[n]... | false | 0 | [
"- break",
"+ continue"
] | false | 0.152508 | 0.128688 | 1.185099 | [
"s873395643",
"s753703094"
] |
u225388820 | p03472 | python | s915029528 | s532369992 | 566 | 375 | 23,812 | 7,472 | Accepted | Accepted | 33.75 | import heapq as hq
s=[]
hq.heapify(s) #sをpriority-q化 O(n log(n))
# a=hq.heappop(s) #最小値を取り出す O(log(n))
# hq.heappush(s,123) #123をs(priority-q)に追加 O(log(n))
n,h=list(map(int,input().split()))
for i in range(n):
a,b=list(map(int,input().split()))
hq.heappush(s,(-a,False))
hq.heappush(s,(-b,True))
a... | n,h=list(map(int,input().split()))
x=[0]*n
y=0
for i in range(n):
a,b=list(map(int,input().split()))
y=max(y,a)
x[i]=b
cnt=0
x.sort(reverse=1)
for i in x:
if i>y:
cnt+=1
h-=i
if h<=0:
print(cnt)
exit()
print((cnt+(h+y-1)//y)) | 20 | 17 | 443 | 279 | import heapq as hq
s = []
hq.heapify(s) # sをpriority-q化 O(n log(n))
# a=hq.heappop(s) #最小値を取り出す O(log(n))
# hq.heappush(s,123) #123をs(priority-q)に追加 O(log(n))
n, h = list(map(int, input().split()))
for i in range(n):
a, b = list(map(int, input().split()))
hq.heappush(s, (-a, False))
hq.heappush(s, (-b, T... | n, h = list(map(int, input().split()))
x = [0] * n
y = 0
for i in range(n):
a, b = list(map(int, input().split()))
y = max(y, a)
x[i] = b
cnt = 0
x.sort(reverse=1)
for i in x:
if i > y:
cnt += 1
h -= i
if h <= 0:
print(cnt)
exit()
print((cnt + (h + y - 1) // y))
| false | 15 | [
"-import heapq as hq",
"-",
"-s = []",
"-hq.heapify(s) # sをpriority-q化 O(n log(n))",
"-# a=hq.heappop(s) #最小値を取り出す O(log(n))",
"-# hq.heappush(s,123) #123をs(priority-q)に追加 O(log(n))",
"+x = [0] * n",
"+y = 0",
"- hq.heappush(s, (-a, False))",
"- hq.heappush(s, (-b, True))",
"-ans = 1",
... | false | 0.086117 | 0.034983 | 2.461646 | [
"s915029528",
"s532369992"
] |
u694433776 | p03559 | python | s180267203 | s226580834 | 389 | 352 | 25,544 | 22,720 | Accepted | Accepted | 9.51 | # 解説したb→cを先に計算、その後累積和を取る解法
import bisect
n=int(eval(input()))
# 面倒なので最初にソートしちゃいましょう。
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
# 各bについてcで使えるのが何種類存在するか
cnum=[0 for i in range(n)]
for i in range(n):
cnum[i] = len(c) - bisect.... | # 別解(むしろ想定解)のb→axc解法
import bisect
n=int(eval(input()))
# 面倒なので最初にソートしちゃいましょう。
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
ret=0
# a<b[i]となるaの個数xb[i]<cとなるcの個数でいいですよね…
for i in range(n):
numa = bisect.bisect_left(a,b[i])
... | 22 | 15 | 577 | 389 | # 解説したb→cを先に計算、その後累積和を取る解法
import bisect
n = int(eval(input()))
# 面倒なので最初にソートしちゃいましょう。
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
# 各bについてcで使えるのが何種類存在するか
cnum = [0 for i in range(n)]
for i in range(n):
cnum[i] = len(c) - bisec... | # 別解(むしろ想定解)のb→axc解法
import bisect
n = int(eval(input()))
# 面倒なので最初にソートしちゃいましょう。
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
ret = 0
# a<b[i]となるaの個数xb[i]<cとなるcの個数でいいですよね…
for i in range(n):
numa = bisect.bisect_left(a, b[i])
... | false | 31.818182 | [
"-# 解説したb→cを先に計算、その後累積和を取る解法",
"+# 別解(むしろ想定解)のb→axc解法",
"-# 各bについてcで使えるのが何種類存在するか",
"-cnum = [0 for i in range(n)]",
"+ret = 0",
"+# a<b[i]となるaの個数xb[i]<cとなるcの個数でいいですよね…",
"- cnum[i] = len(c) - bisect.bisect_right(c, b[i])",
"-# cnumの累積和",
"-accum = [0 for i in range(n + 1)]",
"-for i in reverse... | false | 0.04118 | 0.041061 | 1.002889 | [
"s180267203",
"s226580834"
] |
u627600101 | p02804 | python | s772463241 | s576041969 | 848 | 227 | 20,032 | 25,128 | Accepted | Accepted | 73.23 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10**9 + 7
A.sort(reverse=True)
kaijou = [1 for _ in range(N+1)]
for k in range(1, N):
kaijou[k+1] = kaijou[k]*(k+1)%mod
b = mod-2
blis = []
c = 0
while b >0:
if b & 1 == 1:
blis.append(c)
c += 1
b >>= 1
d... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10**9 + 7
A.sort(reverse=True)
"""
kaijou = [1 for _ in range(N+1)]
for k in range(1, N):
kaijou[k+1] = kaijou[k]*(k+1)%mod
b = mod-2
blis = []
c = 0
while b >0:
if b & 1 == 1:
blis.append(c)
c += 1
b >>= 1... | 48 | 61 | 814 | 1,158 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10**9 + 7
A.sort(reverse=True)
kaijou = [1 for _ in range(N + 1)]
for k in range(1, N):
kaijou[k + 1] = kaijou[k] * (k + 1) % mod
b = mod - 2
blis = []
c = 0
while b > 0:
if b & 1 == 1:
blis.append(c)
c += 1
b >>= 1... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10**9 + 7
A.sort(reverse=True)
"""
kaijou = [1 for _ in range(N+1)]
for k in range(1, N):
kaijou[k+1] = kaijou[k]*(k+1)%mod
b = mod-2
blis = []
c = 0
while b >0:
if b & 1 == 1:
blis.append(c)
c += 1
b >>= 1
def modinv(a):
if ... | false | 21.311475 | [
"-kaijou = [1 for _ in range(N + 1)]",
"+\"\"\"",
"+kaijou = [1 for _ in range(N+1)]",
"- kaijou[k + 1] = kaijou[k] * (k + 1) % mod",
"-b = mod - 2",
"+ kaijou[k+1] = kaijou[k]*(k+1)%mod",
"+b = mod-2",
"-while b > 0:",
"- if b & 1 == 1:",
"- blis.append(c)",
"- c += 1",
"- ... | false | 0.086656 | 0.096258 | 0.900251 | [
"s772463241",
"s576041969"
] |
u761320129 | p02928 | python | s790813348 | s156936940 | 383 | 296 | 3,572 | 9,464 | Accepted | Accepted | 22.72 | N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
MOD = 10**9+7
ans = 0
for i in range(N-1):
for j in range(i+1,N):
if A[i] > A[j]:
ans += 1
ans *= K
from collections import Counter
ctr = Counter(A)
P = (K*(K-1)//2) % MOD
s = 0
for k,v in sorted(ctr.i... | N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
MOD = 10**9+7
inv = 0
for i in range(N-1):
for j in range(i+1,N):
if A[i] > A[j]:
inv += 1
ans = (inv * K) % MOD
from collections import Counter
ctr = Counter(A)
inv2 = 0
s = 0
for _,v in sorted(ctr.items())... | 25 | 21 | 403 | 396 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0
for i in range(N - 1):
for j in range(i + 1, N):
if A[i] > A[j]:
ans += 1
ans *= K
from collections import Counter
ctr = Counter(A)
P = (K * (K - 1) // 2) % MOD
s = 0
for k, v in sorted(ctr.items(... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
inv = 0
for i in range(N - 1):
for j in range(i + 1, N):
if A[i] > A[j]:
inv += 1
ans = (inv * K) % MOD
from collections import Counter
ctr = Counter(A)
inv2 = 0
s = 0
for _, v in sorted(ctr.items()):
... | false | 16 | [
"-ans = 0",
"+inv = 0",
"- ans += 1",
"-ans *= K",
"+ inv += 1",
"+ans = (inv * K) % MOD",
"-P = (K * (K - 1) // 2) % MOD",
"+inv2 = 0",
"-for k, v in sorted(ctr.items()):",
"- tmp = (v * s * P) % MOD",
"- ans += tmp",
"- ans %= MOD",
"+for _, v in sorted(ctr.i... | false | 0.078007 | 0.03532 | 2.208576 | [
"s790813348",
"s156936940"
] |
u102461423 | p02715 | python | s273220259 | s749908955 | 377 | 295 | 11,540 | 29,640 | Accepted | Accepted | 21.75 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
N, K = list(map(int, read().split()))
A = [0] * (K + 1)
for d in range(1, K + 1):
A[d] = pow(K // d, N, MOD)
for d in range(K, 0, -1):
for i in range(2, K // d + 1)... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 10**9 + 7
N, K = list(map(int, read().split()))
is_prime = np.zeros(K + 10, np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3, K + 10, 2):
if p * p >... | 18 | 30 | 411 | 662 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
N, K = list(map(int, read().split()))
A = [0] * (K + 1)
for d in range(1, K + 1):
A[d] = pow(K // d, N, MOD)
for d in range(K, 0, -1):
for i in range(2, K // d + 1):
A[d] ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 10**9 + 7
N, K = list(map(int, read().split()))
is_prime = np.zeros(K + 10, np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3, K + 10, 2):
if p * p > K:
b... | false | 40 | [
"+import numpy as np",
"+",
"+is_prime = np.zeros(K + 10, np.bool)",
"+is_prime[2] = 1",
"+is_prime[3::2] = 1",
"+for p in range(3, K + 10, 2):",
"+ if p * p > K:",
"+ break",
"+ if is_prime[p]:",
"+ is_prime[p * p :: p + p] = 0",
"+primes = np.where(is_prime)[0]",
"-for d ... | false | 0.178223 | 0.538511 | 0.330955 | [
"s273220259",
"s749908955"
] |
u620480037 | p03752 | python | s624047761 | s799595900 | 243 | 33 | 43,760 | 9,200 | Accepted | Accepted | 86.42 | N,K=list(map(int,input().split()))
a=list(map(int,input().split()))
ans=10**20
for i in range(2**(N-1)):
I=i
T=a[0]
C=1
cost=0
S=[]
for s in range(N-1):
if I//(2**(N-2-s))==1:
S.append("1")
else:
S.append("0")
I%=(2**(N-2-s))
#... | N,K=list(map(int,input().split()))
L=list(map(int,input().split()))
import itertools
l=[i for i in range(1,N)]
Arr=list(itertools.combinations(l,K-1)) #Lの中から2個
#print(Arr)
ans=10**12
for i in Arr:
cost=0
hight=L[0]
for j in range(1,N):
if j in i:
if hight<L[j]:
... | 34 | 25 | 713 | 514 | N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 10**20
for i in range(2 ** (N - 1)):
I = i
T = a[0]
C = 1
cost = 0
S = []
for s in range(N - 1):
if I // (2 ** (N - 2 - s)) == 1:
S.append("1")
else:
S.append("0")
I %... | N, K = list(map(int, input().split()))
L = list(map(int, input().split()))
import itertools
l = [i for i in range(1, N)]
Arr = list(itertools.combinations(l, K - 1)) # Lの中から2個
# print(Arr)
ans = 10**12
for i in Arr:
cost = 0
hight = L[0]
for j in range(1, N):
if j in i:
if hight < L[j]... | false | 26.470588 | [
"-a = list(map(int, input().split()))",
"-ans = 10**20",
"-for i in range(2 ** (N - 1)):",
"- I = i",
"- T = a[0]",
"- C = 1",
"+L = list(map(int, input().split()))",
"+import itertools",
"+",
"+l = [i for i in range(1, N)]",
"+Arr = list(itertools.combinations(l, K - 1)) # Lの中から2個",
... | false | 0.038929 | 0.037765 | 1.030823 | [
"s624047761",
"s799595900"
] |
u562935282 | p03095 | python | s015791514 | s078473974 | 28 | 25 | 3,820 | 3,444 | Accepted | Accepted | 10.71 | from collections import Counter
from functools import reduce
from operator import mul
mod = 10 ** 9 + 7
def my_mul(a, b):
return a * b % mod
n = int(eval(input()))
s = eval(input())
cnt = Counter(s)
print((reduce(my_mul, (v + 1 for v in list(cnt.values()))) - 1))
# 同じ文字列でも、異なる位置から作られたものは区別... | def main():
from collections import Counter
MOD = 10 ** 9 + 7
N = int(eval(input()))
S = eval(input())
ctr = Counter(S)
ret = 1
for count in list(ctr.values()):
ret = (ret * (count + 1)) % MOD
print((ret - 1))
if __name__ == '__main__':
main()
| 24 | 18 | 517 | 291 | from collections import Counter
from functools import reduce
from operator import mul
mod = 10**9 + 7
def my_mul(a, b):
return a * b % mod
n = int(eval(input()))
s = eval(input())
cnt = Counter(s)
print((reduce(my_mul, (v + 1 for v in list(cnt.values()))) - 1))
# 同じ文字列でも、異なる位置から作られたものは区別するため、2
# N − 1 通りのすべての部... | def main():
from collections import Counter
MOD = 10**9 + 7
N = int(eval(input()))
S = eval(input())
ctr = Counter(S)
ret = 1
for count in list(ctr.values()):
ret = (ret * (count + 1)) % MOD
print((ret - 1))
if __name__ == "__main__":
main()
| false | 25 | [
"-from collections import Counter",
"-from functools import reduce",
"-from operator import mul",
"+def main():",
"+ from collections import Counter",
"-mod = 10**9 + 7",
"+ MOD = 10**9 + 7",
"+ N = int(eval(input()))",
"+ S = eval(input())",
"+ ctr = Counter(S)",
"+ ret = 1",
... | false | 0.040031 | 0.039637 | 1.009942 | [
"s015791514",
"s078473974"
] |
u107077660 | p03767 | python | s599082125 | s608330922 | 247 | 225 | 37,084 | 39,492 | Accepted | Accepted | 8.91 | N = int(eval(input()))
A = [int(i) for i in input().split()]
A.sort(reverse=True)
ans = 0
for i in range(N):
ans += A[2*i+1]
print(ans) | N = int(eval(input()))
A = sorted([int(i) for i in input().split()])
A.reverse()
print((sum(A[1:2*N:2]))) | 7 | 4 | 136 | 100 | N = int(eval(input()))
A = [int(i) for i in input().split()]
A.sort(reverse=True)
ans = 0
for i in range(N):
ans += A[2 * i + 1]
print(ans)
| N = int(eval(input()))
A = sorted([int(i) for i in input().split()])
A.reverse()
print((sum(A[1 : 2 * N : 2])))
| false | 42.857143 | [
"-A = [int(i) for i in input().split()]",
"-A.sort(reverse=True)",
"-ans = 0",
"-for i in range(N):",
"- ans += A[2 * i + 1]",
"-print(ans)",
"+A = sorted([int(i) for i in input().split()])",
"+A.reverse()",
"+print((sum(A[1 : 2 * N : 2])))"
] | false | 0.113815 | 0.007327 | 15.533671 | [
"s599082125",
"s608330922"
] |
u440180827 | p02383 | python | s080477537 | s170546272 | 50 | 20 | 7,500 | 7,432 | Accepted | Accepted | 60 | u, s, e, w, n, d = input().split()
for i in eval(input()):
if i == 'N':
u, s, n, d = s, d, u, n
elif i == 'E':
u, e, w, d = w, u, d, e
elif i == 'S':
u, s, n, d = n, u, d, s
elif i == 'W':
u, e, w, d = e, d, u, w
print(u) | u, s, e, w, n, d = input().split()
t = eval(input())
for i in t:
if i == 'N':
u, s, n, d = s, d, u, n
elif i == 'E':
u, e, w, d = w, u, d, e
elif i == 'S':
u, s, n, d = n, u, d, s
elif i == 'W':
u, e, w, d = e, d, u, w
print(u) | 11 | 12 | 273 | 280 | u, s, e, w, n, d = input().split()
for i in eval(input()):
if i == "N":
u, s, n, d = s, d, u, n
elif i == "E":
u, e, w, d = w, u, d, e
elif i == "S":
u, s, n, d = n, u, d, s
elif i == "W":
u, e, w, d = e, d, u, w
print(u)
| u, s, e, w, n, d = input().split()
t = eval(input())
for i in t:
if i == "N":
u, s, n, d = s, d, u, n
elif i == "E":
u, e, w, d = w, u, d, e
elif i == "S":
u, s, n, d = n, u, d, s
elif i == "W":
u, e, w, d = e, d, u, w
print(u)
| false | 8.333333 | [
"-for i in eval(input()):",
"+t = eval(input())",
"+for i in t:"
] | false | 0.092299 | 0.049764 | 1.854723 | [
"s080477537",
"s170546272"
] |
u427344224 | p02899 | python | s503669493 | s289415966 | 261 | 196 | 19,968 | 19,968 | Accepted | Accepted | 24.9 | N = int(input())
items = []
a_list = list(map(int, input().split()))
for i in range(N):
a = a_list[i]
items.append((a, i+1))
items = sorted(items, key=lambda x:x[0])
for tu in items:
print(tu[1], end=" ")
| N = int(eval(input()))
a_list = list(map(int, input().split()))
items = []
for i in range(N):
items.append((a_list[i], i+1))
items = sorted(items, key=lambda x:x[0])
for a in items:
print((a[1]))
| 11 | 9 | 229 | 205 | N = int(input())
items = []
a_list = list(map(int, input().split()))
for i in range(N):
a = a_list[i]
items.append((a, i + 1))
items = sorted(items, key=lambda x: x[0])
for tu in items:
print(tu[1], end=" ")
| N = int(eval(input()))
a_list = list(map(int, input().split()))
items = []
for i in range(N):
items.append((a_list[i], i + 1))
items = sorted(items, key=lambda x: x[0])
for a in items:
print((a[1]))
| false | 18.181818 | [
"-N = int(input())",
"+N = int(eval(input()))",
"+a_list = list(map(int, input().split()))",
"-a_list = list(map(int, input().split()))",
"- a = a_list[i]",
"- items.append((a, i + 1))",
"+ items.append((a_list[i], i + 1))",
"-for tu in items:",
"- print(tu[1], end=\" \")",
"+for a in ... | false | 0.034475 | 0.040007 | 0.861715 | [
"s503669493",
"s289415966"
] |
u606045429 | p03674 | python | s870245525 | s372454020 | 465 | 358 | 42,500 | 29,280 | Accepted | Accepted | 23.01 | class ModComb:
def __init__(self, MAX, mod=10 ** 9 + 7):
fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
for i in range(2, MAX):
fac.append(fac[i - 1] * i % mod)
inv.append(mod - inv[mod % i] * (mod // i) % mod)
finv.append(finv[i - 1] * inv[i] % m... | class ModComb:
def __init__(self, MAX, mod=10 ** 9 + 7):
fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
for i in range(2, MAX):
fac.append(fac[i - 1] * i % mod)
inv.append(mod - inv[mod % i] * (mod // i) % mod)
finv.append(finv[i - 1] * inv[i] % m... | 35 | 35 | 943 | 948 | class ModComb:
def __init__(self, MAX, mod=10**9 + 7):
fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
for i in range(2, MAX):
fac.append(fac[i - 1] * i % mod)
inv.append(mod - inv[mod % i] * (mod // i) % mod)
finv.append(finv[i - 1] * inv[i] % mod)
... | class ModComb:
def __init__(self, MAX, mod=10**9 + 7):
fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
for i in range(2, MAX):
fac.append(fac[i - 1] * i % mod)
inv.append(mod - inv[mod % i] * (mod // i) % mod)
finv.append(finv[i - 1] * inv[i] % mod)
... | false | 0 | [
"-mc = ModComb(210000, mod=mod)",
"+mc = ModComb(10**5 + 5, mod=mod)"
] | false | 0.396162 | 0.227319 | 1.742756 | [
"s870245525",
"s372454020"
] |
u989345508 | p02727 | python | s188411074 | s774629980 | 516 | 261 | 23,456 | 22,616 | Accepted | Accepted | 49.42 | import heapq
x,y,a,b,c=list(map(int,input().split()))
def _int(x):
return -int(x)
p=list(map(_int,input().split()))
q=list(map(_int,input().split()))
r=list(map(_int,input().split()))
heapq.heapify(p)
heapq.heapify(q)
heapq.heapify(r)
ans=[]
heapq.heapify(ans)
for i in range(x):
_p=heapq.heappop(... | #heapqすら使わなくても良い
x,y,a,b,c=list(map(int,input().split()))
p=sorted(list(map(int,input().split())),reverse=True)[:x]
q=sorted(list(map(int,input().split())),reverse=True)[:y]
r=sorted(list(map(int,input().split())),reverse=True)
p.extend(q)
ans=sorted(p)
#ansは小さい順、rは大きい順
for i in range(x+y):
if len(r)... | 30 | 17 | 665 | 397 | import heapq
x, y, a, b, c = list(map(int, input().split()))
def _int(x):
return -int(x)
p = list(map(_int, input().split()))
q = list(map(_int, input().split()))
r = list(map(_int, input().split()))
heapq.heapify(p)
heapq.heapify(q)
heapq.heapify(r)
ans = []
heapq.heapify(ans)
for i in range(x):
_p = heap... | # heapqすら使わなくても良い
x, y, a, b, c = list(map(int, input().split()))
p = sorted(list(map(int, input().split())), reverse=True)[:x]
q = sorted(list(map(int, input().split())), reverse=True)[:y]
r = sorted(list(map(int, input().split())), reverse=True)
p.extend(q)
ans = sorted(p)
# ansは小さい順、rは大きい順
for i in range(x + y):
... | false | 43.333333 | [
"-import heapq",
"-",
"+# heapqすら使わなくても良い",
"-",
"-",
"-def _int(x):",
"- return -int(x)",
"-",
"-",
"-p = list(map(_int, input().split()))",
"-q = list(map(_int, input().split()))",
"-r = list(map(_int, input().split()))",
"-heapq.heapify(p)",
"-heapq.heapify(q)",
"-heapq.heapify(r)"... | false | 0.092789 | 0.067321 | 1.378317 | [
"s188411074",
"s774629980"
] |
u415905784 | p03295 | python | s813473880 | s406531873 | 452 | 406 | 22,076 | 7,088 | Accepted | Accepted | 10.18 | N, M = list(map(int, input().split()))
A = []
for i in range(M):
a, b = list(map(int, input().split()))
A.append([a - 1, b - 1])
A = sorted(A, key=lambda a: a[0])
cut = 1
b_min = N
for a in A:
if a[0] >= b_min:
cut += 1
b_min = N
b_min = min(b_min, a[1])
print(cut) | N, M = list(map(int, input().split()))
I = [N + 1 for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
I[a - 1] = min(I[a - 1], b - 1)
cut = 0
for i in range(N - 1):
if I[i] == i + 1:
cut += 1
else:
I[i + 1] = min(I[i + 1], I[i])
print(cut) | 14 | 12 | 282 | 279 | N, M = list(map(int, input().split()))
A = []
for i in range(M):
a, b = list(map(int, input().split()))
A.append([a - 1, b - 1])
A = sorted(A, key=lambda a: a[0])
cut = 1
b_min = N
for a in A:
if a[0] >= b_min:
cut += 1
b_min = N
b_min = min(b_min, a[1])
print(cut)
| N, M = list(map(int, input().split()))
I = [N + 1 for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
I[a - 1] = min(I[a - 1], b - 1)
cut = 0
for i in range(N - 1):
if I[i] == i + 1:
cut += 1
else:
I[i + 1] = min(I[i + 1], I[i])
print(cut)
| false | 14.285714 | [
"-A = []",
"+I = [N + 1 for i in range(N)]",
"- A.append([a - 1, b - 1])",
"-A = sorted(A, key=lambda a: a[0])",
"-cut = 1",
"-b_min = N",
"-for a in A:",
"- if a[0] >= b_min:",
"+ I[a - 1] = min(I[a - 1], b - 1)",
"+cut = 0",
"+for i in range(N - 1):",
"+ if I[i] == i + 1:",
"- ... | false | 0.0477 | 0.047194 | 1.010716 | [
"s813473880",
"s406531873"
] |
u612975321 | p02787 | python | s507794861 | s547416577 | 305 | 277 | 40,304 | 39,664 | Accepted | Accepted | 9.18 | def rec_z():
for i in range(N):
for j in range(Hmax+1):
if j >= a[i]:
dp[j] = min(dp[j], dp[j-a[i]] + b[i])
return min(dp[H:Hmax+1])
H, N = list(map(int,input().split()))
a = []
b = []
for i in range(N):
aa, bb = list(map(int, input().split()))
a.appe... | from sys import stdin
def rec_z():
for i in range(N):
for j in range(Hmax+1):
if j >= a[i]:
dp[j] = min(dp[j], dp[j-a[i]] + b[i])
return min(dp[H:Hmax+1])
readline=stdin.readline
H, N = list(map(int,readline().split()))
a = []
b = []
for i in range(N):
... | 20 | 24 | 427 | 486 | def rec_z():
for i in range(N):
for j in range(Hmax + 1):
if j >= a[i]:
dp[j] = min(dp[j], dp[j - a[i]] + b[i])
return min(dp[H : Hmax + 1])
H, N = list(map(int, input().split()))
a = []
b = []
for i in range(N):
aa, bb = list(map(int, input().split()))
a.append(aa)... | from sys import stdin
def rec_z():
for i in range(N):
for j in range(Hmax + 1):
if j >= a[i]:
dp[j] = min(dp[j], dp[j - a[i]] + b[i])
return min(dp[H : Hmax + 1])
readline = stdin.readline
H, N = list(map(int, readline().split()))
a = []
b = []
for i in range(N):
aa, ... | false | 16.666667 | [
"+from sys import stdin",
"+",
"+",
"-H, N = list(map(int, input().split()))",
"+readline = stdin.readline",
"+H, N = list(map(int, readline().split()))",
"- aa, bb = list(map(int, input().split()))",
"+ aa, bb = list(map(int, readline().split()))"
] | false | 0.107499 | 0.126155 | 0.852113 | [
"s507794861",
"s547416577"
] |
u785220618 | p03495 | python | s222089742 | s950579690 | 212 | 192 | 38,964 | 38,964 | Accepted | Accepted | 9.43 | # -*- coding: utf-8 -*-
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
dict_A = {}
for a in A:
if a not in dict_A:
dict_A[a] = 1
else:
dict_A[a] += 1
if len(list(dict_A.keys())) <= k:
print((0))
exit()
sorted_A = sorted(list(dict_A.items())... | # -*- coding: utf-8 -*-
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = {}
for a in A:
if a not in B:
B[a] = 1
else:
B[a] += 1
C = sorted(list(B.items()), key=lambda x: x[1])
if len(C) <= k:
print((0))
else:
ans = 0
for i in range(le... | 23 | 20 | 413 | 355 | # -*- coding: utf-8 -*-
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
dict_A = {}
for a in A:
if a not in dict_A:
dict_A[a] = 1
else:
dict_A[a] += 1
if len(list(dict_A.keys())) <= k:
print((0))
exit()
sorted_A = sorted(list(dict_A.items()), key=lambda x: x[1]... | # -*- coding: utf-8 -*-
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = {}
for a in A:
if a not in B:
B[a] = 1
else:
B[a] += 1
C = sorted(list(B.items()), key=lambda x: x[1])
if len(C) <= k:
print((0))
else:
ans = 0
for i in range(len(C) - k):
a... | false | 13.043478 | [
"-dict_A = {}",
"+B = {}",
"- if a not in dict_A:",
"- dict_A[a] = 1",
"+ if a not in B:",
"+ B[a] = 1",
"- dict_A[a] += 1",
"-if len(list(dict_A.keys())) <= k:",
"+ B[a] += 1",
"+C = sorted(list(B.items()), key=lambda x: x[1])",
"+if len(C) <= k:",
"- exit... | false | 0.043252 | 0.106259 | 0.407038 | [
"s222089742",
"s950579690"
] |
u221886916 | p03165 | python | s814209131 | s973150575 | 561 | 415 | 121,180 | 111,452 | Accepted | Accepted | 26.02 | from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce
def input():
return sys.stdin.readline().strip()
def iinput():
return int(eval(input()))
def tinput():
retur... |
def main():
s = eval(input())
t = eval(input())
n, m = len(s), len(t)
LCS = [[0]*(m+1) for i in range(n+1)]
# LCS[i][j] is the longest common subsequence of strings s[0...i] and t[0...j]
for i in range(1, n+1):
for j in range(1, m+1):
if s[i-1] == t[j-1]:
... | 71 | 30 | 1,316 | 743 | from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce
def input():
return sys.stdin.readline().strip()
def iinput():
return int(eval(input()))
def tinput():
return input().split()
... | def main():
s = eval(input())
t = eval(input())
n, m = len(s), len(t)
LCS = [[0] * (m + 1) for i in range(n + 1)]
# LCS[i][j] is the longest common subsequence of strings s[0...i] and t[0...j]
for i in range(1, n + 1):
for j in range(1, m + 1):
if s[i - 1] == t[j - 1]:
... | false | 57.746479 | [
"-from collections import Counter",
"-from collections import defaultdict",
"-import math",
"-import random",
"-import heapq as hq",
"-from math import sqrt",
"-import sys",
"-from functools import reduce",
"+def main():",
"+ s = eval(input())",
"+ t = eval(input())",
"+ n, m = len(s)... | false | 0.040887 | 0.041121 | 0.994288 | [
"s814209131",
"s973150575"
] |
u281303342 | p03945 | python | s426454135 | s551423421 | 48 | 44 | 3,188 | 3,188 | Accepted | Accepted | 8.33 | S = eval(input())
ans = 0
for i in range(1,len(S)):
if S[i-1]!=S[i]:
ans += 1
print(ans) | # python3 (3.4.3)
import sys
input = sys.stdin.readline
# main
S = input().rstrip()
ans = 0
for i in range(1,len(S)):
if S[i]!=S[i-1]:
ans += 1
print(ans) | 8 | 13 | 103 | 181 | S = eval(input())
ans = 0
for i in range(1, len(S)):
if S[i - 1] != S[i]:
ans += 1
print(ans)
| # python3 (3.4.3)
import sys
input = sys.stdin.readline
# main
S = input().rstrip()
ans = 0
for i in range(1, len(S)):
if S[i] != S[i - 1]:
ans += 1
print(ans)
| false | 38.461538 | [
"-S = eval(input())",
"+# python3 (3.4.3)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+# main",
"+S = input().rstrip()",
"- if S[i - 1] != S[i]:",
"+ if S[i] != S[i - 1]:"
] | false | 0.118766 | 0.047083 | 2.52247 | [
"s426454135",
"s551423421"
] |
u747602774 | p02683 | python | s044046745 | s854698192 | 328 | 86 | 84,716 | 9,212 | Accepted | Accepted | 73.78 | N,M,X = list(map(int,input().split()))
A = [list(map(int,input().split())) for i in range(N)]
ans = 10**10
for i in range(2**N):
cost = 0
rikai = [0 for i in range(M)]
for j in range(N):
if i>>j&1:
cost += A[j][0]
for k in range(M):
rikai[k] += A[j][... | N,M,X = list(map(int,input().split()))
A = [list(map(int,input().split())) for i in range(N)]
ans = 10**10
for i in range(2**N):
cost = 0
rikai = [0 for i in range(M)]
for j in range(N):
if i>>j&1:
cost += A[j][0]
for k in range(M):
rikai[k] += A[j][... | 20 | 15 | 504 | 412 | N, M, X = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]
ans = 10**10
for i in range(2**N):
cost = 0
rikai = [0 for i in range(M)]
for j in range(N):
if i >> j & 1:
cost += A[j][0]
for k in range(M):
rikai[k] += A[j][k ... | N, M, X = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]
ans = 10**10
for i in range(2**N):
cost = 0
rikai = [0 for i in range(M)]
for j in range(N):
if i >> j & 1:
cost += A[j][0]
for k in range(M):
rikai[k] += A[j][k ... | false | 25 | [
"- b = True",
"- for k in range(M):",
"- if rikai[k] >= X:",
"- continue",
"- b = False",
"- if b:",
"+ if min(rikai) >= X:"
] | false | 0.044214 | 0.08152 | 0.542372 | [
"s044046745",
"s854698192"
] |
u034782764 | p03470 | python | s534857790 | s016014173 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | print((len(set(eval(input()) for i in range(int(eval(input()))))))) | n=int(eval(input()))
d=len(set(list(int(eval(input())) for i in range(n))))
print(d) | 1 | 3 | 53 | 74 | print((len(set(eval(input()) for i in range(int(eval(input())))))))
| n = int(eval(input()))
d = len(set(list(int(eval(input())) for i in range(n))))
print(d)
| false | 66.666667 | [
"-print((len(set(eval(input()) for i in range(int(eval(input())))))))",
"+n = int(eval(input()))",
"+d = len(set(list(int(eval(input())) for i in range(n))))",
"+print(d)"
] | false | 0.04114 | 0.043234 | 0.951554 | [
"s534857790",
"s016014173"
] |
u843175622 | p04045 | python | s340061597 | s264626736 | 1,447 | 166 | 27,432 | 27,384 | Accepted | Accepted | 88.53 | import sys
import numpy as np
read = sys.stdin.readline
def main(n, k, a):
for i in np.arange(n, 100000):
ok = True
j = i
while j:
ok &= j % 10 not in a
j //= 10
if ok:
print(i)
break
if __name__ == '__main__':
... | import sys
import numpy as np
read = sys.stdin.readline
def main(n, k, a):
for i in np.arange(n, 100000):
ok = True
for j in str(i):
ok &= j not in a
if ok:
print(i)
break
if __name__ == '__main__':
n, k = np.fromstring(read(), dtyp... | 21 | 19 | 450 | 389 | import sys
import numpy as np
read = sys.stdin.readline
def main(n, k, a):
for i in np.arange(n, 100000):
ok = True
j = i
while j:
ok &= j % 10 not in a
j //= 10
if ok:
print(i)
break
if __name__ == "__main__":
n, k = np.fromst... | import sys
import numpy as np
read = sys.stdin.readline
def main(n, k, a):
for i in np.arange(n, 100000):
ok = True
for j in str(i):
ok &= j not in a
if ok:
print(i)
break
if __name__ == "__main__":
n, k = np.fromstring(read(), dtype=np.int32, sep... | false | 9.52381 | [
"- j = i",
"- while j:",
"- ok &= j % 10 not in a",
"- j //= 10",
"+ for j in str(i):",
"+ ok &= j not in a",
"- a = np.fromstring(read(), dtype=np.int32, sep=\" \")",
"+ a = set(read().split())"
] | false | 0.475838 | 0.181854 | 2.616591 | [
"s340061597",
"s264626736"
] |
u912237403 | p00017 | python | s584345536 | s160966121 | 20 | 10 | 4,236 | 4,212 | Accepted | Accepted | 50 | def rot(s):
x=""
for c in s:
tmp = ord(c)-ord("a")
if "a"<=c<="z":
x += chr((tmp+1) % 26 + ord("a"))
else:
x += c
return x
def check(s):
for word in s.split():
if word=="the" or word=="this" or word=="that":
return Tru... | import sys
def decode(s):
x=""
for c in s:
if not (c==" " or c=="."):
x+=chr(ord(c)+1)
else:
x+=c
return x.replace(chr(ord("z")+1),"a")
for s in sys.stdin.readlines():
for i in range(ord("z")-ord("a")+1):
if "the" in s or "that" in s or "this" i... | 26 | 15 | 547 | 391 | def rot(s):
x = ""
for c in s:
tmp = ord(c) - ord("a")
if "a" <= c <= "z":
x += chr((tmp + 1) % 26 + ord("a"))
else:
x += c
return x
def check(s):
for word in s.split():
if word == "the" or word == "this" or word == "that":
return Tru... | import sys
def decode(s):
x = ""
for c in s:
if not (c == " " or c == "."):
x += chr(ord(c) + 1)
else:
x += c
return x.replace(chr(ord("z") + 1), "a")
for s in sys.stdin.readlines():
for i in range(ord("z") - ord("a") + 1):
if "the" in s or "that" in s... | false | 42.307692 | [
"-def rot(s):",
"+import sys",
"+",
"+",
"+def decode(s):",
"- tmp = ord(c) - ord(\"a\")",
"- if \"a\" <= c <= \"z\":",
"- x += chr((tmp + 1) % 26 + ord(\"a\"))",
"+ if not (c == \" \" or c == \".\"):",
"+ x += chr(ord(c) + 1)",
"- return x",
"+ ... | false | 0.047373 | 0.049067 | 0.965475 | [
"s584345536",
"s160966121"
] |
u922449550 | p02727 | python | s400410241 | s489132954 | 623 | 343 | 34,352 | 23,216 | Accepted | Accepted | 44.94 | from heapq import heappush, heappop
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
P.sort(reverse=True)
Q = list(map(int, input().split()))
Q.sort(reverse=True)
R = list(map(int, input().split()))
R.sort(reverse=True)
ans = sum(P[:X]) + sum(Q[:Y])
apples = []
for p... | from heapq import heappush, heappop
X, Y, A, B, C = list(map(int, input().split()))
P = sorted(list(map(int, input().split())), reverse=True)
Q = sorted(list(map(int, input().split())), reverse=True)
R = sorted(list(map(int, input().split())), reverse=True)
ans = sum(P[:X]) + sum(Q[:Y])
apples = []
for p in ... | 29 | 24 | 571 | 547 | from heapq import heappush, heappop
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
P.sort(reverse=True)
Q = list(map(int, input().split()))
Q.sort(reverse=True)
R = list(map(int, input().split()))
R.sort(reverse=True)
ans = sum(P[:X]) + sum(Q[:Y])
apples = []
for p in P[:X]:
he... | from heapq import heappush, heappop
X, Y, A, B, C = list(map(int, input().split()))
P = sorted(list(map(int, input().split())), reverse=True)
Q = sorted(list(map(int, input().split())), reverse=True)
R = sorted(list(map(int, input().split())), reverse=True)
ans = sum(P[:X]) + sum(Q[:Y])
apples = []
for p in P[:X]:
... | false | 17.241379 | [
"-P = list(map(int, input().split()))",
"-P.sort(reverse=True)",
"-Q = list(map(int, input().split()))",
"-Q.sort(reverse=True)",
"-R = list(map(int, input().split()))",
"-R.sort(reverse=True)",
"+P = sorted(list(map(int, input().split())), reverse=True)",
"+Q = sorted(list(map(int, input().split())),... | false | 0.036639 | 0.038168 | 0.959956 | [
"s400410241",
"s489132954"
] |
u754022296 | p03083 | python | s647494954 | s121379962 | 1,024 | 403 | 55,384 | 58,584 | Accepted | Accepted | 60.64 | U = 2*10**5
MOD = 10**9+7
fact = [1]*(U+1)
fact_inv = [1]*(U+1)
for i in range(1,U+1):
fact[i] = (fact[i-1]*i)%MOD
fact_inv[U] = pow(fact[U], MOD-2, MOD)
for i in range(U,0,-1):
fact_inv[i-1] = (fact_inv[i]*i)%MOD
def comb(n, k):
if k < 0 or k > n:
return 0
z = fact[n]
... | U = 2*10**5
MOD = 10**9+7
fact = [1]*(U+1)
fact_inv = [1]*(U+1)
two = [1]*(U+1)
two_inv = [1]*(U+1)
for i in range(1,U+1):
fact[i] = (fact[i-1]*i)%MOD
two[i] = (two[i-1]*2)%MOD
fact_inv[U] = pow(fact[U], MOD-2, MOD)
two_inv[U] = pow(two[U], MOD-2, MOD)
for i in range(U,0,-1):
fact_inv[i... | 36 | 41 | 723 | 819 | U = 2 * 10**5
MOD = 10**9 + 7
fact = [1] * (U + 1)
fact_inv = [1] * (U + 1)
for i in range(1, U + 1):
fact[i] = (fact[i - 1] * i) % MOD
fact_inv[U] = pow(fact[U], MOD - 2, MOD)
for i in range(U, 0, -1):
fact_inv[i - 1] = (fact_inv[i] * i) % MOD
def comb(n, k):
if k < 0 or k > n:
return 0
z = f... | U = 2 * 10**5
MOD = 10**9 + 7
fact = [1] * (U + 1)
fact_inv = [1] * (U + 1)
two = [1] * (U + 1)
two_inv = [1] * (U + 1)
for i in range(1, U + 1):
fact[i] = (fact[i - 1] * i) % MOD
two[i] = (two[i - 1] * 2) % MOD
fact_inv[U] = pow(fact[U], MOD - 2, MOD)
two_inv[U] = pow(two[U], MOD - 2, MOD)
for i in range(U, 0,... | false | 12.195122 | [
"+two = [1] * (U + 1)",
"+two_inv = [1] * (U + 1)",
"+ two[i] = (two[i - 1] * 2) % MOD",
"+two_inv[U] = pow(two[U], MOD - 2, MOD)",
"+ two_inv[i - 1] = (two_inv[i] * 2) % MOD",
"- ans *= pow(2, MOD - 2, MOD)",
"+ ans *= two_inv[1]",
"- p += comb(i - 1, B - 1) * pow(pow(2, i, MOD), MOD -... | false | 0.829977 | 0.55924 | 1.484116 | [
"s647494954",
"s121379962"
] |
u904331908 | p03545 | python | s614164148 | s051547987 | 31 | 27 | 9,140 | 9,128 | Accepted | Accepted | 12.9 | s = input()
p = list(map(int,s))
for x in range(2**3):
ans = p[0]
for y in range(3):
if (x>>y)&1:
ans += p[y+1]
else:
ans -= p[y+1]
if ans == 7:
kotae = format(x,"#05b")
kotae = kotae[2:]
for z in range(3):
print(str(p[z]),end="")
if ... | #他の人の回答例 後から見返す用
A = eval(input())
n = len(A)-1
for i in range(2**n):
pn = ['-']*n
for j in range(n):
if ((i>>j)&1):
pn[n-1-j] = '+'
ans = A[0]+pn[0]+A[1]+pn[1]+A[2]+pn[2]+A[3]
if eval(ans) == 7:
print((ans+'=7'))
break
| 22 | 16 | 436 | 262 | s = input()
p = list(map(int, s))
for x in range(2**3):
ans = p[0]
for y in range(3):
if (x >> y) & 1:
ans += p[y + 1]
else:
ans -= p[y + 1]
if ans == 7:
kotae = format(x, "#05b")
kotae = kotae[2:]
for z in range(3):
print(str(p[z]), end="")
if kotae[-... | # 他の人の回答例 後から見返す用
A = eval(input())
n = len(A) - 1
for i in range(2**n):
pn = ["-"] * n
for j in range(n):
if (i >> j) & 1:
pn[n - 1 - j] = "+"
ans = A[0] + pn[0] + A[1] + pn[1] + A[2] + pn[2] + A[3]
if eval(ans) == 7:
print((ans + "=7"))
break
| false | 27.272727 | [
"-s = input()",
"-p = list(map(int, s))",
"-for x in range(2**3):",
"- ans = p[0]",
"- for y in range(3):",
"- if (x >> y) & 1:",
"- ans += p[y + 1]",
"- else:",
"- ans -= p[y + 1]",
"- if ans == 7:",
"- kotae = format(x, \"#05b\")",
"-kotae ... | false | 0.049058 | 0.048946 | 1.002303 | [
"s614164148",
"s051547987"
] |
u935558307 | p03526 | python | s699560412 | s959263709 | 901 | 408 | 235,164 | 70,480 | Accepted | Accepted | 54.72 | N = int(eval(input()))
HP = [list(map(int,input().split())) for _ in range(N)]
HP.sort(key=lambda x: x[0]+x[1])
ceil = max(HP,key=lambda x: x[0])[0]
#dp[i][j] -> i人目まで見る。j人積むときの、座布団の枚数の最小値
dp = [[ceil+1]*(N+1) for _ in range(N+1)]
ans = 0
for i in range(N+1):
dp[i][0] = 0
for i in range(1,N+1):
h,p = ... | N = int(eval(input()))
"""
dp[i][j] -> i番目の人間までみる。j人が積むときの最小値。
"""
HP = [list(map(int,input().split())) for _ in range(N)]
HP.sort(key=lambda x:x[0]+x[1])
dp = [float("INF")]*(N+1)
dp[0] = 0
for i in range(1,N+1):
for j in range(N,0,-1):
if dp[j-1] <= HP[i-1][0]:
dp[j] = min(dp[j],d... | 19 | 17 | 527 | 423 | N = int(eval(input()))
HP = [list(map(int, input().split())) for _ in range(N)]
HP.sort(key=lambda x: x[0] + x[1])
ceil = max(HP, key=lambda x: x[0])[0]
# dp[i][j] -> i人目まで見る。j人積むときの、座布団の枚数の最小値
dp = [[ceil + 1] * (N + 1) for _ in range(N + 1)]
ans = 0
for i in range(N + 1):
dp[i][0] = 0
for i in range(1, N + 1):
... | N = int(eval(input()))
"""
dp[i][j] -> i番目の人間までみる。j人が積むときの最小値。
"""
HP = [list(map(int, input().split())) for _ in range(N)]
HP.sort(key=lambda x: x[0] + x[1])
dp = [float("INF")] * (N + 1)
dp[0] = 0
for i in range(1, N + 1):
for j in range(N, 0, -1):
if dp[j - 1] <= HP[i - 1][0]:
dp[j] = min(dp[... | false | 10.526316 | [
"+\"\"\"",
"+dp[i][j] -> i番目の人間までみる。j人が積むときの最小値。",
"+\"\"\"",
"-ceil = max(HP, key=lambda x: x[0])[0]",
"-# dp[i][j] -> i人目まで見る。j人積むときの、座布団の枚数の最小値",
"-dp = [[ceil + 1] * (N + 1) for _ in range(N + 1)]",
"-ans = 0",
"-for i in range(N + 1):",
"- dp[i][0] = 0",
"+dp = [float(\"INF\")] * (N + 1)",... | false | 0.048299 | 0.110265 | 0.43803 | [
"s699560412",
"s959263709"
] |
u426108351 | p03645 | python | s711883941 | s604903750 | 771 | 474 | 38,320 | 38,320 | Accepted | Accepted | 38.52 | import sys
N, M = list(map(int, input().split()))
ship = [[] for i in range(N+1)]
for i in range(M):
a, b = list(map(int, input().split()))
ship[a].append(b)
ship[b].append(a)
flag = 0
for i in ship[1]:
if N in ship[i]:
flag = 1
if flag == 1:
print("POSSIBLE")
else:
p... | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
ship = [[] for i in range(N+1)]
for i in range(M):
a, b = list(map(int, input().split()))
ship[a].append(b)
ship[b].append(a)
flag = 0
for i in ship[1]:
if N in ship[i]:
flag = 1
if flag == 1:
print... | 18 | 18 | 327 | 353 | import sys
N, M = list(map(int, input().split()))
ship = [[] for i in range(N + 1)]
for i in range(M):
a, b = list(map(int, input().split()))
ship[a].append(b)
ship[b].append(a)
flag = 0
for i in ship[1]:
if N in ship[i]:
flag = 1
if flag == 1:
print("POSSIBLE")
else:
print("IMPOSSIBLE"... | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
ship = [[] for i in range(N + 1)]
for i in range(M):
a, b = list(map(int, input().split()))
ship[a].append(b)
ship[b].append(a)
flag = 0
for i in ship[1]:
if N in ship[i]:
flag = 1
if flag == 1:
print("POSSIBLE")
e... | false | 0 | [
"+input = sys.stdin.readline"
] | false | 0.038298 | 0.037654 | 1.017086 | [
"s711883941",
"s604903750"
] |
u150984829 | p00056 | python | s393269003 | s746086889 | 1,610 | 1,390 | 8,452 | 8,448 | Accepted | Accepted | 13.66 | import bisect,sys
from itertools import *
n=list(range(50001));a=list(n);a[1]=0
for i in range(2,224):a[i*2::i]=[0]*len(a[i*2::i])
p=list(compress(n,a))
for x in sys.stdin:
x=int(x)
if x:print((sum(1 for d in p[:bisect.bisect(p,x//2)]if a[x-d])))
| import bisect,sys
from itertools import *
n=list(range(50001));a=list(n);a[1]=0
for i in range(2,224):a[i*2::i]=[0]*len(a[i*2::i])
p=list(compress(n,a))
for x in map(int,sys.stdin):
if x:print((len([1 for d in p[:bisect.bisect(p,x//2)]if a[x-d]])))
| 8 | 7 | 248 | 248 | import bisect, sys
from itertools import *
n = list(range(50001))
a = list(n)
a[1] = 0
for i in range(2, 224):
a[i * 2 :: i] = [0] * len(a[i * 2 :: i])
p = list(compress(n, a))
for x in sys.stdin:
x = int(x)
if x:
print((sum(1 for d in p[: bisect.bisect(p, x // 2)] if a[x - d])))
| import bisect, sys
from itertools import *
n = list(range(50001))
a = list(n)
a[1] = 0
for i in range(2, 224):
a[i * 2 :: i] = [0] * len(a[i * 2 :: i])
p = list(compress(n, a))
for x in map(int, sys.stdin):
if x:
print((len([1 for d in p[: bisect.bisect(p, x // 2)] if a[x - d]])))
| false | 12.5 | [
"-for x in sys.stdin:",
"- x = int(x)",
"+for x in map(int, sys.stdin):",
"- print((sum(1 for d in p[: bisect.bisect(p, x // 2)] if a[x - d])))",
"+ print((len([1 for d in p[: bisect.bisect(p, x // 2)] if a[x - d]])))"
] | false | 0.093266 | 0.048832 | 1.909937 | [
"s393269003",
"s746086889"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.