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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u606878291 | p03379 | python | s141062086 | s574995811 | 325 | 286 | 25,356 | 25,812 | Accepted | Accepted | 12 | N = int(eval(input()))
numbers_r = tuple(map(int, input().split(' ')))
numbers_s = sorted(numbers_r)
med_high = numbers_s[N // 2]
med_low = numbers_s[N // 2 - 1]
for number in numbers_r:
if number == med_low:
print(med_high)
elif number == med_high:
print(med_low)
elif number <... | N = int(eval(input()))
numbers_r = tuple(map(int, input().split(' ')))
numbers_s = sorted(numbers_r)
med_high = numbers_s[N // 2]
med_low = numbers_s[N // 2 - 1]
for number in numbers_r:
if number <= med_low:
print(med_high)
else:
print(med_low)
| 16 | 12 | 402 | 277 | N = int(eval(input()))
numbers_r = tuple(map(int, input().split(" ")))
numbers_s = sorted(numbers_r)
med_high = numbers_s[N // 2]
med_low = numbers_s[N // 2 - 1]
for number in numbers_r:
if number == med_low:
print(med_high)
elif number == med_high:
print(med_low)
elif number < med_low:
... | N = int(eval(input()))
numbers_r = tuple(map(int, input().split(" ")))
numbers_s = sorted(numbers_r)
med_high = numbers_s[N // 2]
med_low = numbers_s[N // 2 - 1]
for number in numbers_r:
if number <= med_low:
print(med_high)
else:
print(med_low)
| false | 25 | [
"- if number == med_low:",
"+ if number <= med_low:",
"- elif number == med_high:",
"+ else:",
"- elif number < med_low:",
"- print(med_high)",
"- elif number > med_high:",
"- print(med_low)"
] | false | 0.127381 | 0.038184 | 3.33595 | [
"s141062086",
"s574995811"
] |
u949338836 | p02412 | python | s284630367 | s097703450 | 110 | 80 | 6,720 | 6,728 | Accepted | Accepted | 27.27 | #coding:utf-8
#1_7_B 2015.4.5
while True:
n,x = list(map(int,input().split()))
if n == x == 0:
break
count = 0
for i in range(1 , n + 1):
for j in range(1 , n + 1):
if (x - i - j) <= n and i < j < (x - i -j):
count += 1
print(count) | #coding:utf-8
#1_7_B 2015.4.5
while True:
n,x = list(map(int,input().split()))
if n == x == 0:
break
count = 0
for i in range(1 , n + 1):
for j in range(1 , n + 1):
if i < j < (x - i - j) <= n:
count += 1
print(count) | 13 | 13 | 307 | 292 | # coding:utf-8
# 1_7_B 2015.4.5
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
count = 0
for i in range(1, n + 1):
for j in range(1, n + 1):
if (x - i - j) <= n and i < j < (x - i - j):
count += 1
print(count)
| # coding:utf-8
# 1_7_B 2015.4.5
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
count = 0
for i in range(1, n + 1):
for j in range(1, n + 1):
if i < j < (x - i - j) <= n:
count += 1
print(count)
| false | 0 | [
"- if (x - i - j) <= n and i < j < (x - i - j):",
"+ if i < j < (x - i - j) <= n:"
] | false | 0.03979 | 0.035167 | 1.131472 | [
"s284630367",
"s097703450"
] |
u151503168 | p02983 | python | s104173207 | s651628153 | 812 | 58 | 3,060 | 3,060 | Accepted | Accepted | 92.86 | L, R = list(map(int, input().split()))
x, y = L % 2019, R % 2019
if (R-L) > 2017 or x>=y:
print((0))
else:
m = 2019
for i in range(x, y + 1):
for j in range(i + 1, y + 1):
x = (i * j) % 2019
m = min(m, x)
print(m) | L, R = list(map(int, input().split()))
x, y = L % 2019, R % 2019
if (R-L) > 2017 or x>=y:
print((0))
else:
m = 2019
for i in range(x, y + 1):
for j in range(i + 1, y + 1):
x = (i * j) % 2019
m = min(m, x)
if m == 0:
break
if m == 0:... | 11 | 15 | 261 | 345 | L, R = list(map(int, input().split()))
x, y = L % 2019, R % 2019
if (R - L) > 2017 or x >= y:
print((0))
else:
m = 2019
for i in range(x, y + 1):
for j in range(i + 1, y + 1):
x = (i * j) % 2019
m = min(m, x)
print(m)
| L, R = list(map(int, input().split()))
x, y = L % 2019, R % 2019
if (R - L) > 2017 or x >= y:
print((0))
else:
m = 2019
for i in range(x, y + 1):
for j in range(i + 1, y + 1):
x = (i * j) % 2019
m = min(m, x)
if m == 0:
break
if m == 0:
... | false | 26.666667 | [
"+ if m == 0:",
"+ break",
"+ if m == 0:",
"+ break"
] | false | 0.176001 | 0.035044 | 5.022311 | [
"s104173207",
"s651628153"
] |
u186838327 | p03253 | python | s251357060 | s965402440 | 214 | 95 | 80,880 | 89,080 | Accepted | Accepted | 55.61 | import math
def factorize(n):
d = {}
temp = int(math.sqrt(n))+1
for i in range(2, temp):
while n%i== 0:
n //= i
if i in d:
d[i] += 1
else:
d[i] = 1
if d == {}:
d[n] = 1
else:
if n in d:
... | n, m = list(map(int, input().split()))
if m == 1:
print((1))
exit()
mod = 10**9+7
import math
def factorize(n):
d = {}
temp = int(math.sqrt(n))+1
for i in range(2, temp):
while n%i== 0:
n //= i
if i in d:
d[i] += 1
else:... | 50 | 51 | 969 | 961 | import math
def factorize(n):
d = {}
temp = int(math.sqrt(n)) + 1
for i in range(2, temp):
while n % i == 0:
n //= i
if i in d:
d[i] += 1
else:
d[i] = 1
if d == {}:
d[n] = 1
else:
if n in d:
d[n... | n, m = list(map(int, input().split()))
if m == 1:
print((1))
exit()
mod = 10**9 + 7
import math
def factorize(n):
d = {}
temp = int(math.sqrt(n)) + 1
for i in range(2, temp):
while n % i == 0:
n //= i
if i in d:
d[i] += 1
else:
... | false | 1.960784 | [
"+n, m = list(map(int, input().split()))",
"+if m == 1:",
"+ print((1))",
"+ exit()",
"+mod = 10**9 + 7",
"-n, m = list(map(int, input().split()))",
"-if m == 1:",
"- print((1))",
"- exit()",
"+mod = 10**9 + 7",
"+N = 10**6",
"+fac = [1] * (N + 1)",
"+finv = [1] * (N + 1)",
"+f... | false | 1.864213 | 1.367956 | 1.362772 | [
"s251357060",
"s965402440"
] |
u653837719 | p02862 | python | s099316200 | s090736432 | 913 | 228 | 86,244 | 29,428 | Accepted | Accepted | 75.03 | fac = [0] * 700000
finv = [0] * 700000
inv = [0] * 700000
mod = 1000000007
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, 700000):
fac[i] = fac[i - 1] * i % mod
inv[i] = mod - inv[mod % i] * (mod // i) % mod
finv[i] = finv[i - 1] * inv[i] % mod
x, y = list(map(int, inp... | mod = 10 ** 9 + 7
ans = 0
x, y = list(map(int, input().split()))
if (x + y) % 3 == 0:
k = (2 * x - y) // 3
l = (2 * y - x) // 3
if k >= 0 and l >= 0:
fac = [1] * (k + l + 1)
for i in range(2, k + l + 1):
fac[i] = fac[i - 1] * i % mod
ans = fac[k + l] * (pow(... | 24 | 15 | 543 | 391 | fac = [0] * 700000
finv = [0] * 700000
inv = [0] * 700000
mod = 1000000007
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, 700000):
fac[i] = fac[i - 1] * i % mod
inv[i] = mod - inv[mod % i] * (mod // i) % mod
finv[i] = finv[i - 1] * inv[i] % mod
x, y = list(map(int, input().split()))
... | mod = 10**9 + 7
ans = 0
x, y = list(map(int, input().split()))
if (x + y) % 3 == 0:
k = (2 * x - y) // 3
l = (2 * y - x) // 3
if k >= 0 and l >= 0:
fac = [1] * (k + l + 1)
for i in range(2, k + l + 1):
fac[i] = fac[i - 1] * i % mod
ans = (
fac[k + l]
... | false | 37.5 | [
"-fac = [0] * 700000",
"-finv = [0] * 700000",
"-inv = [0] * 700000",
"-mod = 1000000007",
"-fac[0] = fac[1] = 1",
"-finv[0] = finv[1] = 1",
"-inv[1] = 1",
"-for i in range(2, 700000):",
"- fac[i] = fac[i - 1] * i % mod",
"- inv[i] = mod - inv[mod % i] * (mod // i) % mod",
"- finv[i] = ... | false | 1.047742 | 0.083428 | 12.558679 | [
"s099316200",
"s090736432"
] |
u581603131 | p03448 | python | s304487266 | s368151341 | 51 | 18 | 2,940 | 3,064 | Accepted | Accepted | 64.71 | A, B, C, X = [int(eval(input())) for i in range(4)]
count = 0
for a in range(A+1):
for b in range(B+1):
for c in range(C+1):
if 500*a+100*b+50*c==X:
count += 1
print(count) | A, B, C, X = [int(eval(input())) for i in range(4)]
count = 0
for a in range(A+1):
for b in range(B+1):
if 0<=X-500*a-100*b<=C*50:
count += 1
print(count) | 8 | 7 | 213 | 178 | A, B, C, X = [int(eval(input())) for i in range(4)]
count = 0
for a in range(A + 1):
for b in range(B + 1):
for c in range(C + 1):
if 500 * a + 100 * b + 50 * c == X:
count += 1
print(count)
| A, B, C, X = [int(eval(input())) for i in range(4)]
count = 0
for a in range(A + 1):
for b in range(B + 1):
if 0 <= X - 500 * a - 100 * b <= C * 50:
count += 1
print(count)
| false | 12.5 | [
"- for c in range(C + 1):",
"- if 500 * a + 100 * b + 50 * c == X:",
"- count += 1",
"+ if 0 <= X - 500 * a - 100 * b <= C * 50:",
"+ count += 1"
] | false | 0.094841 | 0.035978 | 2.636079 | [
"s304487266",
"s368151341"
] |
u678167152 | p03470 | python | s772967566 | s596378583 | 185 | 61 | 38,256 | 62,424 | Accepted | Accepted | 67.03 | N = int(eval(input()))
A = [0]*N
for i in range(N):
A[i] = int(eval(input()))
ans = len(set(A))
print(ans) | N = int(eval(input()))
D = [int(eval(input())) for _ in range(N)]
print((len(set(D)))) | 7 | 3 | 105 | 74 | N = int(eval(input()))
A = [0] * N
for i in range(N):
A[i] = int(eval(input()))
ans = len(set(A))
print(ans)
| N = int(eval(input()))
D = [int(eval(input())) for _ in range(N)]
print((len(set(D))))
| false | 57.142857 | [
"-A = [0] * N",
"-for i in range(N):",
"- A[i] = int(eval(input()))",
"-ans = len(set(A))",
"-print(ans)",
"+D = [int(eval(input())) for _ in range(N)]",
"+print((len(set(D))))"
] | false | 0.03944 | 0.040793 | 0.966841 | [
"s772967566",
"s596378583"
] |
u489959379 | p03380 | python | s697709832 | s932136223 | 237 | 81 | 62,704 | 20,024 | Accepted | Accepted | 65.82 | import sys
import bisect
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = sorted(list(map(int, input().split())))
if n == 2:
print((*A[::-1]))
exit()
idx = bisect.bisect_left(A, A[-1] // 2)
if abs(A[-1... | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 998244353
def resolve():
n = int(eval(input()))
A = sorted(list(map(int, input().split())))
MAX_V = A[-1]
target = MAX_V // 2 if MAX_V % 2 == 0 else (MAX_V + 1) // 2
diff = f_inf
res = A[0]
for i in ran... | 24 | 25 | 470 | 497 | import sys
import bisect
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = sorted(list(map(int, input().split())))
if n == 2:
print((*A[::-1]))
exit()
idx = bisect.bisect_left(A, A[-1] // 2)
if abs(A[-1] - A[idx] - A[-1] //... | import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 998244353
def resolve():
n = int(eval(input()))
A = sorted(list(map(int, input().split())))
MAX_V = A[-1]
target = MAX_V // 2 if MAX_V % 2 == 0 else (MAX_V + 1) // 2
diff = f_inf
res = A[0]
for i in range(n - 1):
i... | false | 4 | [
"-import bisect",
"-mod = 10**9 + 7",
"+mod = 998244353",
"- if n == 2:",
"- print((*A[::-1]))",
"- exit()",
"- idx = bisect.bisect_left(A, A[-1] // 2)",
"- if abs(A[-1] - A[idx] - A[-1] // 2) > abs(A[-1] - A[idx - 1] - A[-1] // 2):",
"- idx -= 1",
"- print((A[-1],... | false | 0.066652 | 0.149573 | 0.445612 | [
"s697709832",
"s932136223"
] |
u353919145 | p03719 | python | s488471449 | s445440562 | 17 | 11 | 2,940 | 2,568 | Accepted | Accepted | 35.29 | A ,B ,C = [int(x) for x in input().strip().split(' ')]
if(not C < A and not C > B):
print('Yes')
else:
print('No') | s = input().split()
a= int(s[0])
b= int(s[1])
c= int(s[2])
if c in range(a,b+1):
print("Yes")
else:
print("No") | 5 | 9 | 126 | 131 | A, B, C = [int(x) for x in input().strip().split(" ")]
if not C < A and not C > B:
print("Yes")
else:
print("No")
| s = input().split()
a = int(s[0])
b = int(s[1])
c = int(s[2])
if c in range(a, b + 1):
print("Yes")
else:
print("No")
| false | 44.444444 | [
"-A, B, C = [int(x) for x in input().strip().split(\" \")]",
"-if not C < A and not C > B:",
"+s = input().split()",
"+a = int(s[0])",
"+b = int(s[1])",
"+c = int(s[2])",
"+if c in range(a, b + 1):"
] | false | 0.042893 | 0.040571 | 1.057231 | [
"s488471449",
"s445440562"
] |
u057109575 | p02714 | python | s170377592 | s986141924 | 1,541 | 163 | 74,752 | 73,308 | Accepted | Accepted | 89.42 |
from bisect import bisect_left
N = int(eval(input()))
S = eval(input())
d = {"R": [], "G": [], "B": []}
for i in range(N):
d[S[i]].append(i)
def find(x, y, z):
total = len(z)
res = 0
for i in x:
for j in y:
if i > j:
continue
# Fin... |
N = int(eval(input()))
S = eval(input())
d = {"R": 0, "G": 0, "B": 0}
for i in range(N):
d[S[i]] += 1
cnt = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
k = 2 * j - i
if k >= N:
continue
if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
... | 38 | 19 | 805 | 362 | from bisect import bisect_left
N = int(eval(input()))
S = eval(input())
d = {"R": [], "G": [], "B": []}
for i in range(N):
d[S[i]].append(i)
def find(x, y, z):
total = len(z)
res = 0
for i in x:
for j in y:
if i > j:
continue
# Find k > j
k ... | N = int(eval(input()))
S = eval(input())
d = {"R": 0, "G": 0, "B": 0}
for i in range(N):
d[S[i]] += 1
cnt = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
k = 2 * j - i
if k >= N:
continue
if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
cnt += 1
print((... | false | 50 | [
"-from bisect import bisect_left",
"-",
"-d = {\"R\": [], \"G\": [], \"B\": []}",
"+d = {\"R\": 0, \"G\": 0, \"B\": 0}",
"- d[S[i]].append(i)",
"-",
"-",
"-def find(x, y, z):",
"- total = len(z)",
"- res = 0",
"- for i in x:",
"- for j in y:",
"- if i > j:",
"... | false | 0.045999 | 0.038457 | 1.196112 | [
"s170377592",
"s986141924"
] |
u029000441 | p03103 | python | s159344222 | s152040385 | 416 | 226 | 28,188 | 28,708 | Accepted | Accepted | 45.67 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
fr... | #float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import h... | 33 | 39 | 951 | 1,057 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heapq import heapify, heappop, heappush
from mat... | # float型を許すな
# numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heapq import heapif... | false | 15.384615 | [
"+# float型を許すな",
"+# numpyはpythonで",
"-from math import floor, ceil",
"+from math import floor, ceil, pi, factorial",
"+def SI():",
"+ return input().rstrip()",
"+",
"+",
"-# s=input().rstrip()",
"-lis.sort()",
"+lis.sort(key=lambda x: x[0])",
"+# print(lis)",
"+j = 0",
"-rest = m",
"... | false | 0.03704 | 0.042058 | 0.880697 | [
"s159344222",
"s152040385"
] |
u564902833 | p02971 | python | s302821466 | s976825004 | 510 | 425 | 14,048 | 26,796 | Accepted | Accepted | 16.67 | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
k = max(list(range(N)), key=lambda i: A[i])
for i in range(N):
if i != k:
print((A[k]))
else:
print((
max(
max(A[:k], default=0),
max(A[(k + 1):], default=0)
)
... | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
# 最大値をとるインデックスを求めておく
k = max(list(range(N)), key=lambda i: A[i])
ans = '\n'.join(
str(
max(A[:k] + A[k + 1:]) if i == k else
A[k]
)
for i in range(N)
)
print(ans)
| 14 | 14 | 309 | 254 | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
k = max(list(range(N)), key=lambda i: A[i])
for i in range(N):
if i != k:
print((A[k]))
else:
print((max(max(A[:k], default=0), max(A[(k + 1) :], default=0))))
| N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
# 最大値をとるインデックスを求めておく
k = max(list(range(N)), key=lambda i: A[i])
ans = "\n".join(str(max(A[:k] + A[k + 1 :]) if i == k else A[k]) for i in range(N))
print(ans)
| false | 0 | [
"+# 最大値をとるインデックスを求めておく",
"-for i in range(N):",
"- if i != k:",
"- print((A[k]))",
"- else:",
"- print((max(max(A[:k], default=0), max(A[(k + 1) :], default=0))))",
"+ans = \"\\n\".join(str(max(A[:k] + A[k + 1 :]) if i == k else A[k]) for i in range(N))",
"+print(ans)"
] | false | 0.039474 | 0.041234 | 0.957332 | [
"s302821466",
"s976825004"
] |
u347600233 | p02691 | python | s405000172 | s834514241 | 441 | 363 | 59,624 | 66,316 | Accepted | Accepted | 17.69 | n = int(eval(input()))
L_dict, R_dict = {}, {}
i = 0
for ipt in input().split():
try:
L_dict[i + int(ipt)] += 1
except KeyError:
L_dict[i + int(ipt)] = 1
try:
R_dict[i - int(ipt)] += 1
except KeyError:
R_dict[i - int(ipt)] = 1
i += 1
cnt = 0
for Lk, Lv i... | from collections import defaultdict
n = int(eval(input()))
L_dict, R_dict = defaultdict(int), defaultdict(int)
i = 0
for ipt in input().split():
L_dict[i + int(ipt)] += 1
R_dict[i - int(ipt)] += 1
i += 1
cnt = 0
for Lk, Lv in list(L_dict.items()):
try:
cnt += R_dict[Lk] * Lv
exce... | 20 | 15 | 421 | 346 | n = int(eval(input()))
L_dict, R_dict = {}, {}
i = 0
for ipt in input().split():
try:
L_dict[i + int(ipt)] += 1
except KeyError:
L_dict[i + int(ipt)] = 1
try:
R_dict[i - int(ipt)] += 1
except KeyError:
R_dict[i - int(ipt)] = 1
i += 1
cnt = 0
for Lk, Lv in list(L_dict.... | from collections import defaultdict
n = int(eval(input()))
L_dict, R_dict = defaultdict(int), defaultdict(int)
i = 0
for ipt in input().split():
L_dict[i + int(ipt)] += 1
R_dict[i - int(ipt)] += 1
i += 1
cnt = 0
for Lk, Lv in list(L_dict.items()):
try:
cnt += R_dict[Lk] * Lv
except KeyError... | false | 25 | [
"+from collections import defaultdict",
"+",
"-L_dict, R_dict = {}, {}",
"+L_dict, R_dict = defaultdict(int), defaultdict(int)",
"- try:",
"- L_dict[i + int(ipt)] += 1",
"- except KeyError:",
"- L_dict[i + int(ipt)] = 1",
"- try:",
"- R_dict[i - int(ipt)] += 1",
"- ... | false | 0.083369 | 0.032388 | 2.574053 | [
"s405000172",
"s834514241"
] |
u129836004 | p03078 | python | s624800868 | s274760992 | 1,444 | 565 | 55,000 | 3,828 | Accepted | Accepted | 60.87 | import heapq
x, y, z, K = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)
n = []
heapq.heapify(n)
heapq.heappush(n, (-(a[0]+b[0] + c[0]), 0,0,0... | import heapq
X, Y, Z, K = list(map(int, input().split()))
a =list(map(int, input().split()))
b =list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)
ans = [(-(a[0]+b[0]+c[0]), 0, 0, 0)]
for i in range(K):
m, j, k, h = heap... | 30 | 25 | 771 | 729 | import heapq
x, y, z, K = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
n = []
heapq.heapify(n)
heapq.heappush(n, (-(a[0] + b[0] + c[0]), 0, 0, 0))
for i in range... | import heapq
X, Y, Z, K = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]
for i in range(K):
m, j, k, h = heapq.heappop... | false | 16.666667 | [
"-x, y, z, K = list(map(int, input().split()))",
"+X, Y, Z, K = list(map(int, input().split()))",
"-n = []",
"-heapq.heapify(n)",
"-heapq.heappush(n, (-(a[0] + b[0] + c[0]), 0, 0, 0))",
"+ans = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]",
"- (m, j, k, l) = heapq.heappop(n)",
"+ m, j, k, h = heapq.heappo... | false | 0.037689 | 0.037411 | 1.007439 | [
"s624800868",
"s274760992"
] |
u360515075 | p02911 | python | s727304914 | s297680799 | 270 | 144 | 7,832 | 7,848 | Accepted | Accepted | 46.67 | N, K, Q =list(map(int, input().split()))
A = [K-Q for _ in range(N)]
for i in range(Q):
A[int(eval(input()))-1] += 1
for i in range(N):
print(("Yes" if A[i] > 0 else "No")) | import sys
input = sys.stdin.readline
N, K, Q =list(map(int, input().split()))
A = [K-Q for _ in range(N)]
for i in range(Q):
A[int(eval(input()))-1] += 1
for i in range(N):
print(("Yes" if A[i] > 0 else "No")) | 6 | 9 | 168 | 210 | N, K, Q = list(map(int, input().split()))
A = [K - Q for _ in range(N)]
for i in range(Q):
A[int(eval(input())) - 1] += 1
for i in range(N):
print(("Yes" if A[i] > 0 else "No"))
| import sys
input = sys.stdin.readline
N, K, Q = list(map(int, input().split()))
A = [K - Q for _ in range(N)]
for i in range(Q):
A[int(eval(input())) - 1] += 1
for i in range(N):
print(("Yes" if A[i] > 0 else "No"))
| false | 33.333333 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.040784 | 0.040602 | 1.004493 | [
"s727304914",
"s297680799"
] |
u024782094 | p03014 | python | s908653988 | s869437587 | 722 | 537 | 221,420 | 115,500 | Accepted | Accepted | 25.62 | import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return list(map(int,input().split()))
def lmp(): return list(map(int,inp... | import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return list(map(int,input().split()))
def lmp(): return list(map(int,inp... | 54 | 58 | 1,222 | 1,259 | import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input():
return sys.stdin.readline().strip()
def mp():
return list(map(int, input().split()))
def lmp():
return list(map... | import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input():
return sys.stdin.readline().strip()
def mp():
return list(map(int, input().split()))
def lmp():
return list(map... | false | 6.896552 | [
"-print((max(list(itertools.chain.from_iterable(ans))) - 1))",
"+x = 0",
"+for i in range(h + 2):",
"+ for j in range(w + 2):",
"+ x = max(x, ans[i][j] - 1)",
"+print(x)"
] | false | 0.038234 | 0.038556 | 0.99164 | [
"s908653988",
"s869437587"
] |
u561083515 | p03297 | python | s991357871 | s726843385 | 52 | 40 | 5,688 | 5,304 | Accepted | Accepted | 23.08 | # 解説AC
from fractions import gcd
def judge(A,B,C,D):
if A < B: return False
if D < B: return False
if C >= B: return True
g = gcd(B, D)
return False if ((B - g + (A % g)) > C) else True
T = int(eval(input()))
for _ in range(T):
A,B,C,D = list(map(int, input().split()))
i... | # 解説AC
from fractions import gcd
def judge(A,B,C,D):
"""
在庫数をXとする。
C < X < B のときFalse
p,qを0以上の整数とすると、
X = A + D * p - B * q
X = A % G + k * G
C + 1 <= X
-> k = ceil((C + 1 - A % G) / G)
"""
if A < B: return False
if D < B: return False
if C >= B: return... | 16 | 27 | 361 | 576 | # 解説AC
from fractions import gcd
def judge(A, B, C, D):
if A < B:
return False
if D < B:
return False
if C >= B:
return True
g = gcd(B, D)
return False if ((B - g + (A % g)) > C) else True
T = int(eval(input()))
for _ in range(T):
A, B, C, D = list(map(int, input().sp... | # 解説AC
from fractions import gcd
def judge(A, B, C, D):
"""
在庫数をXとする。
C < X < B のときFalse
p,qを0以上の整数とすると、
X = A + D * p - B * q
X = A % G + k * G
C + 1 <= X
-> k = ceil((C + 1 - A % G) / G)
"""
if A < B:
return False
if D < B:
return False
if C >= B:
... | false | 40.740741 | [
"+ \"\"\"",
"+ 在庫数をXとする。",
"+ C < X < B のときFalse",
"+ p,qを0以上の整数とすると、",
"+ X = A + D * p - B * q",
"+ X = A % G + k * G",
"+ C + 1 <= X",
"+ -> k = ceil((C + 1 - A % G) / G)",
"+ \"\"\"",
"- g = gcd(B, D)",
"- return False if ((B - g + (A % g)) > C) else True",
... | false | 0.055209 | 0.124705 | 0.442714 | [
"s991357871",
"s726843385"
] |
u814781830 | p02585 | python | s006636724 | s925625400 | 413 | 128 | 68,524 | 85,752 | Accepted | Accepted | 69.01 | N, K = list(map(int, input().split()))
P = list([int(x)-1 for x in input().split()])
C = list(map(int, input().split()))
ans = -10**29
for start in range(N):
now = start
point = 0
for j in range(K):
now = P[now]
point += C[now]
ans = max(ans, point)
if now == sta... | N, K = list(map(int, input().split()))
P = list([int(x)-1 for x in input().split()])
C = list(map(int, input().split()))
move_db = [[0] * N for _ in range(65)]
point_db = [[0] * N for _ in range(65)]
maxpoint_db = [[0] * N for _ in range(65)]
for i, (p, c) in enumerate(zip(P, C)):
move_db[0][i] = p
... | 27 | 29 | 654 | 887 | N, K = list(map(int, input().split()))
P = list([int(x) - 1 for x in input().split()])
C = list(map(int, input().split()))
ans = -(10**29)
for start in range(N):
now = start
point = 0
for j in range(K):
now = P[now]
point += C[now]
ans = max(ans, point)
if now == start:
... | N, K = list(map(int, input().split()))
P = list([int(x) - 1 for x in input().split()])
C = list(map(int, input().split()))
move_db = [[0] * N for _ in range(65)]
point_db = [[0] * N for _ in range(65)]
maxpoint_db = [[0] * N for _ in range(65)]
for i, (p, c) in enumerate(zip(P, C)):
move_db[0][i] = p
point_db[0... | false | 6.896552 | [
"-ans = -(10**29)",
"-for start in range(N):",
"- now = start",
"- point = 0",
"- for j in range(K):",
"- now = P[now]",
"- point += C[now]",
"- ans = max(ans, point)",
"- if now == start:",
"- break",
"- loop_cnt = j + 1",
"- left_k = K - ... | false | 0.047742 | 0.046006 | 1.037733 | [
"s006636724",
"s925625400"
] |
u263654061 | p03317 | python | s587928270 | s998500028 | 26 | 17 | 10,420 | 3,060 | Accepted | Accepted | 34.62 | tmp= input().rstrip().split(' ')
N=int(tmp[0])
K=int(tmp[1])
tmp= input().rstrip().split(' ')
L = tmp.index("1")
out = L//(K-1) + (N-1-L)//(K-1)
if(L%(K-1)>0):
out+=1
if((N-1-L)%(K-1)>0):
out+=1
if ((L%(K-1)==0) or ((N-1-L)%(K-1)==0)):
pass
elif((L%(K-1) + (N-1-L)%(K-1)) <= (K-1)):
... | n,k = list(map(int, input().split()))
if n <= k:
print((1))
else:
if (n-1)%(k-1)==0:
print(((n-1)//(k-1)))
else:
print(((n-1)//(k-1)+1)) | 20 | 8 | 349 | 159 | tmp = input().rstrip().split(" ")
N = int(tmp[0])
K = int(tmp[1])
tmp = input().rstrip().split(" ")
L = tmp.index("1")
out = L // (K - 1) + (N - 1 - L) // (K - 1)
if L % (K - 1) > 0:
out += 1
if (N - 1 - L) % (K - 1) > 0:
out += 1
if (L % (K - 1) == 0) or ((N - 1 - L) % (K - 1) == 0):
pass
elif (L % (K - 1)... | n, k = list(map(int, input().split()))
if n <= k:
print((1))
else:
if (n - 1) % (k - 1) == 0:
print(((n - 1) // (k - 1)))
else:
print(((n - 1) // (k - 1) + 1))
| false | 60 | [
"-tmp = input().rstrip().split(\" \")",
"-N = int(tmp[0])",
"-K = int(tmp[1])",
"-tmp = input().rstrip().split(\" \")",
"-L = tmp.index(\"1\")",
"-out = L // (K - 1) + (N - 1 - L) // (K - 1)",
"-if L % (K - 1) > 0:",
"- out += 1",
"-if (N - 1 - L) % (K - 1) > 0:",
"- out += 1",
"-if (L % (... | false | 0.044715 | 0.043902 | 1.01853 | [
"s587928270",
"s998500028"
] |
u864197622 | p03241 | python | s723848506 | s431364086 | 46 | 28 | 3,060 | 3,192 | Accepted | Accepted | 39.13 | N, M = list(map(int, input().split(" ")))
flg = 0
for i in range(N, M+1):
if M % i == 0:
print((M//i))
flg = 1
break
if i**2 > M:
break
if flg == 0:
for i in range(M//N, 0, -1):
if M % i == 0:
print (i)
break | def primeFactor(N):
i = 2
ret = {}
n = N
if n < 0:
ret[-1] = 1
n = -n
if n == 0:
ret[0] = 1
while i**2 <= n:
k = 0
while n % i == 0:
n //= i
k += 1
ret[i] = k
i += 1
if n > 1:
ret[n] ... | 15 | 51 | 292 | 958 | N, M = list(map(int, input().split(" ")))
flg = 0
for i in range(N, M + 1):
if M % i == 0:
print((M // i))
flg = 1
break
if i**2 > M:
break
if flg == 0:
for i in range(M // N, 0, -1):
if M % i == 0:
print(i)
break
| def primeFactor(N):
i = 2
ret = {}
n = N
if n < 0:
ret[-1] = 1
n = -n
if n == 0:
ret[0] = 1
while i**2 <= n:
k = 0
while n % i == 0:
n //= i
k += 1
ret[i] = k
i += 1
if n > 1:
ret[n] = 1
return re... | false | 70.588235 | [
"+def primeFactor(N):",
"+ i = 2",
"+ ret = {}",
"+ n = N",
"+ if n < 0:",
"+ ret[-1] = 1",
"+ n = -n",
"+ if n == 0:",
"+ ret[0] = 1",
"+ while i**2 <= n:",
"+ k = 0",
"+ while n % i == 0:",
"+ n //= i",
"+ k += 1"... | false | 0.038679 | 0.040782 | 0.948423 | [
"s723848506",
"s431364086"
] |
u860829879 | p02781 | python | s186198945 | s886051139 | 205 | 92 | 40,816 | 75,300 | Accepted | Accepted | 55.12 | N=eval(input())
K=int(eval(input()))
l=len(N)
dp=[[[0]*(K+2) for _ in range(2)] for _ in range(l+1)]
dp[0][1][0]=1
for i,c in enumerate(N):
x=int(c)
for j in range(2):
for d in range(x+1 if j==1 else 10):
for k in range(K+1):
dp[i+1][x==d if j==1 else 0][k... | n=eval(input())
kk=int(eval(input()))
l=len(n)
dp=[[[0]*2 for _ in range(101)] for _ in range(l+1)]
dp[0][0][0]=1
for i,dig in enumerate(n):
dig=int(dig)
for j in range(10):
for k in range(100):
nk=k if j==0 else k+1
if j<dig:
dp[i+1][nk][1]+=dp... | 18 | 23 | 375 | 545 | N = eval(input())
K = int(eval(input()))
l = len(N)
dp = [[[0] * (K + 2) for _ in range(2)] for _ in range(l + 1)]
dp[0][1][0] = 1
for i, c in enumerate(N):
x = int(c)
for j in range(2):
for d in range(x + 1 if j == 1 else 10):
for k in range(K + 1):
dp[i + 1][x == d if j == ... | n = eval(input())
kk = int(eval(input()))
l = len(n)
dp = [[[0] * 2 for _ in range(101)] for _ in range(l + 1)]
dp[0][0][0] = 1
for i, dig in enumerate(n):
dig = int(dig)
for j in range(10):
for k in range(100):
nk = k if j == 0 else k + 1
if j < dig:
dp[i + 1][nk... | false | 21.73913 | [
"-N = eval(input())",
"-K = int(eval(input()))",
"-l = len(N)",
"-dp = [[[0] * (K + 2) for _ in range(2)] for _ in range(l + 1)]",
"-dp[0][1][0] = 1",
"-for i, c in enumerate(N):",
"- x = int(c)",
"- for j in range(2):",
"- for d in range(x + 1 if j == 1 else 10):",
"- for ... | false | 0.032353 | 0.034723 | 0.931748 | [
"s186198945",
"s886051139"
] |
u353797797 | p02992 | python | s514809370 | s569011618 | 1,978 | 1,240 | 9,168 | 11,032 | Accepted | Accepted | 37.31 | def f(n,k):
lim = int((n + 0.1) ** 0.5) + 1
ws = []
s = 0
for i in range(1, lim):
w = n // i - n // (i + 1)
ws.append(w)
s += w
ws += [1] * (n - s)
m = len(ws)
dp0 = ws[::-1]
dp1 = [0] * m
for _ in range(k - 1):
s = 0
for j in ran... | from itertools import accumulate
def f(n,k):
lim = int((n + 0.1) ** 0.5) + 1
ws = []
s = 0
for i in range(1, lim):
w = n // i - n // (i + 1)
ws.append(w)
s += w
ws += [1] * (n - s)
dp=ws
m = len(ws)
for _ in range(k - 1):
dp=[s*w%md for s,w ... | 22 | 19 | 497 | 428 | def f(n, k):
lim = int((n + 0.1) ** 0.5) + 1
ws = []
s = 0
for i in range(1, lim):
w = n // i - n // (i + 1)
ws.append(w)
s += w
ws += [1] * (n - s)
m = len(ws)
dp0 = ws[::-1]
dp1 = [0] * m
for _ in range(k - 1):
s = 0
for j in range(m):
... | from itertools import accumulate
def f(n, k):
lim = int((n + 0.1) ** 0.5) + 1
ws = []
s = 0
for i in range(1, lim):
w = n // i - n // (i + 1)
ws.append(w)
s += w
ws += [1] * (n - s)
dp = ws
m = len(ws)
for _ in range(k - 1):
dp = [s * w % md for s, w in ... | false | 13.636364 | [
"+from itertools import accumulate",
"+",
"+",
"+ dp = ws",
"- dp0 = ws[::-1]",
"- dp1 = [0] * m",
"- s = 0",
"- for j in range(m):",
"- s += dp0[j]",
"- dp1[m - j - 1] = (s * ws[j]) % md",
"- dp0 = dp1[:]",
"- print((sum(dp0) % md))",
"... | false | 0.159088 | 0.571981 | 0.278135 | [
"s514809370",
"s569011618"
] |
u580697892 | p02832 | python | s573473789 | s306605136 | 285 | 120 | 77,516 | 26,268 | Accepted | Accepted | 57.89 | # coding: utf-8
N = int(eval(input()))
A = list(map(int, input().split()))
if 1 not in A:
print((-1))
exit()
target = 1
idx = 0
ans = 0
while idx < len(A):
if A[idx] == target:
target += 1
ans += 1
idx += 1
print((N - ans)) | # coding: utf-8
N = int(eval(input()))
A = list(map(int, input().split()))
l = [0]
ans = 0
for i in range(N):
if l[-1] + 1 != A[i]:
ans += 1
else:
l.append(A[i])
if l[-1] == 0:
print((-1))
else:
print(ans) | 16 | 14 | 261 | 242 | # coding: utf-8
N = int(eval(input()))
A = list(map(int, input().split()))
if 1 not in A:
print((-1))
exit()
target = 1
idx = 0
ans = 0
while idx < len(A):
if A[idx] == target:
target += 1
ans += 1
idx += 1
print((N - ans))
| # coding: utf-8
N = int(eval(input()))
A = list(map(int, input().split()))
l = [0]
ans = 0
for i in range(N):
if l[-1] + 1 != A[i]:
ans += 1
else:
l.append(A[i])
if l[-1] == 0:
print((-1))
else:
print(ans)
| false | 12.5 | [
"-if 1 not in A:",
"+l = [0]",
"+ans = 0",
"+for i in range(N):",
"+ if l[-1] + 1 != A[i]:",
"+ ans += 1",
"+ else:",
"+ l.append(A[i])",
"+if l[-1] == 0:",
"- exit()",
"-target = 1",
"-idx = 0",
"-ans = 0",
"-while idx < len(A):",
"- if A[idx] == target:",
"-... | false | 0.045652 | 0.041682 | 1.095258 | [
"s573473789",
"s306605136"
] |
u588341295 | p03805 | python | s968462145 | s826589840 | 134 | 35 | 3,064 | 3,188 | Accepted | Accepted | 73.88 | # -*- coding: utf-8 -*-
# DFSでやる版
N, M = list(map(int, input().split()))
# 入力値の頂点ペア(辺)を格納する配列
a = [0] * M
b = [0] * M
# 頂点ペアが隣接しているかどうかを格納する配列
graph = [[False for i in range(N)] for j in range(N)]
# 入力値の頂点ペア(辺)を格納していくループ
for i in range(M):
a[i], b[i] = list(map(int, input().split()))
# 添字に合... | # -*- coding: utf-8 -*-
import sys
from itertools import permutations
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in ra... | 54 | 41 | 1,259 | 1,116 | # -*- coding: utf-8 -*-
# DFSでやる版
N, M = list(map(int, input().split()))
# 入力値の頂点ペア(辺)を格納する配列
a = [0] * M
b = [0] * M
# 頂点ペアが隣接しているかどうかを格納する配列
graph = [[False for i in range(N)] for j in range(N)]
# 入力値の頂点ペア(辺)を格納していくループ
for i in range(M):
a[i], b[i] = list(map(int, input().split()))
# 添字に合わせて入力値から1減らしておく
a... | # -*- coding: utf-8 -*-
import sys
from itertools import permutations
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] *... | false | 24.074074 | [
"-# DFSでやる版",
"-N, M = list(map(int, input().split()))",
"-# 入力値の頂点ペア(辺)を格納する配列",
"-a = [0] * M",
"-b = [0] * M",
"-# 頂点ペアが隣接しているかどうかを格納する配列",
"-graph = [[False for i in range(N)] for j in range(N)]",
"-# 入力値の頂点ペア(辺)を格納していくループ",
"-for i in range(M):",
"- a[i], b[i] = list(map(int, input().split... | false | 0.088038 | 0.05451 | 1.615093 | [
"s968462145",
"s826589840"
] |
u127499732 | p03999 | python | s361096950 | s964899713 | 17 | 10 | 3,060 | 2,568 | Accepted | Accepted | 41.18 | def main():
s = eval(input())
n = len(s)
ans = 0
for i in range(n + 1):
for j in range(i + 1, n + 1):
x = int(s[i:j])
p = 2 ** max(0, i - 1)
q = 2 ** max(0, n - j - 1)
ans += x * p * q
print(ans)
if __name__ == '__main__':
m... | def main():
s = str(eval(input()))
n = len(s)
ans = 0
for i in range(n + 1):
for j in range(i + 1, n + 1):
x = int(s[i:j])
p = 2 ** max(0, i - 1)
q = 2 ** max(0, n - j - 1)
ans += x * p * q
print(ans)
if __name__ == '__main__':
... | 15 | 15 | 320 | 325 | def main():
s = eval(input())
n = len(s)
ans = 0
for i in range(n + 1):
for j in range(i + 1, n + 1):
x = int(s[i:j])
p = 2 ** max(0, i - 1)
q = 2 ** max(0, n - j - 1)
ans += x * p * q
print(ans)
if __name__ == "__main__":
main()
| def main():
s = str(eval(input()))
n = len(s)
ans = 0
for i in range(n + 1):
for j in range(i + 1, n + 1):
x = int(s[i:j])
p = 2 ** max(0, i - 1)
q = 2 ** max(0, n - j - 1)
ans += x * p * q
print(ans)
if __name__ == "__main__":
main()
| false | 0 | [
"- s = eval(input())",
"+ s = str(eval(input()))"
] | false | 0.062396 | 0.082596 | 0.75543 | [
"s361096950",
"s964899713"
] |
u380524497 | p02703 | python | s001526435 | s839334177 | 1,166 | 1,016 | 35,868 | 35,828 | Accepted | Accepted | 12.86 | import heapq
n, m, s = list(map(int, input().split()))
if s >= 2500:
s = 2499
edges = [[] for _ in range(n)]
for _ in range(m):
from_, to, cost, time = list(map(int, input().split()))
edges[from_-1].append((to-1, cost, time))
edges[to-1].append((from_-1, cost, time))
banks = [(0, 0) for... | import heapq
n, m, s = list(map(int, input().split()))
if s >= 2500:
s = 2499
edges = [[] for _ in range(n)]
for _ in range(m):
from_, to, cost, time = list(map(int, input().split()))
edges[from_-1].append((to-1, cost, time))
edges[to-1].append((from_-1, cost, time))
banks = []
for i i... | 61 | 56 | 1,451 | 1,319 | import heapq
n, m, s = list(map(int, input().split()))
if s >= 2500:
s = 2499
edges = [[] for _ in range(n)]
for _ in range(m):
from_, to, cost, time = list(map(int, input().split()))
edges[from_ - 1].append((to - 1, cost, time))
edges[to - 1].append((from_ - 1, cost, time))
banks = [(0, 0) for _ in ra... | import heapq
n, m, s = list(map(int, input().split()))
if s >= 2500:
s = 2499
edges = [[] for _ in range(n)]
for _ in range(m):
from_, to, cost, time = list(map(int, input().split()))
edges[from_ - 1].append((to - 1, cost, time))
edges[to - 1].append((from_ - 1, cost, time))
banks = []
for i in range(n... | false | 8.196721 | [
"-banks = [(0, 0) for _ in range(n)]",
"+banks = []",
"- banks[i] = (coin, time)",
"+ banks.append((coin, time))",
"-DP = [INF] * (n * 2500)",
"+DP = [[INF] * 2500 for _ in range(n)]",
"-",
"-",
"-def to_one_dimension(node, coin):",
"- return node * 2500 + coin",
"- if time >= DP[to_... | false | 0.14556 | 0.153811 | 0.946358 | [
"s001526435",
"s839334177"
] |
u682672120 | p02888 | python | s931060290 | s569671861 | 657 | 313 | 74,588 | 75,164 | Accepted | Accepted | 52.36 | from bisect import bisect_left, bisect_right
n = int(eval(input()))
stick = list(map(int, input().split()))
stick.sort()
count = 0
for i in range(n):
for j in range(i + 1, n):
l = bisect_left(stick, stick[j] - stick[i] + 1)
r = bisect_right(stick, stick[i] + stick[j] - 1) - 1
if... | from bisect import bisect_left, bisect_right
n = int(eval(input()))
stick = list(map(int, input().split()))
stick.sort()
count = 0
for i in range(n - 1, -1, -1):
for j in range(i - 1, -1, -1):
l = bisect_left(stick, stick[i] - stick[j] + 1)
r = bisect_right(stick, stick[i] + stick[j] - 1... | 19 | 16 | 495 | 420 | from bisect import bisect_left, bisect_right
n = int(eval(input()))
stick = list(map(int, input().split()))
stick.sort()
count = 0
for i in range(n):
for j in range(i + 1, n):
l = bisect_left(stick, stick[j] - stick[i] + 1)
r = bisect_right(stick, stick[i] + stick[j] - 1) - 1
if r < 0 or l ... | from bisect import bisect_left, bisect_right
n = int(eval(input()))
stick = list(map(int, input().split()))
stick.sort()
count = 0
for i in range(n - 1, -1, -1):
for j in range(i - 1, -1, -1):
l = bisect_left(stick, stick[i] - stick[j] + 1)
r = bisect_right(stick, stick[i] + stick[j] - 1) - 1
... | false | 15.789474 | [
"-for i in range(n):",
"- for j in range(i + 1, n):",
"- l = bisect_left(stick, stick[j] - stick[i] + 1)",
"+for i in range(n - 1, -1, -1):",
"+ for j in range(i - 1, -1, -1):",
"+ l = bisect_left(stick, stick[i] - stick[j] + 1)",
"- if r < 0 or l >= n:",
"+ if j <= l... | false | 0.043044 | 0.039166 | 1.099016 | [
"s931060290",
"s569671861"
] |
u941438707 | p02814 | python | s181475434 | s755108754 | 469 | 103 | 14,476 | 14,092 | Accepted | Accepted | 78.04 | def f(n):
a=0
while n%2==0:
n//=2
a+=1
return a
n,m,*a=list(map(int,open(0).read().split()))
c=[f(i) for i in a]
if sum(c)!=c[0]*n:
print((0))
exit()
import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
a=list(set(a))
a=[i//(2**c[0]) for i in a... | n,m,*a=list(map(int,open(0).read().split()))
c=[bin(i)[::-1].index("1") for i in a]
if sum(c)!=c[0]*n:
print((0))
exit()
import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
a=list(set(a))
b=a[0]
for i in a:
b=lcm(i,b)
if b>2*m:
print((0))
exit()
print... | 24 | 16 | 466 | 327 | def f(n):
a = 0
while n % 2 == 0:
n //= 2
a += 1
return a
n, m, *a = list(map(int, open(0).read().split()))
c = [f(i) for i in a]
if sum(c) != c[0] * n:
print((0))
exit()
import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
a = list(set(a))
a = [i // (2 ** ... | n, m, *a = list(map(int, open(0).read().split()))
c = [bin(i)[::-1].index("1") for i in a]
if sum(c) != c[0] * n:
print((0))
exit()
import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
a = list(set(a))
b = a[0]
for i in a:
b = lcm(i, b)
if b > 2 * m:
print((0))
e... | false | 33.333333 | [
"-def f(n):",
"- a = 0",
"- while n % 2 == 0:",
"- n //= 2",
"- a += 1",
"- return a",
"-",
"-",
"-c = [f(i) for i in a]",
"+c = [bin(i)[::-1].index(\"1\") for i in a]",
"-a = [i // (2 ** c[0]) for i in a]",
"- if b * (2 ** c[0]) > 2 * m:",
"+ if b > 2 * m:",
"... | false | 0.040708 | 0.041359 | 0.98426 | [
"s181475434",
"s755108754"
] |
u780354103 | p03807 | python | s699692252 | s045878952 | 64 | 42 | 11,104 | 11,104 | Accepted | Accepted | 34.38 | N = int(eval(input()))
A = list(map(int,input().split()))
O = 0
E = 0
for i in A:
if i % 2 == 1:
O += 1
else:
E += 1
if O % 2 == 0:
print("YES")
else:
print("NO") | N = int(eval(input()))
A = list(map(int,input().split()))
if sum(A) % 2 == 0:
print("YES")
else:
print("NO") | 14 | 7 | 196 | 111 | N = int(eval(input()))
A = list(map(int, input().split()))
O = 0
E = 0
for i in A:
if i % 2 == 1:
O += 1
else:
E += 1
if O % 2 == 0:
print("YES")
else:
print("NO")
| N = int(eval(input()))
A = list(map(int, input().split()))
if sum(A) % 2 == 0:
print("YES")
else:
print("NO")
| false | 50 | [
"-O = 0",
"-E = 0",
"-for i in A:",
"- if i % 2 == 1:",
"- O += 1",
"- else:",
"- E += 1",
"-if O % 2 == 0:",
"+if sum(A) % 2 == 0:"
] | false | 0.060256 | 0.037611 | 1.602095 | [
"s699692252",
"s045878952"
] |
u506705885 | p02389 | python | s143748270 | s971666341 | 30 | 20 | 7,636 | 5,580 | Accepted | Accepted | 33.33 | l=input().split()
w=l[0]
h=l[1]
w=int(w)
h=int(h)
print((w*h,2*w+2*h)) | a,b=list(map(int,input().split()))
print((a*b,(a+b)*2)) | 6 | 2 | 73 | 48 | l = input().split()
w = l[0]
h = l[1]
w = int(w)
h = int(h)
print((w * h, 2 * w + 2 * h))
| a, b = list(map(int, input().split()))
print((a * b, (a + b) * 2))
| false | 66.666667 | [
"-l = input().split()",
"-w = l[0]",
"-h = l[1]",
"-w = int(w)",
"-h = int(h)",
"-print((w * h, 2 * w + 2 * h))",
"+a, b = list(map(int, input().split()))",
"+print((a * b, (a + b) * 2))"
] | false | 0.038034 | 0.039765 | 0.956487 | [
"s143748270",
"s971666341"
] |
u496762077 | p02779 | python | s431903924 | s302300585 | 1,586 | 184 | 25,544 | 26,808 | Accepted | Accepted | 88.4 | def merge(l,r,a):
l1 = len(l)
r1 = len(r)
i,j,k = 0,0,0
while j<l1 and k<r1:
if l[j]<r[k]:
a[i] = l[j]
j+=1
elif l[j] == r[k]:
a[i]=l[j]
j+=1
global res
print("NO")
quit()
return... | n = int(eval(input()))
a = list(map(int,input().split()))
res = True
a.sort()
for i in range(1,n):
if a[i-1]==a[i]:
res = False
break
if res:
print("YES")
else:
print("NO") | 55 | 12 | 1,044 | 205 | def merge(l, r, a):
l1 = len(l)
r1 = len(r)
i, j, k = 0, 0, 0
while j < l1 and k < r1:
if l[j] < r[k]:
a[i] = l[j]
j += 1
elif l[j] == r[k]:
a[i] = l[j]
j += 1
global res
print("NO")
quit()
re... | n = int(eval(input()))
a = list(map(int, input().split()))
res = True
a.sort()
for i in range(1, n):
if a[i - 1] == a[i]:
res = False
break
if res:
print("YES")
else:
print("NO")
| false | 78.181818 | [
"-def merge(l, r, a):",
"- l1 = len(l)",
"- r1 = len(r)",
"- i, j, k = 0, 0, 0",
"- while j < l1 and k < r1:",
"- if l[j] < r[k]:",
"- a[i] = l[j]",
"- j += 1",
"- elif l[j] == r[k]:",
"- a[i] = l[j]",
"- j += 1",
"- ... | false | 0.038872 | 0.113117 | 0.343643 | [
"s431903924",
"s302300585"
] |
u977661421 | p03478 | python | s169069936 | s306318167 | 41 | 33 | 2,940 | 2,940 | Accepted | Accepted | 19.51 | # -*- coding: utf-8 -*-
n,a,b = list(map(int,input().split()))
ans = 0
for i in range(1, n + 1):
tmp = i
tmp2 = list(str(tmp))
sum = 0
for j in range(len(tmp2)):
sum += int(tmp2[j])
if a <= sum <= b:
ans += i
print(ans)
| # -*- coding: utf-8 -*-
n, a, b = list(map(int,input().split()))
ans = 0
for i in range(1, n + 1):
tmp = str(i)
su = 0
for j in tmp:
su += int(j)
#print(i, su)
if a <= su <= b:
ans += i
print(ans)
| 13 | 13 | 263 | 240 | # -*- coding: utf-8 -*-
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
tmp = i
tmp2 = list(str(tmp))
sum = 0
for j in range(len(tmp2)):
sum += int(tmp2[j])
if a <= sum <= b:
ans += i
print(ans)
| # -*- coding: utf-8 -*-
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
tmp = str(i)
su = 0
for j in tmp:
su += int(j)
# print(i, su)
if a <= su <= b:
ans += i
print(ans)
| false | 0 | [
"- tmp = i",
"- tmp2 = list(str(tmp))",
"- sum = 0",
"- for j in range(len(tmp2)):",
"- sum += int(tmp2[j])",
"- if a <= sum <= b:",
"+ tmp = str(i)",
"+ su = 0",
"+ for j in tmp:",
"+ su += int(j)",
"+ # print(i, su)",
"+ if a <= su <= b:"
] | false | 0.110952 | 0.092057 | 1.205244 | [
"s169069936",
"s306318167"
] |
u998435601 | p02384 | python | s227214628 | s739131249 | 40 | 20 | 7,780 | 7,860 | Accepted | Accepted | 50 | # coding: utf-8
# ?????????????????¨????????????
class Dice(object):
def __init__(self):
# ???????????????????????°
# ????????¶???
self.dice = (2, 5), (3, 4), (1, 6) # x, y, z
self.ax = [[0, False], [1, False], [2, False]]
self.axmap = [0, 1, 2]
self.mm = {"N": (0, 2), "S": (2, 0), "E": (1, 2), "W... | # coding: utf-8
# ?????????????????¨????????????
class Dice(object):
def __init__(self):
# ???????????????????????°
# ????????¶???
self.dice = (2, 5), (3, 4), (1, 6) # x, y, z
self.ax = [[0, False], [1, False], [2, False]]
self.axmap = [0, 1, 2]
self.mm = {"N": (0, 2), "S": (2, 0), "E": (1, 2), "W... | 56 | 55 | 1,340 | 1,282 | # coding: utf-8
# ?????????????????¨????????????
class Dice(object):
def __init__(self):
# ???????????????????????°
# ????????¶???
self.dice = (2, 5), (3, 4), (1, 6) # x, y, z
self.ax = [[0, False], [1, False], [2, False]]
self.axmap = [0, 1, 2]
self.mm = {
... | # coding: utf-8
# ?????????????????¨????????????
class Dice(object):
def __init__(self):
# ???????????????????????°
# ????????¶???
self.dice = (2, 5), (3, 4), (1, 6) # x, y, z
self.ax = [[0, False], [1, False], [2, False]]
self.axmap = [0, 1, 2]
self.mm = {
... | false | 1.785714 | [
"+",
"+ def tf(p, f, d):",
"+ for _ in range(4):",
"+ if p == f():",
"+ break",
"+ dice.rotate(d)",
"+",
"- for _ in range(4):",
"- if p == dice.top():",
"- break",
"- dice.rotate(\"N\")",
"- for ... | false | 0.036944 | 0.093932 | 0.393305 | [
"s227214628",
"s739131249"
] |
u396495667 | p03844 | python | s914351137 | s186707527 | 165 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.7 | s = list((input().split()))
if s[1] =='+':
ans = int(s[0]) + int(s[2])
elif s[1] =='-':
ans = int(s[0]) - int(s[2])
print(ans) | s = input().split()
if s[1] =='+':
print((int(s[0])+ int(s[2])))
else:
print((int(s[0])- int(s[2]))) | 8 | 5 | 139 | 104 | s = list((input().split()))
if s[1] == "+":
ans = int(s[0]) + int(s[2])
elif s[1] == "-":
ans = int(s[0]) - int(s[2])
print(ans)
| s = input().split()
if s[1] == "+":
print((int(s[0]) + int(s[2])))
else:
print((int(s[0]) - int(s[2])))
| false | 37.5 | [
"-s = list((input().split()))",
"+s = input().split()",
"- ans = int(s[0]) + int(s[2])",
"-elif s[1] == \"-\":",
"- ans = int(s[0]) - int(s[2])",
"-print(ans)",
"+ print((int(s[0]) + int(s[2])))",
"+else:",
"+ print((int(s[0]) - int(s[2])))"
] | false | 0.041581 | 0.036523 | 1.138472 | [
"s914351137",
"s186707527"
] |
u562935282 | p03476 | python | s573007856 | s050740599 | 858 | 240 | 6,900 | 6,372 | Accepted | Accepted | 72.03 | def prime_table(m):
t = [True] * (m + 1)
i = 2
while i * i <= m:
if t[i]:
j = i + i
while j <= m:
t[j] = False
j += i
i += 1
return t
# t[i] = i が素数ならTrue
Q = int(eval(input()))
pt = prime_table(10 ** 5)
sn = [... | class Sieve:
"""区間[2,n]の値を素因数分解する"""
def __init__(self, n=1):
primes = []
f = [0] * (n + 1)
f[0] = f[1] = -1
for i in range(2, n + 1): # 素数を探す
if f[i]: continue
primes.append(i)
f[i] = i # 素数には自身を代入
for j in range(i * ... | 26 | 63 | 616 | 1,687 | def prime_table(m):
t = [True] * (m + 1)
i = 2
while i * i <= m:
if t[i]:
j = i + i
while j <= m:
t[j] = False
j += i
i += 1
return t
# t[i] = i が素数ならTrue
Q = int(eval(input()))
pt = prime_table(10**5)
sn = [False] * (10**5 + ... | class Sieve:
"""区間[2,n]の値を素因数分解する"""
def __init__(self, n=1):
primes = []
f = [0] * (n + 1)
f[0] = f[1] = -1
for i in range(2, n + 1): # 素数を探す
if f[i]:
continue
primes.append(i)
f[i] = i # 素数には自身を代入
for j in range... | false | 58.730159 | [
"-def prime_table(m):",
"- t = [True] * (m + 1)",
"- i = 2",
"- while i * i <= m:",
"- if t[i]:",
"- j = i + i",
"- while j <= m:",
"- t[j] = False",
"- j += i",
"- i += 1",
"- return t",
"- # t[i] = i が素数ならTrue",... | false | 0.07798 | 0.146948 | 0.530664 | [
"s573007856",
"s050740599"
] |
u222207357 | p03254 | python | s689228856 | s353865890 | 165 | 18 | 13,452 | 3,060 | Accepted | Accepted | 89.09 | import numpy as np
n, x = list(map(int, input().split()))
a = np.array(list(map(int, input().split())))
a = np.sort(a)
cnt = 0
for a_ in a:
cnt += 1
if a_ <= x:
x -= a_
elif a_ > x:
x -= a_
break
print((cnt if x == 0 else cnt - 1)) | n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
a = sorted(a)
cnt = 0
for a_ in a:
cnt += 1
if a_ <= x:
x -= a_
elif a_ > x:
x -= a_
break
print((cnt if x == 0 else cnt - 1)) | 15 | 13 | 275 | 242 | import numpy as np
n, x = list(map(int, input().split()))
a = np.array(list(map(int, input().split())))
a = np.sort(a)
cnt = 0
for a_ in a:
cnt += 1
if a_ <= x:
x -= a_
elif a_ > x:
x -= a_
break
print((cnt if x == 0 else cnt - 1))
| n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
a = sorted(a)
cnt = 0
for a_ in a:
cnt += 1
if a_ <= x:
x -= a_
elif a_ > x:
x -= a_
break
print((cnt if x == 0 else cnt - 1))
| false | 13.333333 | [
"-import numpy as np",
"-",
"-a = np.array(list(map(int, input().split())))",
"-a = np.sort(a)",
"+a = list(map(int, input().split()))",
"+a = sorted(a)"
] | false | 0.275919 | 0.115864 | 2.381409 | [
"s689228856",
"s353865890"
] |
u728498511 | p03220 | python | s716698152 | s036105479 | 20 | 18 | 3,060 | 3,060 | Accepted | Accepted | 10 | n = int(eval(input()))
t, a = list(map(int, input().split()))
h = list([abs(t-a-x*0.006) for x in list(map(int, input().split()))])
print((h.index(min(h))+1)) | eval(input())
t, a = list(map(int, input().split()))
hs = list(map(int, input().split()))
arr = []
for h in hs:
arr.append(abs(t - h * 0.006 - a))
print((arr.index(min(arr))+1)) | 4 | 8 | 145 | 175 | n = int(eval(input()))
t, a = list(map(int, input().split()))
h = list([abs(t - a - x * 0.006) for x in list(map(int, input().split()))])
print((h.index(min(h)) + 1))
| eval(input())
t, a = list(map(int, input().split()))
hs = list(map(int, input().split()))
arr = []
for h in hs:
arr.append(abs(t - h * 0.006 - a))
print((arr.index(min(arr)) + 1))
| false | 50 | [
"-n = int(eval(input()))",
"+eval(input())",
"-h = list([abs(t - a - x * 0.006) for x in list(map(int, input().split()))])",
"-print((h.index(min(h)) + 1))",
"+hs = list(map(int, input().split()))",
"+arr = []",
"+for h in hs:",
"+ arr.append(abs(t - h * 0.006 - a))",
"+print((arr.index(min(arr))... | false | 0.040444 | 0.041367 | 0.977703 | [
"s716698152",
"s036105479"
] |
u585742242 | p03295 | python | s933194583 | s692923740 | 1,893 | 218 | 23,736 | 23,728 | Accepted | Accepted | 88.48 | # -*- coding: utf-8 -*-
import sys
n, m = list(map(int, input().split()))
ary = [tuple(map(int, line.strip().split())) for line in sys.stdin.readlines()]
demands = sorted(ary, key=lambda x: x[1])[::-1]
compressed = []
while demands:
a, b = demands.pop()
for i, (ai, bi) in enumerate(compressed):
... | # -*- coding: utf-8 -*-
import sys
n, m = list(map(int, input().split()))
demands = [
tuple(map(int,
line.strip().split())) for line in sys.stdin.readlines()
]
demands.sort(key=lambda demand: demand[1])
bridge = -1
cnt = 0
for ai, bi in demands:
if ai <= bridge:
continue
... | 23 | 21 | 536 | 382 | # -*- coding: utf-8 -*-
import sys
n, m = list(map(int, input().split()))
ary = [tuple(map(int, line.strip().split())) for line in sys.stdin.readlines()]
demands = sorted(ary, key=lambda x: x[1])[::-1]
compressed = []
while demands:
a, b = demands.pop()
for i, (ai, bi) in enumerate(compressed):
if bi <... | # -*- coding: utf-8 -*-
import sys
n, m = list(map(int, input().split()))
demands = [tuple(map(int, line.strip().split())) for line in sys.stdin.readlines()]
demands.sort(key=lambda demand: demand[1])
bridge = -1
cnt = 0
for ai, bi in demands:
if ai <= bridge:
continue
else:
bridge = bi - 1
... | false | 8.695652 | [
"-ary = [tuple(map(int, line.strip().split())) for line in sys.stdin.readlines()]",
"-demands = sorted(ary, key=lambda x: x[1])[::-1]",
"-compressed = []",
"-while demands:",
"- a, b = demands.pop()",
"- for i, (ai, bi) in enumerate(compressed):",
"- if bi <= a:",
"- continue",... | false | 0.038956 | 0.037652 | 1.034638 | [
"s933194583",
"s692923740"
] |
u794173881 | p02793 | python | s440289311 | s708760945 | 1,027 | 380 | 66,776 | 46,832 | Accepted | Accepted | 63 | def gcd(a: int, b: int) -> int:
"""a, bの最大公約数(greatest common divisor:GCD)を求める
計算量: O(log(min(a, b)))
"""
if b == 0:
return a
return gcd(b, a%b)
def lcm(a, b):
"""a, bの最小公倍数(least common multiple:LCM)を求める
計算量: O(log(min(a, b)))"""
return (a * b) // gcd(a, b)
de... | def multi_lcm(array: list) -> dict:
"""arrayのLCMを素因数分解の積の形として求める(ABC152-E)
入出力例: [4, 18, 21] -> {2: 2, 3: 2, 7: 1}
key, val = 素因数, 素因数の個数
"""
pf = {} # pf: prime_factor
for num in array:
for k in range(2, int(num**0.5) + 1):
cnt = 0
while num % k == 0:
... | 43 | 39 | 906 | 929 | def gcd(a: int, b: int) -> int:
"""a, bの最大公約数(greatest common divisor:GCD)を求める
計算量: O(log(min(a, b)))
"""
if b == 0:
return a
return gcd(b, a % b)
def lcm(a, b):
"""a, bの最小公倍数(least common multiple:LCM)を求める
計算量: O(log(min(a, b)))"""
return (a * b) // gcd(a, b)
def multi_gcd(a... | def multi_lcm(array: list) -> dict:
"""arrayのLCMを素因数分解の積の形として求める(ABC152-E)
入出力例: [4, 18, 21] -> {2: 2, 3: 2, 7: 1}
key, val = 素因数, 素因数の個数
"""
pf = {} # pf: prime_factor
for num in array:
for k in range(2, int(num**0.5) + 1):
cnt = 0
while num % k == 0:
... | false | 9.302326 | [
"-def gcd(a: int, b: int) -> int:",
"- \"\"\"a, bの最大公約数(greatest common divisor:GCD)を求める",
"- 計算量: O(log(min(a, b)))",
"+def multi_lcm(array: list) -> dict:",
"+ \"\"\"arrayのLCMを素因数分解の積の形として求める(ABC152-E)",
"+ 入出力例: [4, 18, 21] -> {2: 2, 3: 2, 7: 1}",
"+ key, val = 素因数, 素因数の個数",
"- if... | false | 0.059714 | 0.035837 | 1.666272 | [
"s440289311",
"s708760945"
] |
u392319141 | p03240 | python | s142080923 | s898711353 | 34 | 29 | 3,316 | 3,192 | Accepted | Accepted | 14.71 | import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
def sol():
N = int(eval(input()))
points = [tuple(map(int, input().split())) for _ in range(N)]
... | N = int(eval(input()))
XYH = [tuple(map(int, input().split())) for _ in range(N)]
bx, by, bh = [xyh for xyh in XYH if xyh[2] > 0][0]
def solve(cx, cy):
H = abs(cx - bx) + abs(cy - by) + bh
for x, y, h in XYH:
D = max(0, H - abs(cx - x) - abs(cy - y))
if D != h:
return 0
... | 26 | 21 | 748 | 482 | import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
def sol():
N = int(eval(input()))
points = [tuple(map(int, input().split())) for _ in range(N)]
points.so... | N = int(eval(input()))
XYH = [tuple(map(int, input().split())) for _ in range(N)]
bx, by, bh = [xyh for xyh in XYH if xyh[2] > 0][0]
def solve(cx, cy):
H = abs(cx - bx) + abs(cy - by) + bh
for x, y, h in XYH:
D = max(0, H - abs(cx - x) - abs(cy - y))
if D != h:
return 0
return ... | false | 19.230769 | [
"-import sys",
"-import heapq",
"-from operator import itemgetter",
"-from collections import deque, defaultdict",
"-from bisect import bisect_left, bisect_right",
"-",
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**7)",
"+N = int(eval(input()))",
"+XYH = [tuple(map(int, input().split(... | false | 0.037348 | 0.120964 | 0.308748 | [
"s142080923",
"s898711353"
] |
u047796752 | p02843 | python | s077479430 | s384598938 | 186 | 73 | 41,452 | 74,040 | Accepted | Accepted | 60.75 | import sys
input = sys.stdin.readline
from collections import *
X = int(eval(input()))
dp = [False]*(X+1)
dp[0] = True
for i in range(X+1):
for j in range(100, 106):
if i-j>=0:
dp[i] |= dp[i-j]
if dp[X]:
print((1))
else:
print((0)) | X = int(eval(input()))
dp = [False]*(X+1)
dp[0] = True
for i in range(X+1):
for j in range(100, 106):
if i+j<=X:
dp[i+j] |= dp[i]
if dp[X]:
print((1))
else:
print((0)) | 17 | 13 | 272 | 203 | import sys
input = sys.stdin.readline
from collections import *
X = int(eval(input()))
dp = [False] * (X + 1)
dp[0] = True
for i in range(X + 1):
for j in range(100, 106):
if i - j >= 0:
dp[i] |= dp[i - j]
if dp[X]:
print((1))
else:
print((0))
| X = int(eval(input()))
dp = [False] * (X + 1)
dp[0] = True
for i in range(X + 1):
for j in range(100, 106):
if i + j <= X:
dp[i + j] |= dp[i]
if dp[X]:
print((1))
else:
print((0))
| false | 23.529412 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-from collections import *",
"-",
"- if i - j >= 0:",
"- dp[i] |= dp[i - j]",
"+ if i + j <= X:",
"+ dp[i + j] |= dp[i]"
] | false | 0.034731 | 0.030631 | 1.133846 | [
"s077479430",
"s384598938"
] |
u037430802 | p02733 | python | s632693700 | s579872758 | 1,025 | 538 | 53,724 | 47,452 | Accepted | Accepted | 47.51 |
from bisect import bisect_left
H,W,K = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
"""
H <= 10までなので、横直線方向の割り方を全探索できそう
縦直線方向の割り方は貪欲か。
横直線の割方が決まったら、次は縦に割っていくが、ブロックの横幅を1にしても、ブロックないのホワイトチョコがKを超える場合もありうるので、その場合は、その横直線の割り方で条件を満たすことはできない
H=1や W=1の場合は普通に貪欲で。
"""
def is_over_K(ls... |
H,W,K = list(map(int, input().split()))
S = [[int(i) for i in list(eval(input()))] for _ in range(H)]
accum_col = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
for j in range(W):
if i == 0:
accum_col[i][j] = S[i][j]
else:
accum_col[i][j] = acc... | 103 | 58 | 2,738 | 1,577 | from bisect import bisect_left
H, W, K = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
"""
H <= 10までなので、横直線方向の割り方を全探索できそう
縦直線方向の割り方は貪欲か。
横直線の割方が決まったら、次は縦に割っていくが、ブロックの横幅を1にしても、ブロックないのホワイトチョコがKを超える場合もありうるので、その場合は、その横直線の割り方で条件を満たすことはできない
H=1や W=1の場合は普通に貪欲で。
"""
def is_over_K(lst, block_num):
... | H, W, K = list(map(int, input().split()))
S = [[int(i) for i in list(eval(input()))] for _ in range(H)]
accum_col = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
for j in range(W):
if i == 0:
accum_col[i][j] = S[i][j]
else:
accum_col[i][j] = accum_col[i - 1][j]... | false | 43.68932 | [
"-from bisect import bisect_left",
"-",
"-S = [eval(input()) for _ in range(H)]",
"-\"\"\"",
"-H <= 10までなので、横直線方向の割り方を全探索できそう",
"-縦直線方向の割り方は貪欲か。",
"-横直線の割方が決まったら、次は縦に割っていくが、ブロックの横幅を1にしても、ブロックないのホワイトチョコがKを超える場合もありうるので、その場合は、その横直線の割り方で条件を満たすことはできない",
"-H=1や W=1の場合は普通に貪欲で。",
"-\"\"\"",
"+S = [[int(i)... | false | 0.039239 | 0.044326 | 0.885234 | [
"s632693700",
"s579872758"
] |
u453055089 | p03160 | python | s092641928 | s018838760 | 235 | 99 | 52,208 | 84,960 | Accepted | Accepted | 57.87 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0]*n
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2, n):
dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i]-h[i-2]))
print((dp[n-1]))
| n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0]*(n+1)
dp[0] = 0
for i in range(1, n):
if i == 1:
dp[i] = dp[i-1] + abs(h[i]-h[i-1])
else:
dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]),
dp[i-2] + abs(h[i]-h[i-2]))
print((dp[n-1])) | 12 | 11 | 223 | 288 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[n - 1]))
| n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * (n + 1)
dp[0] = 0
for i in range(1, n):
if i == 1:
dp[i] = dp[i - 1] + abs(h[i] - h[i - 1])
else:
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[n - 1]))
| false | 8.333333 | [
"-dp = [0] * n",
"+dp = [0] * (n + 1)",
"-dp[1] = abs(h[1] - h[0])",
"-for i in range(2, n):",
"- dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))",
"+for i in range(1, n):",
"+ if i == 1:",
"+ dp[i] = dp[i - 1] + abs(h[i] - h[i - 1])",
"+ else:",
"+ ... | false | 0.036249 | 0.035926 | 1.008992 | [
"s092641928",
"s018838760"
] |
u312025627 | p03486 | python | s349323361 | s634085025 | 182 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.66 | s = eval(input())
t = eval(input())
if "".join(sorted(s)) < "".join(sorted(t,reverse=True)):
print("Yes")
else:
print("No") | def main():
S = [s for s in eval(input())]
T = [t for t in eval(input())]
S.sort()
T.sort(reverse=True)
if S < T:
print("Yes")
else:
print("No")
if __name__ == '__main__':
main()
| 6 | 13 | 124 | 225 | s = eval(input())
t = eval(input())
if "".join(sorted(s)) < "".join(sorted(t, reverse=True)):
print("Yes")
else:
print("No")
| def main():
S = [s for s in eval(input())]
T = [t for t in eval(input())]
S.sort()
T.sort(reverse=True)
if S < T:
print("Yes")
else:
print("No")
if __name__ == "__main__":
main()
| false | 53.846154 | [
"-s = eval(input())",
"-t = eval(input())",
"-if \"\".join(sorted(s)) < \"\".join(sorted(t, reverse=True)):",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+def main():",
"+ S = [s for s in eval(input())]",
"+ T = [t for t in eval(input())]",
"+ S.sort()",
"+ T.sort(reverse... | false | 0.035671 | 0.041165 | 0.866544 | [
"s349323361",
"s634085025"
] |
u068425421 | p02554 | python | s941803238 | s193366448 | 581 | 398 | 11,196 | 11,032 | Accepted | Accepted | 31.5 | # -*- coding: utf-8 -*-
from sys import stdin
input = stdin.readline
MOD = 10**9+7
def main():
n = int(input().strip())
ans = 10**n - 9**n - 9**n + 8**n
print((ans%MOD))
if __name__ == "__main__":
main()
| # -*- coding: utf-8 -*-
from sys import stdin
input = stdin.readline
MOD = 10**9+7
def main():
n = int(input().strip())
buf = 9**n
ans = 10**n - buf - buf + 8**n
print((ans%MOD))
if __name__ == "__main__":
main()
| 12 | 13 | 231 | 245 | # -*- coding: utf-8 -*-
from sys import stdin
input = stdin.readline
MOD = 10**9 + 7
def main():
n = int(input().strip())
ans = 10**n - 9**n - 9**n + 8**n
print((ans % MOD))
if __name__ == "__main__":
main()
| # -*- coding: utf-8 -*-
from sys import stdin
input = stdin.readline
MOD = 10**9 + 7
def main():
n = int(input().strip())
buf = 9**n
ans = 10**n - buf - buf + 8**n
print((ans % MOD))
if __name__ == "__main__":
main()
| false | 7.692308 | [
"- ans = 10**n - 9**n - 9**n + 8**n",
"+ buf = 9**n",
"+ ans = 10**n - buf - buf + 8**n"
] | false | 0.191967 | 0.007824 | 24.534193 | [
"s941803238",
"s193366448"
] |
u559103167 | p03264 | python | s881992677 | s436882616 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | k = int(eval(input()))
print(((k+1)//2*((k+1)//2-1) if k%2 else (k//2)**2)) | k = int(eval(input()))
print((k**2//4)) | 2 | 2 | 68 | 32 | k = int(eval(input()))
print(((k + 1) // 2 * ((k + 1) // 2 - 1) if k % 2 else (k // 2) ** 2))
| k = int(eval(input()))
print((k**2 // 4))
| false | 0 | [
"-print(((k + 1) // 2 * ((k + 1) // 2 - 1) if k % 2 else (k // 2) ** 2))",
"+print((k**2 // 4))"
] | false | 0.092388 | 0.039583 | 2.334045 | [
"s881992677",
"s436882616"
] |
u247211039 | p03556 | python | s468562008 | s241976422 | 21 | 17 | 2,940 | 2,940 | Accepted | Accepted | 19.05 | N = int(eval(input()))
i = 1
while i*i <= N:
i += 1
print(((i-1)*(i-1))) | import math
N = int(eval(input()))
a = math.sqrt(N)
a = int(a)
print((a*a)) | 5 | 7 | 72 | 77 | N = int(eval(input()))
i = 1
while i * i <= N:
i += 1
print(((i - 1) * (i - 1)))
| import math
N = int(eval(input()))
a = math.sqrt(N)
a = int(a)
print((a * a))
| false | 28.571429 | [
"+import math",
"+",
"-i = 1",
"-while i * i <= N:",
"- i += 1",
"-print(((i - 1) * (i - 1)))",
"+a = math.sqrt(N)",
"+a = int(a)",
"+print((a * a))"
] | false | 0.047154 | 0.043573 | 1.082176 | [
"s468562008",
"s241976422"
] |
u894258749 | p02861 | python | s190882472 | s814436234 | 304 | 17 | 44,508 | 3,064 | Accepted | Accepted | 94.41 | from itertools import permutations
from math import sqrt
import sys
sys.setrecursionlimit(10**9)
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))
N = int(eval(input()))
xy = [inpl() for _ in range(N)]
S = sum(sum(sqrt(sum((xy[p[i+1]][k]-xy[p[i]][k])**2 for k in range(2... | from math import sqrt
inpl = lambda: list(map(int,input().split()))
N = int(eval(input()))
xy = [inpl() for _ in range(N)]
def distance(i,j): return sqrt(sum((xy[i][k]-xy[j][k])**2 for k in range(2)))
S = sum(distance(i,j) for i in range(N-1) for j in range(i,N))
print((2*S/N)) | 13 | 7 | 428 | 276 | from itertools import permutations
from math import sqrt
import sys
sys.setrecursionlimit(10**9)
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int, input().split()))
N = int(eval(input()))
xy = [inpl() for _ in range(N)]
S = sum(
sum(
sqrt(sum((xy[p[i + 1]][k] - xy[p[i]][k]) ** 2 fo... | from math import sqrt
inpl = lambda: list(map(int, input().split()))
N = int(eval(input()))
xy = [inpl() for _ in range(N)]
def distance(i, j):
return sqrt(sum((xy[i][k] - xy[j][k]) ** 2 for k in range(2)))
S = sum(distance(i, j) for i in range(N - 1) for j in range(i, N))
print((2 * S / N))
| false | 46.153846 | [
"-from itertools import permutations",
"-import sys",
"-sys.setrecursionlimit(10**9)",
"-input = lambda: sys.stdin.readline().rstrip()",
"-S = sum(",
"- sum(",
"- sqrt(sum((xy[p[i + 1]][k] - xy[p[i]][k]) ** 2 for k in range(2)))",
"- for i in range(N - 1)",
"- )",
"- for p i... | false | 0.117592 | 0.040332 | 2.915622 | [
"s190882472",
"s814436234"
] |
u037430802 | p03295 | python | s156940290 | s808399102 | 547 | 467 | 21,680 | 17,400 | Accepted | Accepted | 14.63 | n,m = list(map(int, input().split()))
ans = 0
ba = [[0 for _ in range(2)] for _ in range(m)]
for i in range(m):
a,b = list(map(int, input().split()))
ba[i][0] = b
ba[i][1] = a
ba.sort()
br = 0
for b,a in ba:
#if bridge[(a-1):] != 0:
if not (a < br < b):
#bridge[b-2] = 0
... | N,M = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for _ in range(M)]
ab.sort()
ans = 1
l, r = ab[0][0], ab[0][1]
for a,b in ab[1:]:
if a < r:
l = max(l,a)
r = min(r,b)
else:
ans += 1
l = a
r = b
print(ans) | 21 | 16 | 361 | 292 | n, m = list(map(int, input().split()))
ans = 0
ba = [[0 for _ in range(2)] for _ in range(m)]
for i in range(m):
a, b = list(map(int, input().split()))
ba[i][0] = b
ba[i][1] = a
ba.sort()
br = 0
for b, a in ba:
# if bridge[(a-1):] != 0:
if not (a < br < b):
# bridge[b-2] = 0
br = b -... | N, M = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for _ in range(M)]
ab.sort()
ans = 1
l, r = ab[0][0], ab[0][1]
for a, b in ab[1:]:
if a < r:
l = max(l, a)
r = min(r, b)
else:
ans += 1
l = a
r = b
print(ans)
| false | 23.809524 | [
"-n, m = list(map(int, input().split()))",
"-ans = 0",
"-ba = [[0 for _ in range(2)] for _ in range(m)]",
"-for i in range(m):",
"- a, b = list(map(int, input().split()))",
"- ba[i][0] = b",
"- ba[i][1] = a",
"-ba.sort()",
"-br = 0",
"-for b, a in ba:",
"- # if bridge[(a-1):] != 0:",... | false | 0.047179 | 0.047325 | 0.996915 | [
"s156940290",
"s808399102"
] |
u562016607 | p02873 | python | s073372036 | s769541951 | 426 | 146 | 31,900 | 111,524 | Accepted | Accepted | 65.73 | S=eval(input())
N=len(S)+1
L=[0 for i in range(N)]
R=[0 for i in range(N)]
for i in range(1,N):
if S[i-1]==">":
L[i]=0
else:
L[i]=L[i-1]+1
for i in range(N-2,-1,-1):
if S[i]=="<":
R[i]=0
else:
R[i]=R[i+1]+1
#print(L)
#print(R)
X=[max(L[i],R[i]) for i in ra... | from collections import deque
S=eval(input())
N=len(S)+1
X=[-1 for i in range(N)]
'''
< > >
0 2 1 0
'''
q=deque([])
for i in range(N-2):
if S[i]==">" and S[i+1]=="<":
X[i+1]=0
q.append(i+1)
if S[0]=="<":
q.append(0)
X[0]=0
if S[N-2]==">":
q.append(N-1)
X[N-1]=0
... | 18 | 31 | 336 | 590 | S = eval(input())
N = len(S) + 1
L = [0 for i in range(N)]
R = [0 for i in range(N)]
for i in range(1, N):
if S[i - 1] == ">":
L[i] = 0
else:
L[i] = L[i - 1] + 1
for i in range(N - 2, -1, -1):
if S[i] == "<":
R[i] = 0
else:
R[i] = R[i + 1] + 1
# print(L)
# print(R)
X = [m... | from collections import deque
S = eval(input())
N = len(S) + 1
X = [-1 for i in range(N)]
"""
< > >
0 2 1 0
"""
q = deque([])
for i in range(N - 2):
if S[i] == ">" and S[i + 1] == "<":
X[i + 1] = 0
q.append(i + 1)
if S[0] == "<":
q.append(0)
X[0] = 0
if S[N - 2] == ">":
q.append(N - 1)... | false | 41.935484 | [
"+from collections import deque",
"+",
"-L = [0 for i in range(N)]",
"-R = [0 for i in range(N)]",
"-for i in range(1, N):",
"- if S[i - 1] == \">\":",
"- L[i] = 0",
"- else:",
"- L[i] = L[i - 1] + 1",
"-for i in range(N - 2, -1, -1):",
"- if S[i] == \"<\":",
"- R... | false | 0.052779 | 0.036253 | 1.455879 | [
"s073372036",
"s769541951"
] |
u426764965 | p03503 | python | s817794059 | s285032935 | 1,382 | 1,275 | 17,868 | 14,436 | Accepted | Accepted | 7.74 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
def abc080_c_np():
N = int(readline()) # 他店の数
# 他店の営業パターン:店→日付→営業01
F = np.zeros((N, 10), dtype=np.int8)
for i in range(N): F[i] = readline().split()
# ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
def abc080_c_np():
N = int(readline()) # 他店の数
# 他店の営業パターン:店→日付→営業01
F = np.zeros((N, 10), dtype=np.int8)
for i in range(N): F[i] = readline().split()
# ... | 30 | 30 | 924 | 927 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
def abc080_c_np():
N = int(readline()) # 他店の数
# 他店の営業パターン:店→日付→営業01
F = np.zeros((N, 10), dtype=np.int8)
for i in range(N):
F[i] = readline().split()
# 他... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
def abc080_c_np():
N = int(readline()) # 他店の数
# 他店の営業パターン:店→日付→営業01
F = np.zeros((N, 10), dtype=np.int8)
for i in range(N):
F[i] = readline().split()
# 他... | false | 0 | [
"- overlap = np.multiply(F[i, :], mask_np).sum()",
"+ overlap = np.logical_and(F[i, :], mask_np).sum()"
] | false | 0.223716 | 0.252841 | 0.884808 | [
"s817794059",
"s285032935"
] |
u839537730 | p03607 | python | s585329476 | s804575446 | 244 | 224 | 21,368 | 21,344 | Accepted | Accepted | 8.2 | from collections import Counter
N = int(eval(input()))
A = []
for _ in range(N):
A.append(int(eval(input())))
ans = 0
counter = Counter(A)
for _, cnt in counter.most_common():
if cnt % 2 == 1:
ans += 1
print(ans) | from collections import Counter
def main():
N = int(eval(input()))
A = []
for _ in range(N):
A.append(int(eval(input())))
ans = 0
counter = Counter(A)
for _, cnt in counter.most_common():
if cnt % 2 == 1:
ans += 1
print(ans)
main() | 15 | 18 | 242 | 301 | from collections import Counter
N = int(eval(input()))
A = []
for _ in range(N):
A.append(int(eval(input())))
ans = 0
counter = Counter(A)
for _, cnt in counter.most_common():
if cnt % 2 == 1:
ans += 1
print(ans)
| from collections import Counter
def main():
N = int(eval(input()))
A = []
for _ in range(N):
A.append(int(eval(input())))
ans = 0
counter = Counter(A)
for _, cnt in counter.most_common():
if cnt % 2 == 1:
ans += 1
print(ans)
main()
| false | 16.666667 | [
"-N = int(eval(input()))",
"-A = []",
"-for _ in range(N):",
"- A.append(int(eval(input())))",
"-ans = 0",
"-counter = Counter(A)",
"-for _, cnt in counter.most_common():",
"- if cnt % 2 == 1:",
"- ans += 1",
"-print(ans)",
"+",
"+def main():",
"+ N = int(eval(input()))",
"... | false | 0.033296 | 0.032619 | 1.020756 | [
"s585329476",
"s804575446"
] |
u238940874 | p03076 | python | s897887589 | s473929056 | 22 | 17 | 8,964 | 3,064 | Accepted | Accepted | 22.73 | a=int(eval(input()))
b=int(eval(input()))
c=int(eval(input()))
d=int(eval(input()))
e=int(eval(input()))
def time(x):
return (x+9)//10*10
def last(x):
return time(x)-x
sum_time=time(a)+time(b)+time(c)+time(d)+time(e)
ans=sum_time-max(last(a),last(b),last(c),last(d),last(e))
print(ans) | a=int(eval(input()))
b=int(eval(input()))
c=int(eval(input()))
d=int(eval(input()))
e=int(eval(input()))
def time(x):
return (x+9)//10*10
def last(x):
return time(x)-x
sum_tim=time(a)+time(b)+time(c)+time(d)+time(e)
ans=sum_tim-max(last(a),last(b),last(c),last(d),last(e))
print(ans) | 12 | 12 | 274 | 272 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
e = int(eval(input()))
def time(x):
return (x + 9) // 10 * 10
def last(x):
return time(x) - x
sum_time = time(a) + time(b) + time(c) + time(d) + time(e)
ans = sum_time - max(last(a), last(b), last(c), last(d), last... | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
e = int(eval(input()))
def time(x):
return (x + 9) // 10 * 10
def last(x):
return time(x) - x
sum_tim = time(a) + time(b) + time(c) + time(d) + time(e)
ans = sum_tim - max(last(a), last(b), last(c), last(d), last(e... | false | 0 | [
"-sum_time = time(a) + time(b) + time(c) + time(d) + time(e)",
"-ans = sum_time - max(last(a), last(b), last(c), last(d), last(e))",
"+sum_tim = time(a) + time(b) + time(c) + time(d) + time(e)",
"+ans = sum_tim - max(last(a), last(b), last(c), last(d), last(e))"
] | false | 0.036803 | 0.035733 | 1.029954 | [
"s897887589",
"s473929056"
] |
u001024152 | p03128 | python | s134454472 | s664601025 | 278 | 195 | 136,924 | 42,220 | Accepted | Accepted | 29.86 | # 解説放送の1つめ
N,M = list(map(int, input().split()))
A = list(map(int, input().split()))
f = [-1, 2,5,5,4,5,6,3,7,6] # 1-indexed
# dp[i]: マッチi本数で作れる最大の数(str)
dp = [None]*(N+1)
dp[0] = ""
# strの数の大きいほう
def max_str(s1:str, s2:str)->str:
"""return bigger one"""
l1, l2 = len(s1), len(s2)
if l1 != l2:... | # dpに最大桁数を持たせる
N,M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
f = [-1, 2,5,5,4,5,6,3,7,6] # 1-indexed
# dp[i]: マッチi本数で作れる最大の桁数(int)
dp = [-float('inf')]*(N+1)
dp[0] = 0
for i in range(N+1):
nxt = dp[i]
for aj in A:
if i-f[aj]<0: continue
... | 29 | 31 | 697 | 689 | # 解説放送の1つめ
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
f = [-1, 2, 5, 5, 4, 5, 6, 3, 7, 6] # 1-indexed
# dp[i]: マッチi本数で作れる最大の数(str)
dp = [None] * (N + 1)
dp[0] = ""
# strの数の大きいほう
def max_str(s1: str, s2: str) -> str:
"""return bigger one"""
l1, l2 = len(s1), len(s2)
if l1 != ... | # dpに最大桁数を持たせる
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
f = [-1, 2, 5, 5, 4, 5, 6, 3, 7, 6] # 1-indexed
# dp[i]: マッチi本数で作れる最大の桁数(int)
dp = [-float("inf")] * (N + 1)
dp[0] = 0
for i in range(N + 1):
nxt = dp[i]
for aj in A:
if i - f[aj] < 0:
... | false | 6.451613 | [
"-# 解説放送の1つめ",
"+# dpに最大桁数を持たせる",
"+A.sort(reverse=True)",
"-# dp[i]: マッチi本数で作れる最大の数(str)",
"-dp = [None] * (N + 1)",
"-dp[0] = \"\"",
"-# strの数の大きいほう",
"-def max_str(s1: str, s2: str) -> str:",
"- \"\"\"return bigger one\"\"\"",
"- l1, l2 = len(s1), len(s2)",
"- if l1 != l2:",
"- ... | false | 0.114508 | 0.045836 | 2.498214 | [
"s134454472",
"s664601025"
] |
u201928947 | p02564 | python | s712412516 | s842693263 | 1,079 | 912 | 214,256 | 213,716 | Accepted | Accepted | 15.48 | from collections import deque
class csr:
__slots__ = ['start','elist']
def __init__(self,N,edges):
self.start = [0]*(N+1)
self.elist = [0]*len(edges)
for e in edges:
self.start[e[0]+1] += 1
for i in range(1,N+1):
self.start[i] += self.start[i-1]
... | from collections import deque
class csr:
def __init__(self,N,edges):
self.start = [0]*(N+1)
self.elist = [0]*len(edges)
for e in edges:
self.start[e[0]+1] += 1
for i in range(1,N+1):
self.start[i] += self.start[i-1]
counter = self.start[:]
... | 89 | 88 | 2,865 | 2,794 | from collections import deque
class csr:
__slots__ = ["start", "elist"]
def __init__(self, N, edges):
self.start = [0] * (N + 1)
self.elist = [0] * len(edges)
for e in edges:
self.start[e[0] + 1] += 1
for i in range(1, N + 1):
self.start[i] += self.star... | from collections import deque
class csr:
def __init__(self, N, edges):
self.start = [0] * (N + 1)
self.elist = [0] * len(edges)
for e in edges:
self.start[e[0] + 1] += 1
for i in range(1, N + 1):
self.start[i] += self.start[i - 1]
counter = self.star... | false | 1.123596 | [
"- __slots__ = [\"start\", \"elist\"]",
"-",
"- __slots__ = [\"N\", \"edges\"]",
"-",
"+ N = self.N",
"- low = [0] * self.N",
"- order = [-1] * self.N",
"- ids = [0] * self.N",
"- parent = [-1] * self.N",
"+ low = [0] * N",
"+ order = [-1] *... | false | 0.135046 | 0.075279 | 1.793953 | [
"s712412516",
"s842693263"
] |
u021548497 | p03372 | python | s022888720 | s633170786 | 565 | 383 | 47,040 | 47,028 | Accepted | Accepted | 32.21 | from copy import deepcopy as copy
n, c = list(map(int, input().split()))
sushi = [[0, 0]]+[[int(x) for x in input().split()] for _ in range(n)]
order = [0]*(n+1)
reverse = [0]*(n+1)
for i in range(n):
order[i+1] = order[i]+sushi[i+1][1]
reverse[i+1] = reverse[i]+sushi[n-i][1]
order_index = [i for i ... | import sys
from copy import deepcopy as copy
input = sys.stdin.readline
def main():
n, c = list(map(int, input().split()))
sushi = [[0, 0]]+[[int(x) for x in input().split()] for _ in range(n)]
order = [0]*(n+1)
reverse = [0]*(n+1)
for i in range(n):
order[i+1] = order[i]+sushi[i+1][1]
... | 41 | 47 | 1,170 | 1,329 | from copy import deepcopy as copy
n, c = list(map(int, input().split()))
sushi = [[0, 0]] + [[int(x) for x in input().split()] for _ in range(n)]
order = [0] * (n + 1)
reverse = [0] * (n + 1)
for i in range(n):
order[i + 1] = order[i] + sushi[i + 1][1]
reverse[i + 1] = reverse[i] + sushi[n - i][1]
order_index ... | import sys
from copy import deepcopy as copy
input = sys.stdin.readline
def main():
n, c = list(map(int, input().split()))
sushi = [[0, 0]] + [[int(x) for x in input().split()] for _ in range(n)]
order = [0] * (n + 1)
reverse = [0] * (n + 1)
for i in range(n):
order[i + 1] = order[i] + su... | false | 12.765957 | [
"+import sys",
"-n, c = list(map(int, input().split()))",
"-sushi = [[0, 0]] + [[int(x) for x in input().split()] for _ in range(n)]",
"-order = [0] * (n + 1)",
"-reverse = [0] * (n + 1)",
"-for i in range(n):",
"- order[i + 1] = order[i] + sushi[i + 1][1]",
"- reverse[i + 1] = reverse[i] + sush... | false | 0.049224 | 0.041356 | 1.190257 | [
"s022888720",
"s633170786"
] |
u416011173 | p02570 | python | s425527884 | s826360926 | 30 | 27 | 9,160 | 9,048 | Accepted | Accepted | 10 | # -*- coding: utf-8 -*-
# 標準入力を取得
D, T, S = list(map(int, input().split()))
# 求解処理
ans = str()
if D <= S * T:
ans = "Yes"
else:
ans = "No"
# 結果出力
print(ans)
| # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
D, T, S = list(map(int, input().split()))
return D, T, S
def main(D: int, T: int, S: int) -> None:
"""
メイン処理.
Args:\n
D (int): 待ち合わせ場所(1 <= D <= 10000)... | 13 | 40 | 179 | 650 | # -*- coding: utf-8 -*-
# 標準入力を取得
D, T, S = list(map(int, input().split()))
# 求解処理
ans = str()
if D <= S * T:
ans = "Yes"
else:
ans = "No"
# 結果出力
print(ans)
| # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
D, T, S = list(map(int, input().split()))
return D, T, S
def main(D: int, T: int, S: int) -> None:
"""
メイン処理.
Args:\n
D (int): 待ち合わせ場所(1 <= D <= 10000)
T (int): 待ち合わせ... | false | 67.5 | [
"-# 標準入力を取得",
"-D, T, S = list(map(int, input().split()))",
"-# 求解処理",
"-ans = str()",
"-if D <= S * T:",
"- ans = \"Yes\"",
"-else:",
"- ans = \"No\"",
"-# 結果出力",
"-print(ans)",
"+def get_input() -> tuple:",
"+ \"\"\"",
"+ 標準入力を取得する.",
"+ Returns:\\n",
"+ tuple: 標準... | false | 0.037519 | 0.03562 | 1.05332 | [
"s425527884",
"s826360926"
] |
u936985471 | p02684 | python | s826107316 | s173759795 | 1,978 | 1,755 | 31,364 | 32,324 | Accepted | Accepted | 11.27 | import sys
readline = sys.stdin.readline
N,K = list(map(int,readline().split()))
A = [0] + list(map(int,readline().split()))
c = 1
while K:
if K & 1:
c = A[c]
A = [A[A[i]] for i in range(len(A))]
K >>= 1
print(c) | N,K=list(map(int,input().split()))
A=[0]+list(map(int,input().split()))
c=1
while K:
if K&1:
c=A[c]
A=[A[A[i]] for i in range(len(A))]
K>>=1
print(c) | 11 | 9 | 226 | 161 | import sys
readline = sys.stdin.readline
N, K = list(map(int, readline().split()))
A = [0] + list(map(int, readline().split()))
c = 1
while K:
if K & 1:
c = A[c]
A = [A[A[i]] for i in range(len(A))]
K >>= 1
print(c)
| N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
c = 1
while K:
if K & 1:
c = A[c]
A = [A[A[i]] for i in range(len(A))]
K >>= 1
print(c)
| false | 18.181818 | [
"-import sys",
"-",
"-readline = sys.stdin.readline",
"-N, K = list(map(int, readline().split()))",
"-A = [0] + list(map(int, readline().split()))",
"+N, K = list(map(int, input().split()))",
"+A = [0] + list(map(int, input().split()))"
] | false | 0.046298 | 0.067919 | 0.681667 | [
"s826107316",
"s173759795"
] |
u791170614 | p02394 | python | s242112045 | s081168635 | 40 | 20 | 7,688 | 7,676 | Accepted | Accepted | 50 | N = list(map(int, input().split(' ')))
W = N[0]
H = N[1]
x = N[2]
y = N[3]
r = N[4]
if r <= x < W and (x + r) <= W and r <= y < W and (y + r) <= H:
print('Yes')
else:
print('No') | W, H, x, y, r = list(map(int, input().split()))
def YesOrNo(W, H , x, y, r):
Xr = x + r
Xl = x - r
Yu = y + r
Yd = y - r
if (W >= Xr and H >= Yu and 0 <= Xl and 0 <= Yd):
return "Yes"
else:
return "No"
print((YesOrNo(W, H, x, y, r))) | 12 | 13 | 193 | 249 | N = list(map(int, input().split(" ")))
W = N[0]
H = N[1]
x = N[2]
y = N[3]
r = N[4]
if r <= x < W and (x + r) <= W and r <= y < W and (y + r) <= H:
print("Yes")
else:
print("No")
| W, H, x, y, r = list(map(int, input().split()))
def YesOrNo(W, H, x, y, r):
Xr = x + r
Xl = x - r
Yu = y + r
Yd = y - r
if W >= Xr and H >= Yu and 0 <= Xl and 0 <= Yd:
return "Yes"
else:
return "No"
print((YesOrNo(W, H, x, y, r)))
| false | 7.692308 | [
"-N = list(map(int, input().split(\" \")))",
"-W = N[0]",
"-H = N[1]",
"-x = N[2]",
"-y = N[3]",
"-r = N[4]",
"-if r <= x < W and (x + r) <= W and r <= y < W and (y + r) <= H:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+W, H, x, y, r = list(map(int, input().split()))",
"+",
"+... | false | 0.187791 | 0.103061 | 1.822139 | [
"s242112045",
"s081168635"
] |
u923172145 | p02695 | python | s408648845 | s288078620 | 737 | 120 | 9,252 | 74,012 | Accepted | Accepted | 83.72 | def next_array(array):#辞書式に次の配列を与える関数
s = -1
for x in array[::-1]:
if x < M:
break
else:
s -= 1
#Mより小さい最後の項を取得
if s >= -N:
array[s] += 1#その項を1増やす
if s < -1:
for i in range(s+1,0):#以降の項を全て同じ値に
array[i] = array[s]
return array
def score(array, r... | N, M ,Q = list(map(int,input().split()))
Rq = [list(map(int,input().split())) for _ in range(Q)]
ary = [1 for _ in range(N)]
ans = 0
while True:
#print(ary)
pt = 0
for j in range(Q):
rq = Rq[j]
if ary[rq[1]-1]-ary[rq[0]-1] == rq[2]:
pt += rq[3]
ans = max(ans,pt)
if ary[0] == ... | 43 | 28 | 815 | 520 | def next_array(array): # 辞書式に次の配列を与える関数
s = -1
for x in array[::-1]:
if x < M:
break
else:
s -= 1
# Mより小さい最後の項を取得
if s >= -N:
array[s] += 1 # その項を1増やす
if s < -1:
for i in range(s + 1, 0): # 以降の項を全て同じ値に
array[i] = ... | N, M, Q = list(map(int, input().split()))
Rq = [list(map(int, input().split())) for _ in range(Q)]
ary = [1 for _ in range(N)]
ans = 0
while True:
# print(ary)
pt = 0
for j in range(Q):
rq = Rq[j]
if ary[rq[1] - 1] - ary[rq[0] - 1] == rq[2]:
pt += rq[3]
ans = max(ans, pt)
... | false | 34.883721 | [
"-def next_array(array): # 辞書式に次の配列を与える関数",
"- s = -1",
"- for x in array[::-1]:",
"- if x < M:",
"+N, M, Q = list(map(int, input().split()))",
"+Rq = [list(map(int, input().split())) for _ in range(Q)]",
"+ary = [1 for _ in range(N)]",
"+ans = 0",
"+while True:",
"+ # print(ary)"... | false | 0.085355 | 0.05741 | 1.486774 | [
"s408648845",
"s288078620"
] |
u941753895 | p03221 | python | s532545424 | s042458548 | 977 | 857 | 50,108 | 42,692 | Accepted | Accepted | 12.28 | class struct:
def __init__(self,i,a,b,c):
self.i=i
self.a=a
self.b=b
self.c=c
n,m=list(map(int,input().split()))
l=[]
l2=[]#市番
for i in range(n):
l2.append(1)
for i in range(m):
a,b=list(map(int,input().split()))
l.append(struct(i,a,b,0))
l=sorted(l,key=lambda x:(x.a,x.b))
for i i... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())
def main():
n,m=... | 22 | 39 | 452 | 690 | class struct:
def __init__(self, i, a, b, c):
self.i = i
self.a = a
self.b = b
self.c = c
n, m = list(map(int, input().split()))
l = []
l2 = [] # 市番
for i in range(n):
l2.append(1)
for i in range(m):
a, b = list(map(int, input().split()))
l.append(struct(i, a, b, 0))
l... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI():
return list(map(int, input().split()))
def I():
return int(eval(input()))
def LS():
return input().split()
def S():
return eval... | false | 43.589744 | [
"-class struct:",
"- def __init__(self, i, a, b, c):",
"- self.i = i",
"- self.a = a",
"- self.b = b",
"- self.c = c",
"+import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time",
"+",
"+sys.setrecursionlimit(10**7)",
"+inf ... | false | 0.042477 | 0.044501 | 0.954528 | [
"s532545424",
"s042458548"
] |
u981931040 | p03486 | python | s074302776 | s429370162 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | s = list(eval(input()))
s.sort()
s = "".join(s)
t = list(eval(input()))
t.sort(reverse=True)
t = "".join(t)
print(("Yes" if s < t else "No")) | s = eval(input())
s = ''.join(sorted(s))
t = eval(input())
t = ''.join(sorted(t, reverse=True))
if s < t:
print('Yes')
else:
print('No')
| 7 | 9 | 133 | 142 | s = list(eval(input()))
s.sort()
s = "".join(s)
t = list(eval(input()))
t.sort(reverse=True)
t = "".join(t)
print(("Yes" if s < t else "No"))
| s = eval(input())
s = "".join(sorted(s))
t = eval(input())
t = "".join(sorted(t, reverse=True))
if s < t:
print("Yes")
else:
print("No")
| false | 22.222222 | [
"-s = list(eval(input()))",
"-s.sort()",
"-s = \"\".join(s)",
"-t = list(eval(input()))",
"-t.sort(reverse=True)",
"-t = \"\".join(t)",
"-print((\"Yes\" if s < t else \"No\"))",
"+s = eval(input())",
"+s = \"\".join(sorted(s))",
"+t = eval(input())",
"+t = \"\".join(sorted(t, reverse=True))",
... | false | 0.042026 | 0.049023 | 0.857255 | [
"s074302776",
"s429370162"
] |
u530873555 | p02606 | python | s650343077 | s507350835 | 30 | 27 | 9,160 | 9,016 | Accepted | Accepted | 10 | L,R,d=list(map(int, input().split()))
cnt=0
for i in range(L, R+1):
if i%d == 0: cnt+=1
print(cnt) | L,R,d=list(map(int, input().split()))
print((R//d-(L-1)//d)) | 7 | 2 | 105 | 53 | L, R, d = list(map(int, input().split()))
cnt = 0
for i in range(L, R + 1):
if i % d == 0:
cnt += 1
print(cnt)
| L, R, d = list(map(int, input().split()))
print((R // d - (L - 1) // d))
| false | 71.428571 | [
"-cnt = 0",
"-for i in range(L, R + 1):",
"- if i % d == 0:",
"- cnt += 1",
"-print(cnt)",
"+print((R // d - (L - 1) // d))"
] | false | 0.037025 | 0.038071 | 0.972527 | [
"s650343077",
"s507350835"
] |
u011621222 | p00481 | python | s491157274 | s265811393 | 17,950 | 12,180 | 36,512 | 42,352 | Accepted | Accepted | 32.14 | h,w,n = list(map(int, input().split()))
stage = [eval(input()) for i in range(h)]
starts = [str(i) for i in range(n)]
goals = [str(i+1) for i in range(n)]
starts_y = [0 for i in range(n)]
starts_x = [0 for i in range(n)]
goals_y = [0 for i in range(n)]
goals_x = [0 for i in range(n)]
starts[0] = "S"
for y in... | from collections import deque
H, W, N = list(map(int, input().split()))
field = [list(eval(input())) for i in range(H)]
node_posi = [0 for i in range(N+1)]
nodes = 'S123456789'
for i in range(H):
for j in range(W):
if field[i][j] in nodes:
node_posi[nodes.index(field[i][j])] = [j, i]
cost = 0
for ... | 52 | 38 | 1,627 | 946 | h, w, n = list(map(int, input().split()))
stage = [eval(input()) for i in range(h)]
starts = [str(i) for i in range(n)]
goals = [str(i + 1) for i in range(n)]
starts_y = [0 for i in range(n)]
starts_x = [0 for i in range(n)]
goals_y = [0 for i in range(n)]
goals_x = [0 for i in range(n)]
starts[0] = "S"
for y in range(... | from collections import deque
H, W, N = list(map(int, input().split()))
field = [list(eval(input())) for i in range(H)]
node_posi = [0 for i in range(N + 1)]
nodes = "S123456789"
for i in range(H):
for j in range(W):
if field[i][j] in nodes:
node_posi[nodes.index(field[i][j])] = [j, i]
cost = 0... | false | 26.923077 | [
"-h, w, n = list(map(int, input().split()))",
"-stage = [eval(input()) for i in range(h)]",
"-starts = [str(i) for i in range(n)]",
"-goals = [str(i + 1) for i in range(n)]",
"-starts_y = [0 for i in range(n)]",
"-starts_x = [0 for i in range(n)]",
"-goals_y = [0 for i in range(n)]",
"-goals_x = [0 fo... | false | 0.032347 | 0.04196 | 0.77089 | [
"s491157274",
"s265811393"
] |
u266014018 | p03038 | python | s559270306 | s007461305 | 402 | 326 | 27,920 | 38,896 | Accepted | Accepted | 18.91 | def main():
import sys
def input(): return sys.stdin.readline().rstrip()
n, m = list(map(int, input().split()))
from heapq import heappop, heappush, heapreplace
a = list(map(int, input().split()))
from collections import Counter as cc
a = cc(a)
q = []
for key in a:
... | def main():
import sys
def input(): return sys.stdin.readline().rstrip()
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
from collections import Counter as cc
a = cc(a)
q = [(key, a[key]) for key in a]
for i in range(m):
b, c = list(map... | 38 | 29 | 905 | 638 | def main():
import sys
def input():
return sys.stdin.readline().rstrip()
n, m = list(map(int, input().split()))
from heapq import heappop, heappush, heapreplace
a = list(map(int, input().split()))
from collections import Counter as cc
a = cc(a)
q = []
for key in a:
... | def main():
import sys
def input():
return sys.stdin.readline().rstrip()
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
from collections import Counter as cc
a = cc(a)
q = [(key, a[key]) for key in a]
for i in range(m):
b, c = list(map(int, ... | false | 23.684211 | [
"- from heapq import heappop, heappush, heapreplace",
"-",
"- q = []",
"- for key in a:",
"- heappush(q, (key, a[key]))",
"+ q = [(key, a[key]) for key in a]",
"- now = b",
"- while q:",
"- num, cnt = q[0]",
"- if c <= num:",
"- ... | false | 0.04869 | 0.043858 | 1.11017 | [
"s559270306",
"s007461305"
] |
u585482323 | p02881 | python | s881517964 | s920461491 | 249 | 208 | 40,048 | 39,792 | Accepted | Accepted | 16.47 | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline()... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline()... | 43 | 56 | 992 | 1,249 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(x) for x in sys.stdin... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(x) for x in sys.stdin... | false | 23.214286 | [
"+ def f(n):",
"+ if n < 4:",
"+ return [1, n]",
"+ res = [1]",
"+ i = 2",
"+ while i * i <= n:",
"+ if n % i == 0:",
"+ res.append(i)",
"+ m = n // i",
"+ if m != i:",
"+ res.app... | false | 0.093944 | 0.038447 | 2.443449 | [
"s881517964",
"s920461491"
] |
u470735879 | p02572 | python | s053683481 | s364241152 | 209 | 122 | 31,156 | 31,356 | Accepted | Accepted | 41.63 | mod = 10 ** 9 + 7
n = int(eval(input()))
a = list(map(int, input().split()))
dp = [0]
def calc(A, n, dp):
dp += [A[0] * A[1]]
rsum = A[0] + A[1]
for i in range(2, n):
dp += [dp[-1] + rsum * A[i]]
rsum += A[i]
i = dp.index(max(dp))
rsum = 0
for j in range(i + 1):
... | mod = 10 ** 9 + 7
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
sum_arr = sum(a)
for i in a:
sum_arr -= i
ans += i * sum_arr
print((ans % mod))
| 27 | 9 | 539 | 173 | mod = 10**9 + 7
n = int(eval(input()))
a = list(map(int, input().split()))
dp = [0]
def calc(A, n, dp):
dp += [A[0] * A[1]]
rsum = A[0] + A[1]
for i in range(2, n):
dp += [dp[-1] + rsum * A[i]]
rsum += A[i]
i = dp.index(max(dp))
rsum = 0
for j in range(i + 1):
rsum += A... | mod = 10**9 + 7
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
sum_arr = sum(a)
for i in a:
sum_arr -= i
ans += i * sum_arr
print((ans % mod))
| false | 66.666667 | [
"-dp = [0]",
"-",
"-",
"-def calc(A, n, dp):",
"- dp += [A[0] * A[1]]",
"- rsum = A[0] + A[1]",
"- for i in range(2, n):",
"- dp += [dp[-1] + rsum * A[i]]",
"- rsum += A[i]",
"- i = dp.index(max(dp))",
"- rsum = 0",
"- for j in range(i + 1):",
"- rsum +... | false | 0.037096 | 0.033794 | 1.097696 | [
"s053683481",
"s364241152"
] |
u417365712 | p03032 | python | s659975381 | s339761392 | 546 | 366 | 3,316 | 3,316 | Accepted | Accepted | 32.97 | from collections import deque
inputs = open(0).readlines()
n, k = list(map(int, inputs[0].split()))
V = deque(list(map(int, inputs[1].split())))
def calc(ii, jj, kk):
W = []
for i in range(ii):
W.append(V[i])
for j in range(jj):
W.append(V[-j-1])
W.sort(reverse=True)
for... | n, k, *V = list(map(int, open(0).read().split()))
def calc(i, j, k):
W = sorted(V[:i] + V[:-j-1:-1], reverse=True)
for _ in range(k):
if W[-1] < 0:
W.pop()
return sum(W)
ans = 0
r = min(n, k)+1
for i in range(r):
for j in range(r-i):
for k_ in range(min(i+j, k+1-... | 23 | 15 | 565 | 376 | from collections import deque
inputs = open(0).readlines()
n, k = list(map(int, inputs[0].split()))
V = deque(list(map(int, inputs[1].split())))
def calc(ii, jj, kk):
W = []
for i in range(ii):
W.append(V[i])
for j in range(jj):
W.append(V[-j - 1])
W.sort(reverse=True)
for _ in ra... | n, k, *V = list(map(int, open(0).read().split()))
def calc(i, j, k):
W = sorted(V[:i] + V[: -j - 1 : -1], reverse=True)
for _ in range(k):
if W[-1] < 0:
W.pop()
return sum(W)
ans = 0
r = min(n, k) + 1
for i in range(r):
for j in range(r - i):
for k_ in range(min(i + j, k ... | false | 34.782609 | [
"-from collections import deque",
"-",
"-inputs = open(0).readlines()",
"-n, k = list(map(int, inputs[0].split()))",
"-V = deque(list(map(int, inputs[1].split())))",
"+n, k, *V = list(map(int, open(0).read().split()))",
"-def calc(ii, jj, kk):",
"- W = []",
"- for i in range(ii):",
"- ... | false | 0.039646 | 0.042941 | 0.923279 | [
"s659975381",
"s339761392"
] |
u273010357 | p03720 | python | s969575702 | s285916824 | 19 | 17 | 3,060 | 3,064 | Accepted | Accepted | 10.53 | n, m = map(int, input().split())
ans = [0]*(n+1)
for _ in range(m):
a,b = map(int, input().split())
ans[a] += 1
ans[b] += 1
#print(ans)
#print(ans[1:])
#unpack
print(*ans[1:], sep='\n')
| N, M = list(map(int, input().split()))
a, b = [0]*M, [0]*M
for i in range(M):
tmp_a, tmp_b = list(map(int, input().split()))
a[i], b[i] = tmp_a, tmp_b
ab = list(zip(a,b))
# 添え字:都市,値:本数
num = [0]*(N+1)
for a_i, b_i in ab:
num[a_i] += 1
num[b_i] += 1
for i in range(len(num)):
if i==0... | 11 | 19 | 208 | 355 | n, m = map(int, input().split())
ans = [0] * (n + 1)
for _ in range(m):
a, b = map(int, input().split())
ans[a] += 1
ans[b] += 1
# print(ans)
# print(ans[1:])
# unpack
print(*ans[1:], sep="\n")
| N, M = list(map(int, input().split()))
a, b = [0] * M, [0] * M
for i in range(M):
tmp_a, tmp_b = list(map(int, input().split()))
a[i], b[i] = tmp_a, tmp_b
ab = list(zip(a, b))
# 添え字:都市,値:本数
num = [0] * (N + 1)
for a_i, b_i in ab:
num[a_i] += 1
num[b_i] += 1
for i in range(len(num)):
if i == 0:
... | false | 42.105263 | [
"-n, m = map(int, input().split())",
"-ans = [0] * (n + 1)",
"-for _ in range(m):",
"- a, b = map(int, input().split())",
"- ans[a] += 1",
"- ans[b] += 1",
"-# print(ans)",
"-# print(ans[1:])",
"-# unpack",
"-print(*ans[1:], sep=\"\\n\")",
"+N, M = list(map(int, input().split()))",
"+... | false | 0.069865 | 0.069808 | 1.000815 | [
"s969575702",
"s285916824"
] |
u250583425 | p02850 | python | s634792608 | s815272009 | 408 | 363 | 43,852 | 49,616 | Accepted | Accepted | 11.03 | import sys
from collections import deque
def input(): return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
ab = [tuple(map(int, input().split())) for _ in range(N-1)]
graph = [set() for _ in range(N+1)]
for a, b in ab:
graph[a].add(b)
graph[b].add(a)
... | # https://atcoder.jp/contests/abc102/tasks/arc100_a
import sys
from collections import deque
def input(): return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
ab = [tuple(map(int, input().split())) for _ in range(N-1)]
graph = [set() for _ in range(N+1)]
for a, b in ab:
... | 41 | 41 | 838 | 899 | import sys
from collections import deque
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
ab = [tuple(map(int, input().split())) for _ in range(N - 1)]
graph = [set() for _ in range(N + 1)]
for a, b in ab:
graph[a].add(b)
graph[b].add(a)
d ... | # https://atcoder.jp/contests/abc102/tasks/arc100_a
import sys
from collections import deque
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
ab = [tuple(map(int, input().split())) for _ in range(N - 1)]
graph = [set() for _ in range(N + 1)]
for a, b in ab:
... | false | 0 | [
"+# https://atcoder.jp/contests/abc102/tasks/arc100_a",
"- for _, b in ab:",
"- print((ans[b]))",
"+ print((\"\\n\".join([str(ans[b]) for _, b in ab])))"
] | false | 0.047183 | 0.046523 | 1.014194 | [
"s634792608",
"s815272009"
] |
u075012704 | p02960 | python | s533597236 | s358154472 | 904 | 728 | 63,836 | 64,036 | Accepted | Accepted | 19.47 | S = eval(input())
N = len(S)
MOD = 10 ** 9 + 7
# dp[i][j] := i文字目までみた時に13で割ってj余るような数の通り数
dp = [[0] * 13 for i in range(N + 1)]
dp[0][0] = 1
for i, s in enumerate(S):
for j in range(13):
if s != '?':
dp[i + 1][((j * 10) % 13 + int(s)) % 13] += dp[i][j]
dp[i + 1][((j * 10... | S = eval(input())
N = len(S)
MOD = 10 ** 9 + 7
# dp[i][j] := i文字目までみた時に13で割ってj余るような数の通り数
dp = [[0] * 13 for i in range(N + 1)]
dp[0][0] = 1
for i, s in enumerate(S):
for j in range(13):
if s != '?':
dp[i + 1][((j * 10) + int(s)) % 13] += dp[i][j]
dp[i + 1][((j * 10) + i... | 19 | 19 | 543 | 523 | S = eval(input())
N = len(S)
MOD = 10**9 + 7
# dp[i][j] := i文字目までみた時に13で割ってj余るような数の通り数
dp = [[0] * 13 for i in range(N + 1)]
dp[0][0] = 1
for i, s in enumerate(S):
for j in range(13):
if s != "?":
dp[i + 1][((j * 10) % 13 + int(s)) % 13] += dp[i][j]
dp[i + 1][((j * 10) % 13 + int(s))... | S = eval(input())
N = len(S)
MOD = 10**9 + 7
# dp[i][j] := i文字目までみた時に13で割ってj余るような数の通り数
dp = [[0] * 13 for i in range(N + 1)]
dp[0][0] = 1
for i, s in enumerate(S):
for j in range(13):
if s != "?":
dp[i + 1][((j * 10) + int(s)) % 13] += dp[i][j]
dp[i + 1][((j * 10) + int(s)) % 13] %= ... | false | 0 | [
"- dp[i + 1][((j * 10) % 13 + int(s)) % 13] += dp[i][j]",
"- dp[i + 1][((j * 10) % 13 + int(s)) % 13] %= MOD",
"+ dp[i + 1][((j * 10) + int(s)) % 13] += dp[i][j]",
"+ dp[i + 1][((j * 10) + int(s)) % 13] %= MOD",
"- dp[i + 1][((j * 10) % 13 + k) % 13... | false | 0.059642 | 0.058161 | 1.025457 | [
"s533597236",
"s358154472"
] |
u759938562 | p02802 | python | s353200325 | s848244158 | 280 | 255 | 4,596 | 21,980 | Accepted | Accepted | 8.93 | N, M = list(map(int, input().split()))
# AC = 0
# WA = 0
# PS = {}
# for i in range(M):
# # print(PS)
# p, S = input().split()
# tmp = PS.get(p)
# # if tmp != None:
# # print("\t" + tmp)
# if tmp != "AC":
# if S == "AC":
# AC += 1
# elif S == "WA"... | N, M = list(map(int, input().split()))
AC = 0
WA = 0
PS = {}
for _ in range(M):
p, S = input().split()
tmp = PS.get(p)
# print(PS)
if tmp == None:
if S == "AC":
PS[p] = S
AC += 1
else:
PS[p] = 1
elif tmp != "AC":
if S == "A... | 45 | 23 | 743 | 438 | N, M = list(map(int, input().split()))
# AC = 0
# WA = 0
# PS = {}
# for i in range(M):
# # print(PS)
# p, S = input().split()
# tmp = PS.get(p)
# # if tmp != None:
# # print("\t" + tmp)
# if tmp != "AC":
# if S == "AC":
# AC += 1
# elif S == "WA":
# W... | N, M = list(map(int, input().split()))
AC = 0
WA = 0
PS = {}
for _ in range(M):
p, S = input().split()
tmp = PS.get(p)
# print(PS)
if tmp == None:
if S == "AC":
PS[p] = S
AC += 1
else:
PS[p] = 1
elif tmp != "AC":
if S == "AC":
P... | false | 48.888889 | [
"-# AC = 0",
"-# WA = 0",
"-# PS = {}",
"-# for i in range(M):",
"-# # print(PS)",
"-# p, S = input().split()",
"-# tmp = PS.get(p)",
"-# # if tmp != None:",
"-# # print(\"\\t\" + tmp)",
"-# if tmp != \"AC\":",
"-# if S == \"AC\":",
"-# AC += 1",... | false | 0.098082 | 0.038342 | 2.5581 | [
"s353200325",
"s848244158"
] |
u091051505 | p02642 | python | s069695469 | s281758045 | 676 | 413 | 36,612 | 32,268 | Accepted | Accepted | 38.91 | n = int(eval(input()))
a = [int(i) for i in input().split()]
table = [True for _ in range(2 * (10 ** 6))]
a.sort()
ans = 0
for i in range(n):
if table[a[i]]:
for j in range(a[i], 2 * (10 ** 6), a[i]):
table[j] = False
if i + 1 < n:
if a[i + 1] != a[i]:
... | T = 10 ** 6 + 20
n = int(eval(input()))
a = [int(i) for i in input().split()]
table = [True for _ in range(T)]
a.sort()
ans = 0
for i in range(n):
if table[a[i]]:
for j in range(a[i], T, a[i]):
table[j] = False
if i + 1 < n:
if a[i + 1] != a[i]:
an... | 15 | 16 | 386 | 381 | n = int(eval(input()))
a = [int(i) for i in input().split()]
table = [True for _ in range(2 * (10**6))]
a.sort()
ans = 0
for i in range(n):
if table[a[i]]:
for j in range(a[i], 2 * (10**6), a[i]):
table[j] = False
if i + 1 < n:
if a[i + 1] != a[i]:
ans += 1
... | T = 10**6 + 20
n = int(eval(input()))
a = [int(i) for i in input().split()]
table = [True for _ in range(T)]
a.sort()
ans = 0
for i in range(n):
if table[a[i]]:
for j in range(a[i], T, a[i]):
table[j] = False
if i + 1 < n:
if a[i + 1] != a[i]:
ans += 1
... | false | 6.25 | [
"+T = 10**6 + 20",
"-table = [True for _ in range(2 * (10**6))]",
"+table = [True for _ in range(T)]",
"- for j in range(a[i], 2 * (10**6), a[i]):",
"+ for j in range(a[i], T, a[i]):"
] | false | 0.3881 | 0.291181 | 1.332848 | [
"s069695469",
"s281758045"
] |
u141610915 | p02749 | python | s039814659 | s457788650 | 925 | 365 | 183,132 | 170,692 | Accepted | Accepted | 60.54 | import sys
from collections import defaultdict as dd
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
N = int(eval(input()))
e = dd(list)
for _ in range(N - 1):
u, v = list(map(int, input().split()))
e[u].append(v)
e[v].append(u)
cl = [0] * (N + 1)
vis = set()
def dfs(x):
global cl
gl... | import sys
input = sys.stdin.readline
N = int(eval(input()))
e = [[] for _ in range(N + 1)]
for _ in range(N - 1):
u, v = list(map(int, input().split()))
e[u].append(v)
e[v].append(u)
a = [1]
b = []
s = [1]
vis = [0] * (N + 1)
table = [-1] * (N + 1)
table[1] = 1
vis[1] = 1
while len(s):
x = s.... | 65 | 58 | 1,357 | 1,126 | import sys
from collections import defaultdict as dd
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N = int(eval(input()))
e = dd(list)
for _ in range(N - 1):
u, v = list(map(int, input().split()))
e[u].append(v)
e[v].append(u)
cl = [0] * (N + 1)
vis = set()
def dfs(x):
global cl
global ... | import sys
input = sys.stdin.readline
N = int(eval(input()))
e = [[] for _ in range(N + 1)]
for _ in range(N - 1):
u, v = list(map(int, input().split()))
e[u].append(v)
e[v].append(u)
a = [1]
b = []
s = [1]
vis = [0] * (N + 1)
table = [-1] * (N + 1)
table[1] = 1
vis[1] = 1
while len(s):
x = s.pop()
... | false | 10.769231 | [
"-from collections import defaultdict as dd",
"-sys.setrecursionlimit(10**6)",
"-e = dd(list)",
"+e = [[] for _ in range(N + 1)]",
"-cl = [0] * (N + 1)",
"-vis = set()",
"-",
"-",
"-def dfs(x):",
"- global cl",
"- global vis",
"- vis.add(x)",
"+a = [1]",
"+b = []",
"+s = [1]",
... | false | 0.056924 | 0.078116 | 0.728714 | [
"s039814659",
"s457788650"
] |
u597374218 | p02790 | python | s675138625 | s901652016 | 28 | 24 | 8,840 | 9,156 | Accepted | Accepted | 14.29 | a, b = input().split()
print((a*int(b) if a < b else b*int(a))) | a, b = input().split()
print((min(a*int(b), b*int(a)))) | 2 | 2 | 62 | 54 | a, b = input().split()
print((a * int(b) if a < b else b * int(a)))
| a, b = input().split()
print((min(a * int(b), b * int(a))))
| false | 0 | [
"-print((a * int(b) if a < b else b * int(a)))",
"+print((min(a * int(b), b * int(a))))"
] | false | 0.039824 | 0.042994 | 0.926272 | [
"s675138625",
"s901652016"
] |
u948524308 | p03164 | python | s292268207 | s997101451 | 381 | 264 | 120,028 | 41,068 | Accepted | Accepted | 30.71 | N,W=list(map(int,input().split()))
w=[]
v=[]
for i in range(N):
x,y=list(map(int,input().split()))
w.append(x)
v.append(y)
S=sum(v)
DP=[[1000000000000]*(S+1) for i in range(N+1)]
for i in range(N+1):
DP[i][0]=0
for i in range(N):
for v1 in range(S+1):
DP[i+1][v1]=min... | N,W=list(map(int,input().split()))
w=[]
v=[]
for i in range(N):
x,y=list(map(int,input().split()))
w.append(x)
v.append(y)
S=sum(v)
DP=[1000000000000]*(S+1)
DP[0]=0
for i in range(N):
for v1 in range(S,v[i]-1,-1):
DP[v1]=min(DP[v1-v[i]]+w[i],DP[v1])
for i in range(S,0,-1... | 25 | 23 | 421 | 362 | N, W = list(map(int, input().split()))
w = []
v = []
for i in range(N):
x, y = list(map(int, input().split()))
w.append(x)
v.append(y)
S = sum(v)
DP = [[1000000000000] * (S + 1) for i in range(N + 1)]
for i in range(N + 1):
DP[i][0] = 0
for i in range(N):
for v1 in range(S + 1):
DP[i + 1][v1... | N, W = list(map(int, input().split()))
w = []
v = []
for i in range(N):
x, y = list(map(int, input().split()))
w.append(x)
v.append(y)
S = sum(v)
DP = [1000000000000] * (S + 1)
DP[0] = 0
for i in range(N):
for v1 in range(S, v[i] - 1, -1):
DP[v1] = min(DP[v1 - v[i]] + w[i], DP[v1])
for i in rang... | false | 8 | [
"-DP = [[1000000000000] * (S + 1) for i in range(N + 1)]",
"-for i in range(N + 1):",
"- DP[i][0] = 0",
"+DP = [1000000000000] * (S + 1)",
"+DP[0] = 0",
"- for v1 in range(S + 1):",
"- DP[i + 1][v1] = min(DP[i][v1 - v[i]] + w[i], DP[i][v1])",
"+ for v1 in range(S, v[i] - 1, -1):",
"+... | false | 0.032824 | 0.090413 | 0.363047 | [
"s292268207",
"s997101451"
] |
u941753895 | p03049 | python | s515678526 | s078505070 | 99 | 83 | 7,976 | 6,316 | Accepted | Accepted | 16.16 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
de... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
de... | 51 | 54 | 959 | 979 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) ... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) ... | false | 5.555556 | [
"- if _b > 0 and _a > 0:",
"- ans += min(_b, _a)",
"+ # if _ba>0:",
"+ # _b+=1",
"+ # _a+=1",
"+ ans += min(_b, _a)"
] | false | 0.036592 | 0.037533 | 0.974932 | [
"s515678526",
"s078505070"
] |
u080364835 | p03408 | python | s006184789 | s009754446 | 31 | 24 | 9,176 | 9,080 | Accepted | Accepted | 22.58 | n = int(eval(input()))
sl = list(eval(input()) for _ in range(n))
m = int(eval(input()))
tl = list(eval(input()) for _ in range(m))
sl_s = list(set(sl))
tl_s = list(set(tl))
ans = 0
for s in sl_s:
ans = max(ans, sl.count(s) - tl.count(s))
print(ans) | n = int(eval(input()))
sl = list(eval(input()) for _ in range(n))
m = int(eval(input()))
tl = list(eval(input()) for _ in range(m))
cnt = 0
for s in sl:
cnt = max(cnt, sl.count(s) - tl.count(s))
print(cnt)
| 13 | 11 | 244 | 199 | n = int(eval(input()))
sl = list(eval(input()) for _ in range(n))
m = int(eval(input()))
tl = list(eval(input()) for _ in range(m))
sl_s = list(set(sl))
tl_s = list(set(tl))
ans = 0
for s in sl_s:
ans = max(ans, sl.count(s) - tl.count(s))
print(ans)
| n = int(eval(input()))
sl = list(eval(input()) for _ in range(n))
m = int(eval(input()))
tl = list(eval(input()) for _ in range(m))
cnt = 0
for s in sl:
cnt = max(cnt, sl.count(s) - tl.count(s))
print(cnt)
| false | 15.384615 | [
"-sl_s = list(set(sl))",
"-tl_s = list(set(tl))",
"-ans = 0",
"-for s in sl_s:",
"- ans = max(ans, sl.count(s) - tl.count(s))",
"-print(ans)",
"+cnt = 0",
"+for s in sl:",
"+ cnt = max(cnt, sl.count(s) - tl.count(s))",
"+print(cnt)"
] | false | 0.110097 | 0.046092 | 2.388642 | [
"s006184789",
"s009754446"
] |
u948524308 | p03599 | python | s865326259 | s589538131 | 2,385 | 1,203 | 3,064 | 3,064 | Accepted | Accepted | 49.56 | A,B,C,D,E,F =list(map(int,input().split()))
amax = F//(100*A)
bmax = F//(100*B)
concmx =0
wholemx =0
sugarmx =0
for a in range(amax,-1,-1):
for b in range(bmax,-1,-1):
cmax = (F-100*A*a-100*B*b)//C
dmax = (F-100*A*a-100*B*b)//D
for c in range(cmax,-1,-1):
for d i... | A,B,C,D,E,F =list(map(int,input().split()))
amax = F//(100*A)
bmax = F//(100*B)
concmx =0
wholemx =0
sugarmx =0
for a in range(amax,-1,-1):
bmax = (F-100*A*a)//B
for b in range(bmax,-1,-1):
cmax = (F-100*A*a-100*B*b)//C
for c in range(cmax,-1,-1):
dmax = (F... | 28 | 30 | 809 | 854 | A, B, C, D, E, F = list(map(int, input().split()))
amax = F // (100 * A)
bmax = F // (100 * B)
concmx = 0
wholemx = 0
sugarmx = 0
for a in range(amax, -1, -1):
for b in range(bmax, -1, -1):
cmax = (F - 100 * A * a - 100 * B * b) // C
dmax = (F - 100 * A * a - 100 * B * b) // D
for c in range... | A, B, C, D, E, F = list(map(int, input().split()))
amax = F // (100 * A)
bmax = F // (100 * B)
concmx = 0
wholemx = 0
sugarmx = 0
for a in range(amax, -1, -1):
bmax = (F - 100 * A * a) // B
for b in range(bmax, -1, -1):
cmax = (F - 100 * A * a - 100 * B * b) // C
for c in range(cmax, -1, -1):
... | false | 6.666667 | [
"+ bmax = (F - 100 * A * a) // B",
"- dmax = (F - 100 * A * a - 100 * B * b) // D",
"+ dmax = (F - 100 * A * a - 100 * B * b - C * c) // D"
] | false | 0.00763 | 0.199283 | 0.038285 | [
"s865326259",
"s589538131"
] |
u712259362 | p02995 | python | s194302771 | s093594687 | 46 | 36 | 5,588 | 5,076 | Accepted | Accepted | 21.74 | import fractions
A, B, C, D = [int(i) for i in input().split()]
result = B+1 - A
def lcm(a, b):
return (a * b) // fractions.gcd(a, b)
def wareru(min_num, max_num, waru):
return (max_num)//waru - (min_num-1)//waru
result -= wareru(A, B, C) + wareru(A, B, D) - wareru(A, B, lcm(C,D))
print(result) | from fractions import gcd
A, B, C, D = [int(i) for i in input().split()]
result = B+1 - A
def lcm(a, b):
return (a * b) // gcd(a, b)
def wareru(min_num, max_num, waru):
return (max_num)//waru - (min_num-1)//waru
result -= wareru(A, B, C) + wareru(A, B, D) - wareru(A, B, lcm(C,D))
print(result) | 9 | 9 | 311 | 310 | import fractions
A, B, C, D = [int(i) for i in input().split()]
result = B + 1 - A
def lcm(a, b):
return (a * b) // fractions.gcd(a, b)
def wareru(min_num, max_num, waru):
return (max_num) // waru - (min_num - 1) // waru
result -= wareru(A, B, C) + wareru(A, B, D) - wareru(A, B, lcm(C, D))
print(result)
| from fractions import gcd
A, B, C, D = [int(i) for i in input().split()]
result = B + 1 - A
def lcm(a, b):
return (a * b) // gcd(a, b)
def wareru(min_num, max_num, waru):
return (max_num) // waru - (min_num - 1) // waru
result -= wareru(A, B, C) + wareru(A, B, D) - wareru(A, B, lcm(C, D))
print(result)
| false | 0 | [
"-import fractions",
"+from fractions import gcd",
"- return (a * b) // fractions.gcd(a, b)",
"+ return (a * b) // gcd(a, b)"
] | false | 0.080564 | 0.046812 | 1.721003 | [
"s194302771",
"s093594687"
] |
u678167152 | p02866 | python | s513021034 | s003999840 | 167 | 149 | 19,808 | 18,936 | Accepted | Accepted | 10.78 | N = int(eval(input()))
D = list(map(int, input().split()))
mod = 998244353
from collections import Counter, deque
def solve(N,D):
if D[0]!=0:
return 0
c = Counter(D)
if c[0]>1:
return 0
ans = 1
m = max(D)
for i in range(1,m):
if c[i]==0:
an... | N = int(eval(input()))
D = list(map(int, input().split()))
mod = 998244353
from collections import Counter, deque
def solve(N,D):
if D[0]!=0:
return 0
c = Counter(D)
if c[0]>1:
return 0
ans = 1
m = max(D)
for i in range(1,m):
# if c[i]==0:
# ... | 24 | 24 | 435 | 441 | N = int(eval(input()))
D = list(map(int, input().split()))
mod = 998244353
from collections import Counter, deque
def solve(N, D):
if D[0] != 0:
return 0
c = Counter(D)
if c[0] > 1:
return 0
ans = 1
m = max(D)
for i in range(1, m):
if c[i] == 0:
ans = 0
... | N = int(eval(input()))
D = list(map(int, input().split()))
mod = 998244353
from collections import Counter, deque
def solve(N, D):
if D[0] != 0:
return 0
c = Counter(D)
if c[0] > 1:
return 0
ans = 1
m = max(D)
for i in range(1, m):
# if c[i]==0:
# ans = 0
... | false | 0 | [
"- if c[i] == 0:",
"- ans = 0",
"- continue",
"+ # if c[i]==0:",
"+ # ans = 0",
"+ # continue"
] | false | 0.047879 | 0.044468 | 1.07671 | [
"s513021034",
"s003999840"
] |
u257162238 | p02631 | python | s620287115 | s599793908 | 202 | 159 | 43,000 | 31,856 | Accepted | Accepted | 21.29 | import sys
input = sys.stdin.readline
from itertools import accumulate
from functools import reduce
from operator import xor, add
def read():
N = int(input().strip())
A = list(map(int, input().strip().split()))
return N, A
def solve(N, A):
L = list(accumulate(A, xor))
R = list(acc... | import sys
input = sys.stdin.readline
from itertools import accumulate
from functools import reduce
from operator import xor, add
def read():
N = int(input().strip())
A = list(map(int, input().strip().split()))
return N, A
def solve(N, A):
S = reduce(xor, A)
for a in A:
p... | 32 | 24 | 712 | 489 | import sys
input = sys.stdin.readline
from itertools import accumulate
from functools import reduce
from operator import xor, add
def read():
N = int(input().strip())
A = list(map(int, input().strip().split()))
return N, A
def solve(N, A):
L = list(accumulate(A, xor))
R = list(accumulate(A[::-1... | import sys
input = sys.stdin.readline
from itertools import accumulate
from functools import reduce
from operator import xor, add
def read():
N = int(input().strip())
A = list(map(int, input().strip().split()))
return N, A
def solve(N, A):
S = reduce(xor, A)
for a in A:
print(S ^ a, end... | false | 25 | [
"- L = list(accumulate(A, xor))",
"- R = list(accumulate(A[::-1], xor))[::-1]",
"- ans = [0 for i in range(N)]",
"- for i in range(N):",
"- a = 0",
"- l = L[i - 1] if i > 0 else 0",
"- a ^= l",
"- r = R[i + 1] if i + 1 < N else 0",
"- a ^= r",
"- ... | false | 0.048148 | 0.047496 | 1.013738 | [
"s620287115",
"s599793908"
] |
u102242691 | p02952 | python | s281524953 | s720474549 | 66 | 55 | 2,940 | 3,064 | Accepted | Accepted | 16.67 | n = int(eval(input()))
count = 0
for i in range(1,n+1):
if len(str(i)) % 2 == 1:
count += 1
print(count)
|
n = eval(input())
num = int(n)
ans = 0
for i in range(1,num+1):
if len(str(i)) % 2 == 1:
ans += 1
# print(i)
print(ans)
| 7 | 11 | 118 | 146 | n = int(eval(input()))
count = 0
for i in range(1, n + 1):
if len(str(i)) % 2 == 1:
count += 1
print(count)
| n = eval(input())
num = int(n)
ans = 0
for i in range(1, num + 1):
if len(str(i)) % 2 == 1:
ans += 1
# print(i)
print(ans)
| false | 36.363636 | [
"-n = int(eval(input()))",
"-count = 0",
"-for i in range(1, n + 1):",
"+n = eval(input())",
"+num = int(n)",
"+ans = 0",
"+for i in range(1, num + 1):",
"- count += 1",
"-print(count)",
"+ ans += 1",
"+# print(i)",
"+print(ans)"
] | false | 0.0495 | 0.051352 | 0.963952 | [
"s281524953",
"s720474549"
] |
u568576853 | p02697 | python | s981227020 | s115327578 | 237 | 119 | 28,024 | 22,596 | Accepted | Accepted | 49.79 | import numpy as np
N,M=list(map(int,input().split()))
A=np.arange(M)
B=2*M-1-A
B[:M//2]-=(2*M+1)
A%=N
B%=N
A+=1
B+=1
for i in range(M):
print((A[i],B[i])) | N,M=map(int,input().split())
ans=[]
if N%2==1:
for i in range(M):
ans.append([i+1,N-i])
else:
for i in range(M//2):
ans.append([i+1,2*M-i+1])
for j in range(M-M//2):
ans.append([j+M//2+1,2*M-M//2-j])
for k in ans:
print(*k,sep=' ')
| 11 | 12 | 158 | 262 | import numpy as np
N, M = list(map(int, input().split()))
A = np.arange(M)
B = 2 * M - 1 - A
B[: M // 2] -= 2 * M + 1
A %= N
B %= N
A += 1
B += 1
for i in range(M):
print((A[i], B[i]))
| N, M = map(int, input().split())
ans = []
if N % 2 == 1:
for i in range(M):
ans.append([i + 1, N - i])
else:
for i in range(M // 2):
ans.append([i + 1, 2 * M - i + 1])
for j in range(M - M // 2):
ans.append([j + M // 2 + 1, 2 * M - M // 2 - j])
for k in ans:
print(*k, sep=" ")
| false | 8.333333 | [
"-import numpy as np",
"-",
"-N, M = list(map(int, input().split()))",
"-A = np.arange(M)",
"-B = 2 * M - 1 - A",
"-B[: M // 2] -= 2 * M + 1",
"-A %= N",
"-B %= N",
"-A += 1",
"-B += 1",
"-for i in range(M):",
"- print((A[i], B[i]))",
"+N, M = map(int, input().split())",
"+ans = []",
... | false | 0.289616 | 0.035547 | 8.147332 | [
"s981227020",
"s115327578"
] |
u215743476 | p02899 | python | s434920426 | s855778535 | 361 | 175 | 19,960 | 14,008 | Accepted | Accepted | 51.52 | import heapq as hq
n = int(input())
a = list(map(int, input().split()))
b = [i for i in range(1, n+1)]
p = list(zip(a, b))
q = []
hq.heapify(q)
for i in range(len(p)):
hq.heappush(q, p[i])
while len(q) != 0:
print(q[0][1], end=' ')
hq.heappop(q)
| n = int(input())
a = list(map(int, input().split()))
b = [0]*n
for i in range(n):
b[a[i]-1] = i + 1
for i in range(n):
print(b[i], end=' ')
| 15 | 9 | 275 | 157 | import heapq as hq
n = int(input())
a = list(map(int, input().split()))
b = [i for i in range(1, n + 1)]
p = list(zip(a, b))
q = []
hq.heapify(q)
for i in range(len(p)):
hq.heappush(q, p[i])
while len(q) != 0:
print(q[0][1], end=" ")
hq.heappop(q)
| n = int(input())
a = list(map(int, input().split()))
b = [0] * n
for i in range(n):
b[a[i] - 1] = i + 1
for i in range(n):
print(b[i], end=" ")
| false | 40 | [
"-import heapq as hq",
"-",
"-b = [i for i in range(1, n + 1)]",
"-p = list(zip(a, b))",
"-q = []",
"-hq.heapify(q)",
"-for i in range(len(p)):",
"- hq.heappush(q, p[i])",
"-while len(q) != 0:",
"- print(q[0][1], end=\" \")",
"- hq.heappop(q)",
"+b = [0] * n",
"+for i in range(n):",... | false | 0.037577 | 0.111937 | 0.335696 | [
"s434920426",
"s855778535"
] |
u250345397 | p02390 | python | s784582213 | s046258233 | 40 | 20 | 7,656 | 7,640 | Accepted | Accepted | 50 | s = int(eval(input()))
h = s // 3600
m = (s - h * 3600) // 60
s = (s - h * 3600) % 60
print((str(h)+":"+str(m)+":"+str(s))) | s = int(eval(input()))
h = s // 3600
m = (s % 3600) // 60
s = s % 60
print((str(h)+":"+str(m)+":"+str(s))) | 5 | 5 | 119 | 102 | s = int(eval(input()))
h = s // 3600
m = (s - h * 3600) // 60
s = (s - h * 3600) % 60
print((str(h) + ":" + str(m) + ":" + str(s)))
| s = int(eval(input()))
h = s // 3600
m = (s % 3600) // 60
s = s % 60
print((str(h) + ":" + str(m) + ":" + str(s)))
| false | 0 | [
"-m = (s - h * 3600) // 60",
"-s = (s - h * 3600) % 60",
"+m = (s % 3600) // 60",
"+s = s % 60"
] | false | 0.063367 | 0.064779 | 0.978208 | [
"s784582213",
"s046258233"
] |
u143278390 | p03862 | python | s021601491 | s802131310 | 117 | 103 | 14,252 | 14,540 | Accepted | Accepted | 11.97 | n,x=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
count=0
if(a[0]>x):
count=a[0]-x
a[0]=x
for ind,i in enumerate(a):
if(ind==len(a)-1):
break
s=i+a[ind+1]
if(s>x):
count+=s-x
a[ind+1]-=s-x
#s=i+a[ind+1]
print(count)
| n,x=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
if(n==1):
print((a[0]-x))
exit()
ope=0
if(a[0]>x):
ope+=a[0]-x
a[0]=x
for i in range(n-1):
c=a[i]+a[i+1]
if(c>x):
a[i+1]-=c-x
ope+=c-x
print(ope) | 18 | 17 | 318 | 275 | n, x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
count = 0
if a[0] > x:
count = a[0] - x
a[0] = x
for ind, i in enumerate(a):
if ind == len(a) - 1:
break
s = i + a[ind + 1]
if s > x:
count += s - x
a[ind + 1] -= s - x
# s=i+a[ind+1]
print... | n, x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
if n == 1:
print((a[0] - x))
exit()
ope = 0
if a[0] > x:
ope += a[0] - x
a[0] = x
for i in range(n - 1):
c = a[i] + a[i + 1]
if c > x:
a[i + 1] -= c - x
ope += c - x
print(ope)
| false | 5.555556 | [
"-count = 0",
"+if n == 1:",
"+ print((a[0] - x))",
"+ exit()",
"+ope = 0",
"- count = a[0] - x",
"+ ope += a[0] - x",
"-for ind, i in enumerate(a):",
"- if ind == len(a) - 1:",
"- break",
"- s = i + a[ind + 1]",
"- if s > x:",
"- count += s - x",
"- ... | false | 0.036932 | 0.070031 | 0.527365 | [
"s021601491",
"s802131310"
] |
u021019433 | p03038 | python | s930704119 | s597809557 | 808 | 608 | 21,548 | 20,872 | Accepted | Accepted | 24.75 | import heapq
from itertools import repeat, starmap
from operator import mul
R = lambda: list(map(int, input().split()))
n, m = R()
a = list(zip(R(), repeat(1)))
heapq.heapify(a)
for _ in range(m):
b, c = R()
i = b
while i and a[0][0] < c:
x, y = a[0]
if y > i:
a[0]... | import heapq
from itertools import repeat, starmap
from operator import mul
R = lambda: list(map(int, input().split()))
n, m = R()
a = list(zip(R(), repeat(1)))
heapq.heapify(a)
for _ in range(m):
b, c = R()
i = b
while i and a[0][0] < c:
x, y = a[0]
if i < y:
a[0]... | 21 | 22 | 474 | 493 | import heapq
from itertools import repeat, starmap
from operator import mul
R = lambda: list(map(int, input().split()))
n, m = R()
a = list(zip(R(), repeat(1)))
heapq.heapify(a)
for _ in range(m):
b, c = R()
i = b
while i and a[0][0] < c:
x, y = a[0]
if y > i:
a[0] = x, y - i
... | import heapq
from itertools import repeat, starmap
from operator import mul
R = lambda: list(map(int, input().split()))
n, m = R()
a = list(zip(R(), repeat(1)))
heapq.heapify(a)
for _ in range(m):
b, c = R()
i = b
while i and a[0][0] < c:
x, y = a[0]
if i < y:
a[0] = x, y - i
... | false | 4.545455 | [
"- if y > i:",
"+ if i < y:",
"- heapq.heappush(a, (c, b - i))",
"+ if i < b:",
"+ heapq.heappush(a, (c, b - i))"
] | false | 0.047911 | 0.042945 | 1.115635 | [
"s930704119",
"s597809557"
] |
u151785909 | p03557 | python | s633067202 | s881384614 | 960 | 339 | 23,328 | 23,328 | Accepted | Accepted | 64.69 | n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
def n_smaller_a(num):
if num>a[n-1]:
return n
if num<=a[0]:
return 0
left=0
right=n-1
mid=(left+right)//2
... | import bisect
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for i in range(n):
ans+=bisect.bisect_left(a,b[i])*(n-bisect.bisect_right(c,b[i]))
print(ans)
| 53 | 15 | 994 | 286 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
def n_smaller_a(num):
if num > a[n - 1]:
return n
if num <= a[0]:
return 0
left = 0
right = n - 1
mid = (left + right) // 2
... | import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for i in range(n):
ans += bisect.bisect_left(a, b[i]) * (n - bisect.bisect_right(c, b[i]))
print(ans)
| false | 71.698113 | [
"+import bisect",
"+",
"-",
"-",
"-def n_smaller_a(num):",
"- if num > a[n - 1]:",
"- return n",
"- if num <= a[0]:",
"- return 0",
"- left = 0",
"- right = n - 1",
"- mid = (left + right) // 2",
"- while right - left > 1:",
"- if a[mid] >= num:",
"... | false | 0.039601 | 0.040167 | 0.985913 | [
"s633067202",
"s881384614"
] |
u227082700 | p03450 | python | s228434180 | s212601420 | 1,406 | 1,266 | 105,504 | 65,852 | Accepted | Accepted | 9.96 | n,m=list(map(int,input().split()))
ans=[10**10]*n
edge=[[]for _ in range(n)]
for _ in range(m):
l,r,d=list(map(int,input().split()))
l-=1
r-=1
edge[l].append([r,d])
edge[r].append([l,-d])
for i in range(n):
if ans[i]==10**10:
ans[i]=0
Q=[i]
while Q:
P=[]
for i in Q:
for j,d in edge... | n,m=list(map(int,input().split()))
ans=[10**10]*n
edge=[[]for _ in range(n)]
for _ in range(m):
l,r,d=list(map(int,input().split()))
l-=1;r-=1
edge[l].append((r,d))
edge[r].append((l,-d))
for i in range(n):
if ans[i]==10**10:
ans[i]=0
Q=[i]
while Q:
P=[]
for j in Q:
... | 25 | 23 | 480 | 506 | n, m = list(map(int, input().split()))
ans = [10**10] * n
edge = [[] for _ in range(n)]
for _ in range(m):
l, r, d = list(map(int, input().split()))
l -= 1
r -= 1
edge[l].append([r, d])
edge[r].append([l, -d])
for i in range(n):
if ans[i] == 10**10:
ans[i] = 0
Q = [i]
whi... | n, m = list(map(int, input().split()))
ans = [10**10] * n
edge = [[] for _ in range(n)]
for _ in range(m):
l, r, d = list(map(int, input().split()))
l -= 1
r -= 1
edge[l].append((r, d))
edge[r].append((l, -d))
for i in range(n):
if ans[i] == 10**10:
ans[i] = 0
Q = [i]
whi... | false | 8 | [
"- edge[l].append([r, d])",
"- edge[r].append([l, -d])",
"+ edge[l].append((r, d))",
"+ edge[r].append((l, -d))",
"- for i in Q:",
"- for j, d in edge[i]:",
"- if ans[j] == 10**10:",
"- P += [j]",
"- ... | false | 0.041659 | 0.040584 | 1.026499 | [
"s228434180",
"s212601420"
] |
u072053884 | p02317 | python | s284154829 | s909547585 | 130 | 120 | 18,724 | 9,632 | Accepted | Accepted | 7.69 | import sys, bisect
def solve():
A = list(map(int, sys.stdin.readlines()))
n = A[0]
A = A[1:]
L = A[:1]
for a_i in A[1:]:
if a_i > L[-1]:
L.append(a_i)
else:
j = bisect.bisect_left(L, a_i)
L[j] = a_i
print((len(L)))
solve() | import sys
from bisect import bisect_left
def solve():
A = list(map(int, sys.stdin))
n = next(A)
L = [next(A)]
for a_i in A:
if a_i > L[-1]:
L.append(a_i)
else:
j = bisect_left(L, a_i)
L[j] = a_i
print((len(L)))
solve()
| 16 | 17 | 313 | 303 | import sys, bisect
def solve():
A = list(map(int, sys.stdin.readlines()))
n = A[0]
A = A[1:]
L = A[:1]
for a_i in A[1:]:
if a_i > L[-1]:
L.append(a_i)
else:
j = bisect.bisect_left(L, a_i)
L[j] = a_i
print((len(L)))
solve()
| import sys
from bisect import bisect_left
def solve():
A = list(map(int, sys.stdin))
n = next(A)
L = [next(A)]
for a_i in A:
if a_i > L[-1]:
L.append(a_i)
else:
j = bisect_left(L, a_i)
L[j] = a_i
print((len(L)))
solve()
| false | 5.882353 | [
"-import sys, bisect",
"+import sys",
"+from bisect import bisect_left",
"- A = list(map(int, sys.stdin.readlines()))",
"- n = A[0]",
"- A = A[1:]",
"- L = A[:1]",
"- for a_i in A[1:]:",
"+ A = list(map(int, sys.stdin))",
"+ n = next(A)",
"+ L = [next(A)]",
"+ for a_... | false | 0.04056 | 0.039458 | 1.027922 | [
"s284154829",
"s909547585"
] |
u687574784 | p02813 | python | s796696143 | s794529420 | 146 | 34 | 8,180 | 9,188 | Accepted | Accepted | 76.71 | n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
from collections import deque
tuples=[]
def f(que):
if len(que)==n:
tuples.append(tuple(que))
return
for v in range(1,n+1):
if v not in que:
que.append(v)
... | import itertools
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
a,b = 0,0
for i, perm in enumerate(itertools.permutations(list(range(1, N+1))), 1):
if P==perm:
a = i
if Q==perm:
b = i
if a > 0 and b > 0:
print((abs(a-b)))... | 21 | 14 | 476 | 322 | n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
from collections import deque
tuples = []
def f(que):
if len(que) == n:
tuples.append(tuple(que))
return
for v in range(1, n + 1):
if v not in que:
que.append(v)
f(... | import itertools
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
a, b = 0, 0
for i, perm in enumerate(itertools.permutations(list(range(1, N + 1))), 1):
if P == perm:
a = i
if Q == perm:
b = i
if a > 0 and b > 0:
print((abs(a - b)))
... | false | 33.333333 | [
"-n = int(eval(input()))",
"-p = tuple(map(int, input().split()))",
"-q = tuple(map(int, input().split()))",
"-from collections import deque",
"+import itertools",
"-tuples = []",
"-",
"-",
"-def f(que):",
"- if len(que) == n:",
"- tuples.append(tuple(que))",
"- return",
"- ... | false | 0.085307 | 0.048921 | 1.743775 | [
"s796696143",
"s794529420"
] |
u657611449 | p03229 | python | s716022913 | s737932876 | 1,008 | 788 | 13,636 | 18,440 | Accepted | Accepted | 21.83 | h = []
N = int(eval(input()))
for i in range(N):
v = int(eval(input()))
h.append(v)
h.sort()
hh = h.copy()
ans = 0
t = h.pop(-1)
t1 = t
pm = 0
while 1:
t2 = h.pop(pm)
ans += abs(t - t2)
if len(h) == 0:
break
t = t2
t3 = h.pop(pm)
ans += abs(t1 - t3)
i... |
import sys
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
# def main():
# N = int(input())
# for i in range(N):
# v = int(input())
# h.append(v)
def main():
N, *h = list(map(int, read().split()))
h.sort()
hh = h.c... | 56 | 68 | 752 | 1,161 | h = []
N = int(eval(input()))
for i in range(N):
v = int(eval(input()))
h.append(v)
h.sort()
hh = h.copy()
ans = 0
t = h.pop(-1)
t1 = t
pm = 0
while 1:
t2 = h.pop(pm)
ans += abs(t - t2)
if len(h) == 0:
break
t = t2
t3 = h.pop(pm)
ans += abs(t1 - t3)
if len(h) == 0:
br... | import sys
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
sys.setrecursionlimit(10**7)
# def main():
# N = int(input())
# for i in range(N):
# v = int(input())
# h.append(v)
def main():
N, *h = list(map(int, read().split()))
h.sort()
hh = h.copy()
ans = 0
t = h.pop(-1)
... | false | 17.647059 | [
"-h = []",
"-N = int(eval(input()))",
"-for i in range(N):",
"- v = int(eval(input()))",
"- h.append(v)",
"-h.sort()",
"-hh = h.copy()",
"-ans = 0",
"-t = h.pop(-1)",
"-t1 = t",
"-pm = 0",
"-while 1:",
"- t2 = h.pop(pm)",
"- ans += abs(t - t2)",
"- if len(h) == 0:",
"- ... | false | 0.066666 | 0.071269 | 0.935407 | [
"s716022913",
"s737932876"
] |
u790710233 | p03503 | python | s529036920 | s808858789 | 384 | 120 | 3,064 | 3,064 | Accepted | Accepted | 68.75 | n = int(eval(input()))
f = [input().replace(" ", '') for _ in range(n)]
p = [list(map(int, input().split())) for _ in range(n)]
outcome_list = []
for i in range(1, 1 << 10):
outcome = 0
for j, x in enumerate(f):
both = "{:010b}".format(i & int(x, 2))
n_store = sum(map(int, list(both)))... | N = int(eval(input()))
F = [int(input().replace(" ", ''), 2) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
outcome_list = []
for i in range(1, 1 << 10):
outcome = 0
for f, p in zip(F, P):
n_store = "{:010b}".format(i & f).count("1")
outcome += p[n_store]
... | 13 | 12 | 408 | 371 | n = int(eval(input()))
f = [input().replace(" ", "") for _ in range(n)]
p = [list(map(int, input().split())) for _ in range(n)]
outcome_list = []
for i in range(1, 1 << 10):
outcome = 0
for j, x in enumerate(f):
both = "{:010b}".format(i & int(x, 2))
n_store = sum(map(int, list(both)))
o... | N = int(eval(input()))
F = [int(input().replace(" ", ""), 2) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
outcome_list = []
for i in range(1, 1 << 10):
outcome = 0
for f, p in zip(F, P):
n_store = "{:010b}".format(i & f).count("1")
outcome += p[n_store]
outcome_... | false | 7.692308 | [
"-n = int(eval(input()))",
"-f = [input().replace(\" \", \"\") for _ in range(n)]",
"-p = [list(map(int, input().split())) for _ in range(n)]",
"+N = int(eval(input()))",
"+F = [int(input().replace(\" \", \"\"), 2) for _ in range(N)]",
"+P = [list(map(int, input().split())) for _ in range(N)]",
"- fo... | false | 0.152759 | 0.136219 | 1.121421 | [
"s529036920",
"s808858789"
] |
u670567845 | p03352 | python | s519182910 | s986470685 | 78 | 69 | 65,248 | 65,432 | Accepted | Accepted | 11.54 | import collections
X = int(eval(input()))
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
f += 2
if n != 1:
a.append(n)
... | import collections
X = int(eval(input()))
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
f += 2
if n != 1:
a.append(n)
... | 26 | 29 | 513 | 541 | import collections
X = int(eval(input()))
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
f += 2
if n != 1:
a.append(n)
return a
... | import collections
X = int(eval(input()))
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
f += 2
if n != 1:
a.append(n)
return a
... | false | 10.344828 | [
"-ans = 1",
"- Y = X - i",
"- f = collections.Counter(prime_factorize(Y))",
"- if len(set(f.values())) == 1 and list(f.values())[0] > 1:",
"- ans = Y",
"+ J = X - i",
"+ d = collections.Counter(prime_factorize(J))",
"+ dv = list(d.values())",
"+ if len(set(dv)) == 1 and d... | false | 0.03348 | 0.112137 | 0.298569 | [
"s519182910",
"s986470685"
] |
u975445930 | p02714 | python | s511332782 | s934986383 | 1,262 | 755 | 9,136 | 9,232 | Accepted | Accepted | 40.17 | n = int(eval(input()))
s = list(eval(input()))
r = s.count('R')
g = s.count('G')
b = s.count('B')
cnt = 0
for i in range(n):
for j in range(i+1,n):
k = j*2-i
if k >= n:
break
elif s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
cnt +=1
print((r*g*b - ... | def solve2():
n = int(eval(input()))
s = list(eval(input()))
r = s.count('R')
g = s.count('G')
b = s.count('B')
cnt = 0
for i in range(n):
for j in range(i+1,n):
k = j*2-i
if k >= n:
break
elif s[i] != s[j] and s[j] ... | 16 | 19 | 311 | 401 | n = int(eval(input()))
s = list(eval(input()))
r = s.count("R")
g = s.count("G")
b = s.count("B")
cnt = 0
for i in range(n):
for j in range(i + 1, n):
k = j * 2 - i
if k >= n:
break
elif s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
cnt += 1
print((r * g * b - cnt))... | def solve2():
n = int(eval(input()))
s = list(eval(input()))
r = s.count("R")
g = s.count("G")
b = s.count("B")
cnt = 0
for i in range(n):
for j in range(i + 1, n):
k = j * 2 - i
if k >= n:
break
elif s[i] != s[j] and s[j] != s[k] a... | false | 15.789474 | [
"-n = int(eval(input()))",
"-s = list(eval(input()))",
"-r = s.count(\"R\")",
"-g = s.count(\"G\")",
"-b = s.count(\"B\")",
"-cnt = 0",
"-for i in range(n):",
"- for j in range(i + 1, n):",
"- k = j * 2 - i",
"- if k >= n:",
"- break",
"- elif s[i] != s[j] an... | false | 0.082919 | 0.03999 | 2.073514 | [
"s511332782",
"s934986383"
] |
u779455925 | p03608 | python | s568526954 | s466345095 | 1,368 | 460 | 124,888 | 50,520 | Accepted | Accepted | 66.37 | from collections import *
from itertools import *
import copy
from heapq import *
N,M,R=list(map(int,input().split()))
Rlst=list(map(int,input().split()))
ABC=[list(map(int,input().split())) for i in range(M)]
data=[[] for i in range(N+1)]
nagasa={}
for a,b,c in ABC:
data[a].append(b)
data[b].a... | from collections import *
from itertools import *
import copy
from heapq import *
N,M,R=list(map(int,input().split()))
Rlst=list(map(int,input().split()))
ABC=[list(map(int,input().split())) for i in range(M)]
data=[[100000*200+1 for i in range(N)] for i in range(N)]
for a,b,c in ABC:
data[a-1][b-1]=... | 57 | 29 | 1,734 | 687 | from collections import *
from itertools import *
import copy
from heapq import *
N, M, R = list(map(int, input().split()))
Rlst = list(map(int, input().split()))
ABC = [list(map(int, input().split())) for i in range(M)]
data = [[] for i in range(N + 1)]
nagasa = {}
for a, b, c in ABC:
data[a].append(b)
data[b... | from collections import *
from itertools import *
import copy
from heapq import *
N, M, R = list(map(int, input().split()))
Rlst = list(map(int, input().split()))
ABC = [list(map(int, input().split())) for i in range(M)]
data = [[100000 * 200 + 1 for i in range(N)] for i in range(N)]
for a, b, c in ABC:
data[a - 1... | false | 49.122807 | [
"-data = [[] for i in range(N + 1)]",
"-nagasa = {}",
"+data = [[100000 * 200 + 1 for i in range(N)] for i in range(N)]",
"- data[a].append(b)",
"- data[b].append(a)",
"- A, B = min(a, b), max(a, b)",
"- nagasa.update({str(A) + \" \" + str(B): c})",
"-mokutekiti = [[100000 * 200 + 1 for i ... | false | 0.039368 | 0.037539 | 1.04873 | [
"s568526954",
"s466345095"
] |
u284474275 | p02362 | python | s706198397 | s848946379 | 490 | 370 | 4,896 | 5,404 | Accepted | Accepted | 24.49 | import sys
from heapq import heappush, heappop
def bellman_ford(V, Edges, start):
dis = {}
for i in range(V): dis[i] = (1 << 30)
dis[start] = 0
for i in range(V):
for a, b, w in Edges:
if dis[a] != (1 << 30) and dis[a] + w < dis[b]:
dis[... |
from collections import defaultdict, deque
from heapq import heappush, heappop
from sys import stdin
class UnionFindSet:
def __init__(self, nodes):
self.fa = {}
for n in nodes:
self.fa[n] = n
def find(self, x):
if self.fa[x] == x:
return x
else:
self.fa[x] = self.find(self.fa[x])
... | 44 | 125 | 1,169 | 2,720 | import sys
from heapq import heappush, heappop
def bellman_ford(V, Edges, start):
dis = {}
for i in range(V):
dis[i] = 1 << 30
dis[start] = 0
for i in range(V):
for a, b, w in Edges:
if dis[a] != (1 << 30) and dis[a] + w < dis[b]:
dis[b] = dis[a] + w
for... | from collections import defaultdict, deque
from heapq import heappush, heappop
from sys import stdin
class UnionFindSet:
def __init__(self, nodes):
self.fa = {}
for n in nodes:
self.fa[n] = n
def find(self, x):
if self.fa[x] == x:
return x
else:
... | false | 64.8 | [
"-import sys",
"+from collections import defaultdict, deque",
"+from sys import stdin",
"-def bellman_ford(V, Edges, start):",
"+class UnionFindSet:",
"+ def __init__(self, nodes):",
"+ self.fa = {}",
"+ for n in nodes:",
"+ self.fa[n] = n",
"+",
"+ def find(self, ... | false | 0.043101 | 0.079177 | 0.544356 | [
"s706198397",
"s848946379"
] |
u520843951 | p02947 | python | s506780907 | s024686107 | 462 | 233 | 24,036 | 24,216 | Accepted | Accepted | 49.57 | from collections import Counter
from math import factorial
n = int(eval(input()))
s = [''.join(sorted(list(eval(input())))) for _ in range(n)]
def combination(i):
return factorial(i) // (factorial(i-2) * factorial(2))
cnt = Counter(s)
ans = 0
for i in list(cnt.values()):
if i == 1:
pass
... | from collections import Counter
from math import factorial
n = int(eval(input()))
s = [''.join(sorted(list(eval(input())))) for _ in range(n)]
cnt = Counter(s)
ans = 0
for i in list(cnt.values()):
ans += i*(i-1)//2
print(ans) | 16 | 10 | 353 | 221 | from collections import Counter
from math import factorial
n = int(eval(input()))
s = ["".join(sorted(list(eval(input())))) for _ in range(n)]
def combination(i):
return factorial(i) // (factorial(i - 2) * factorial(2))
cnt = Counter(s)
ans = 0
for i in list(cnt.values()):
if i == 1:
pass
else:... | from collections import Counter
from math import factorial
n = int(eval(input()))
s = ["".join(sorted(list(eval(input())))) for _ in range(n)]
cnt = Counter(s)
ans = 0
for i in list(cnt.values()):
ans += i * (i - 1) // 2
print(ans)
| false | 37.5 | [
"-",
"-",
"-def combination(i):",
"- return factorial(i) // (factorial(i - 2) * factorial(2))",
"-",
"-",
"- if i == 1:",
"- pass",
"- else:",
"- ans += combination(i)",
"+ ans += i * (i - 1) // 2"
] | false | 0.111085 | 0.091643 | 1.21215 | [
"s506780907",
"s024686107"
] |
u815763296 | p03624 | python | s862562016 | s240870403 | 49 | 36 | 9,748 | 9,968 | Accepted | Accepted | 26.53 | S = list(eval(input()))
L = len(S)
Slist = set()
for i in range(L):
Slist.add(ord(S[i]))
Slist = list(Slist)
Slist.sort()
ans = "None"
j = 0
L = len(Slist)
for i in range(97, 123):
if Slist[j] == i:
j += 1
if j >= L and i+1 < 123:
ans = chr(i+1)
break
... | from collections import Counter
S = list(eval(input()))
S = Counter(S)
if len(S) == 26:
ans = "None"
else:
A = [chr(i) for i in range(97, 97+26)]
for i in A:
if i in S:
continue
ans = i
break
print(ans)
| 20 | 13 | 368 | 257 | S = list(eval(input()))
L = len(S)
Slist = set()
for i in range(L):
Slist.add(ord(S[i]))
Slist = list(Slist)
Slist.sort()
ans = "None"
j = 0
L = len(Slist)
for i in range(97, 123):
if Slist[j] == i:
j += 1
if j >= L and i + 1 < 123:
ans = chr(i + 1)
break
continue... | from collections import Counter
S = list(eval(input()))
S = Counter(S)
if len(S) == 26:
ans = "None"
else:
A = [chr(i) for i in range(97, 97 + 26)]
for i in A:
if i in S:
continue
ans = i
break
print(ans)
| false | 35 | [
"+from collections import Counter",
"+",
"-L = len(S)",
"-Slist = set()",
"-for i in range(L):",
"- Slist.add(ord(S[i]))",
"-Slist = list(Slist)",
"-Slist.sort()",
"-ans = \"None\"",
"-j = 0",
"-L = len(Slist)",
"-for i in range(97, 123):",
"- if Slist[j] == i:",
"- j += 1",
... | false | 0.037379 | 0.040783 | 0.916537 | [
"s862562016",
"s240870403"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.