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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u941438707 | p03013 | python | s171000119 | s215061403 | 469 | 374 | 460,020 | 460,004 | Accepted | Accepted | 20.26 | n,m,*a=list(map(int,open(0).read().split()))
d=[1]*(n+1)
for i in a:
d[i]=0
for i in range(2,n+1):
if d[i]!=0:
d[i]=d[i-1]+d[i-2]
print((d[-1]%(10**9+7))) | n,m,*a=list(map(int,open(0).read().split()))
dp=[-1]*(n+1)+[0]
for i in a:
dp[i]=0
dp[0]=1
for i in range(1,n+1):
if dp[i]==-1:
dp[i]=dp[i-1]+dp[i-2]
print((dp[-2]%1000000007)) | 8 | 9 | 169 | 192 | n, m, *a = list(map(int, open(0).read().split()))
d = [1] * (n + 1)
for i in a:
d[i] = 0
for i in range(2, n + 1):
if d[i] != 0:
d[i] = d[i - 1] + d[i - 2]
print((d[-1] % (10**9 + 7)))
| n, m, *a = list(map(int, open(0).read().split()))
dp = [-1] * (n + 1) + [0]
for i in a:
dp[i] = 0
dp[0] = 1
for i in range(1, n + 1):
if dp[i] == -1:
dp[i] = dp[i - 1] + dp[i - 2]
print((dp[-2] % 1000000007))
| false | 11.111111 | [
"-d = [1] * (n + 1)",
"+dp = [-1] * (n + 1) + [0]",
"- d[i] = 0",
"-for i in range(2, n + 1):",
"- if d[i] != 0:",
"- d[i] = d[i - 1] + d[i - 2]",
"-print((d[-1] % (10**9 + 7)))",
"+ dp[i] = 0",
"+dp[0] = 1",
"+for i in range(1, n + 1):",
"+ if dp[i] == -1:",
"+ dp[i]... | false | 0.036221 | 0.03984 | 0.909172 | [
"s171000119",
"s215061403"
] |
u729133443 | p02744 | python | s524866083 | s454457953 | 240 | 65 | 62,556 | 15,372 | Accepted | Accepted | 72.92 | a='a'
exec('a=[s+chr(c)for s in a for c in range(97,ord(max(s))+2)];'*~-int(eval(input())))
print((*a)) | def main():
a='a'
for _ in~-int(eval(input()))*a:
a=[s+chr(c)for s in a for c in range(97,ord(max(s))+2)]
print(('\n'.join(a)))
main() | 3 | 6 | 97 | 141 | a = "a"
exec("a=[s+chr(c)for s in a for c in range(97,ord(max(s))+2)];" * ~-int(eval(input())))
print((*a))
| def main():
a = "a"
for _ in ~-int(eval(input())) * a:
a = [s + chr(c) for s in a for c in range(97, ord(max(s)) + 2)]
print(("\n".join(a)))
main()
| false | 50 | [
"-a = \"a\"",
"-exec(\"a=[s+chr(c)for s in a for c in range(97,ord(max(s))+2)];\" * ~-int(eval(input())))",
"-print((*a))",
"+def main():",
"+ a = \"a\"",
"+ for _ in ~-int(eval(input())) * a:",
"+ a = [s + chr(c) for s in a for c in range(97, ord(max(s)) + 2)]",
"+ print((\"\\n\".join... | false | 0.039289 | 0.058756 | 0.668688 | [
"s524866083",
"s454457953"
] |
u661290476 | p00741 | python | s413701833 | s175815749 | 90 | 80 | 9,480 | 9,512 | Accepted | Accepted | 11.11 | import sys
sys.setrecursionlimit(10**6)
def erase(x, y):
c[y][x] = '0'
for dx, dy in ((1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)):
nx, ny = x + dx, y + dy
if 0 <= nx <= w -1 and 0 <= ny <= h - 1:
if c[ny][nx] == '1':
erase(nx, ny)
... | import sys
sys.setrecursionlimit(10**5)
def erase(x, y):
c[y][x] = '0'
for dx, dy in ((1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)):
nx, ny = x + dx, y + dy
if 0 <= nx < w and 0 <= ny < h and c[ny][nx] == '1':
erase(nx, ny)
while True:
w, h = ... | 23 | 22 | 633 | 607 | import sys
sys.setrecursionlimit(10**6)
def erase(x, y):
c[y][x] = "0"
for dx, dy in (
(1, 0),
(1, 1),
(0, 1),
(-1, 1),
(-1, 0),
(-1, -1),
(0, -1),
(1, -1),
):
nx, ny = x + dx, y + dy
if 0 <= nx <= w - 1 and 0 <= ny <= h - 1:... | import sys
sys.setrecursionlimit(10**5)
def erase(x, y):
c[y][x] = "0"
for dx, dy in (
(1, 0),
(1, 1),
(0, 1),
(-1, 1),
(-1, 0),
(-1, -1),
(0, -1),
(1, -1),
):
nx, ny = x + dx, y + dy
if 0 <= nx < w and 0 <= ny < h and c[ny][... | false | 4.347826 | [
"-sys.setrecursionlimit(10**6)",
"+sys.setrecursionlimit(10**5)",
"- if 0 <= nx <= w - 1 and 0 <= ny <= h - 1:",
"- if c[ny][nx] == \"1\":",
"- erase(nx, ny)",
"+ if 0 <= nx < w and 0 <= ny < h and c[ny][nx] == \"1\":",
"+ erase(nx, ny)"
] | false | 0.040072 | 0.040066 | 1.000154 | [
"s413701833",
"s175815749"
] |
u649769812 | p02548 | python | s015710006 | s596861256 | 199 | 166 | 9,052 | 9,144 | Accepted | Accepted | 16.58 | N = int(eval(input()))
ans = 0
for i in range(1, N):
if N % i == 0:
ans += (N // i) - 1
else:
ans += N // i
print(ans)
| N = int(eval(input()))
ans = 0
for i in range(1, N):
ans += (N-1) // i
print(ans)
| 9 | 6 | 146 | 86 | N = int(eval(input()))
ans = 0
for i in range(1, N):
if N % i == 0:
ans += (N // i) - 1
else:
ans += N // i
print(ans)
| N = int(eval(input()))
ans = 0
for i in range(1, N):
ans += (N - 1) // i
print(ans)
| false | 33.333333 | [
"- if N % i == 0:",
"- ans += (N // i) - 1",
"- else:",
"- ans += N // i",
"+ ans += (N - 1) // i"
] | false | 0.069112 | 0.070714 | 0.977346 | [
"s015710006",
"s596861256"
] |
u024340351 | p02989 | python | s798124764 | s320717166 | 77 | 68 | 14,428 | 20,620 | Accepted | Accepted | 11.69 | a = int(eval(input()))
l = list(map(int, input().split()))
length = len(l)
l = sorted(l)
if length%2==1:
print((0))
else:
print((l[a//2]-l[a//2-1])) | N = int(eval(input()))
D = list(map(int, input().split()))
D = sorted(D)
print((D[N//2]-D[N//2-1]))
| 9 | 6 | 149 | 99 | a = int(eval(input()))
l = list(map(int, input().split()))
length = len(l)
l = sorted(l)
if length % 2 == 1:
print((0))
else:
print((l[a // 2] - l[a // 2 - 1]))
| N = int(eval(input()))
D = list(map(int, input().split()))
D = sorted(D)
print((D[N // 2] - D[N // 2 - 1]))
| false | 33.333333 | [
"-a = int(eval(input()))",
"-l = list(map(int, input().split()))",
"-length = len(l)",
"-l = sorted(l)",
"-if length % 2 == 1:",
"- print((0))",
"-else:",
"- print((l[a // 2] - l[a // 2 - 1]))",
"+N = int(eval(input()))",
"+D = list(map(int, input().split()))",
"+D = sorted(D)",
"+print(... | false | 0.040531 | 0.056136 | 0.722014 | [
"s798124764",
"s320717166"
] |
u219197917 | p03607 | python | s647349713 | s389224841 | 188 | 108 | 16,636 | 16,628 | Accepted | Accepted | 42.55 | from collections import Counter
print((sum([a % 2 for a in list(Counter([int(eval(input())) for _ in range(int(eval(input())))]).values())]))) | from collections import Counter
import sys
def read():
return sys.stdin.readline().rstrip()
n = int(read())
a = Counter([int(read()) for _ in range(n)])
print((sum([ai % 2 for ai in list(a.values())]))) | 2 | 9 | 123 | 208 | from collections import Counter
print(
(
sum(
[
a % 2
for a in list(
Counter(
[int(eval(input())) for _ in range(int(eval(input())))]
).values()
)
]
)
)
)
| from collections import Counter
import sys
def read():
return sys.stdin.readline().rstrip()
n = int(read())
a = Counter([int(read()) for _ in range(n)])
print((sum([ai % 2 for ai in list(a.values())])))
| false | 77.777778 | [
"+import sys",
"-print(",
"- (",
"- sum(",
"- [",
"- a % 2",
"- for a in list(",
"- Counter(",
"- [int(eval(input())) for _ in range(int(eval(input())))]",
"- ).values()",
"- ... | false | 0.043947 | 0.043623 | 1.007415 | [
"s647349713",
"s389224841"
] |
u942033906 | p03651 | python | s470069032 | s484032328 | 206 | 71 | 16,056 | 14,104 | Accepted | Accepted | 65.53 | import fractions
N,K = list(map(int, input().split()))
A = list(map(int,input().split()))
m = max(A)
if m < K:
print("IMPOSSIBLE")
else:
gcd = A[0]
for i in range(1,N):
gcd = fractions.gcd(A[0], A[i])
if fractions.gcd(gcd, K) == gcd:
print("POSSIBLE")
else:
print("IMPOSSIBLE") | N,K = list(map(int,input().split()))
A = list(map(int, input().split()))
M = max(A)
if K > M:
print("IMPOSSIBLE")
exit()
def gcd(n,m):
if n < m:
tmp = n
n = m
m = tmp
while n % m != 0:
tmp = m
m = n % m
n = tmp
return m
g = M
for a i... | 15 | 26 | 297 | 438 | import fractions
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
m = max(A)
if m < K:
print("IMPOSSIBLE")
else:
gcd = A[0]
for i in range(1, N):
gcd = fractions.gcd(A[0], A[i])
if fractions.gcd(gcd, K) == gcd:
print("POSSIBLE")
else:
print("IMPOSSI... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
M = max(A)
if K > M:
print("IMPOSSIBLE")
exit()
def gcd(n, m):
if n < m:
tmp = n
n = m
m = tmp
while n % m != 0:
tmp = m
m = n % m
n = tmp
return m
g = M
for a in A:
g =... | false | 42.307692 | [
"-import fractions",
"-",
"-m = max(A)",
"-if m < K:",
"+M = max(A)",
"+if K > M:",
"+ exit()",
"+",
"+",
"+def gcd(n, m):",
"+ if n < m:",
"+ tmp = n",
"+ n = m",
"+ m = tmp",
"+ while n % m != 0:",
"+ tmp = m",
"+ m = n % m",
"+ ... | false | 0.048277 | 0.037741 | 1.279151 | [
"s470069032",
"s484032328"
] |
u556589653 | p03037 | python | s304310978 | s337854720 | 299 | 210 | 11,020 | 16,836 | Accepted | Accepted | 29.77 | N,M = list(map(int,input().split()))
Left = []
Right = []
for i in range(M):
l,r = list(map(int,input().split()))
Left.append(l)
Right.append(r)
if max(Left) > min(Right):
print((0))
else:
print((min(Right)-max(Left)+1)) | N,M = list(map(int,input().split()))
left = []
right = []
for i in range(M):
l,r = list(map(int,input().split()))
left.append(l)
right.append(r)
if max(left)>min(right):
print((0))
else:
print((min(right)-max(left)+1)) | 11 | 11 | 234 | 232 | N, M = list(map(int, input().split()))
Left = []
Right = []
for i in range(M):
l, r = list(map(int, input().split()))
Left.append(l)
Right.append(r)
if max(Left) > min(Right):
print((0))
else:
print((min(Right) - max(Left) + 1))
| N, M = list(map(int, input().split()))
left = []
right = []
for i in range(M):
l, r = list(map(int, input().split()))
left.append(l)
right.append(r)
if max(left) > min(right):
print((0))
else:
print((min(right) - max(left) + 1))
| false | 0 | [
"-Left = []",
"-Right = []",
"+left = []",
"+right = []",
"- Left.append(l)",
"- Right.append(r)",
"-if max(Left) > min(Right):",
"+ left.append(l)",
"+ right.append(r)",
"+if max(left) > min(right):",
"- print((min(Right) - max(Left) + 1))",
"+ print((min(right) - max(left) ... | false | 0.044099 | 0.044486 | 0.991308 | [
"s304310978",
"s337854720"
] |
u657913472 | p03106 | python | s276255043 | s479963647 | 21 | 17 | 3,060 | 2,940 | Accepted | Accepted | 19.05 | a,b,k=list(map(int,input().split()))
print(([i for i in range(1,101)if a%i==0 and b%i==0][-k])) | a,b,k=list(map(int,input().split()))
print(([i for i in range(1,101)if a%i==b%i==0][-k])) | 2 | 2 | 88 | 82 | a, b, k = list(map(int, input().split()))
print(([i for i in range(1, 101) if a % i == 0 and b % i == 0][-k]))
| a, b, k = list(map(int, input().split()))
print(([i for i in range(1, 101) if a % i == b % i == 0][-k]))
| false | 0 | [
"-print(([i for i in range(1, 101) if a % i == 0 and b % i == 0][-k]))",
"+print(([i for i in range(1, 101) if a % i == b % i == 0][-k]))"
] | false | 0.062778 | 0.076698 | 0.818516 | [
"s276255043",
"s479963647"
] |
u591503175 | p03164 | python | s043671776 | s065079342 | 204 | 182 | 92,072 | 15,724 | Accepted | Accepted | 10.78 | import sys
input = sys.stdin.readline
import numpy as np
def main():
N, W = [int(item) for item in input().split()]
item = np.array([[int(item) for item in input().split()] for _ in range(N)])
dp = np.full((N+1, 10**5 + 1), 10**12+1)
dp[0][0] = 0
for i in range(N):
dp[i+1] =... | import sys
input = sys.stdin.readline
import numpy as np
def main():
N, W = [int(item) for item in input().split()]
item = np.array([[int(item) for item in input().split()] for _ in range(N)])
dp = np.full(10**5 + 1, 10**12+1)
dp[0] = 0
for i in range(N):
w, v = item[i]
... | 21 | 20 | 498 | 449 | import sys
input = sys.stdin.readline
import numpy as np
def main():
N, W = [int(item) for item in input().split()]
item = np.array([[int(item) for item in input().split()] for _ in range(N)])
dp = np.full((N + 1, 10**5 + 1), 10**12 + 1)
dp[0][0] = 0
for i in range(N):
dp[i + 1] = dp[i]
... | import sys
input = sys.stdin.readline
import numpy as np
def main():
N, W = [int(item) for item in input().split()]
item = np.array([[int(item) for item in input().split()] for _ in range(N)])
dp = np.full(10**5 + 1, 10**12 + 1)
dp[0] = 0
for i in range(N):
w, v = item[i]
np.minim... | false | 4.761905 | [
"- dp = np.full((N + 1, 10**5 + 1), 10**12 + 1)",
"- dp[0][0] = 0",
"+ dp = np.full(10**5 + 1, 10**12 + 1)",
"+ dp[0] = 0",
"- dp[i + 1] = dp[i]",
"- np.minimum(dp[i][v:], dp[i][:-v] + w, out=dp[i + 1][v:])",
"- print((np.where(dp[N] <= W)[0][-1]))",
"+ np.minimum(d... | false | 0.225491 | 0.213986 | 1.053764 | [
"s043671776",
"s065079342"
] |
u630281418 | p02861 | python | s933442380 | s951673228 | 209 | 165 | 47,084 | 38,384 | Accepted | Accepted | 21.05 | import itertools
import math
n = int(eval(input()))
xy = []
for _ in range(n):
xxyy = list(map(int, input().split()))
xy.append(xxyy)
l = [i for i in range(n)]
p = list(itertools.permutations(l))
dist = 0
for pp in p:
preppi = pp[0]
for ppi in pp[1:]:
dist += math.sqrt((xy[ppi][... | import math
n = int(eval(input()))
xy = []
for _ in range(n):
xxyy = list(map(int, input().split()))
xy.append(xxyy)
dist = 0
for i, xyi in enumerate(xy):
for xyj in xy[i+1:]:
dist += math.sqrt((xyi[0] - xyj[0])**2 + (xyi[1] - xyj[1])**2)
print((dist*2/n))
| 18 | 13 | 414 | 283 | import itertools
import math
n = int(eval(input()))
xy = []
for _ in range(n):
xxyy = list(map(int, input().split()))
xy.append(xxyy)
l = [i for i in range(n)]
p = list(itertools.permutations(l))
dist = 0
for pp in p:
preppi = pp[0]
for ppi in pp[1:]:
dist += math.sqrt(
(xy[ppi][0] ... | import math
n = int(eval(input()))
xy = []
for _ in range(n):
xxyy = list(map(int, input().split()))
xy.append(xxyy)
dist = 0
for i, xyi in enumerate(xy):
for xyj in xy[i + 1 :]:
dist += math.sqrt((xyi[0] - xyj[0]) ** 2 + (xyi[1] - xyj[1]) ** 2)
print((dist * 2 / n))
| false | 27.777778 | [
"-import itertools",
"-l = [i for i in range(n)]",
"-p = list(itertools.permutations(l))",
"-for pp in p:",
"- preppi = pp[0]",
"- for ppi in pp[1:]:",
"- dist += math.sqrt(",
"- (xy[ppi][0] - xy[preppi][0]) ** 2 + (xy[ppi][1] - xy[preppi][1]) ** 2",
"- )",
"- ... | false | 0.041529 | 0.067505 | 0.615203 | [
"s933442380",
"s951673228"
] |
u888092736 | p02911 | python | s748551913 | s228740166 | 108 | 64 | 13,940 | 14,004 | Accepted | Accepted | 40.74 | N, K, Q, *A = map(int, open(0).read().split())
ans = [K - Q] * N
for a in A:
ans[a - 1] += 1
[print('Yes') if v > 0 else print('No') for v in ans]
| N, K, Q, *A = list(map(int, open(0).read().split()))
ans = [K - Q] * N
for a in A:
ans[a - 1] += 1
print(('\n'.join('Yes' if v > 0 else 'No' for v in ans))) | 5 | 5 | 154 | 156 | N, K, Q, *A = map(int, open(0).read().split())
ans = [K - Q] * N
for a in A:
ans[a - 1] += 1
[print("Yes") if v > 0 else print("No") for v in ans]
| N, K, Q, *A = list(map(int, open(0).read().split()))
ans = [K - Q] * N
for a in A:
ans[a - 1] += 1
print(("\n".join("Yes" if v > 0 else "No" for v in ans)))
| false | 0 | [
"-N, K, Q, *A = map(int, open(0).read().split())",
"+N, K, Q, *A = list(map(int, open(0).read().split()))",
"-[print(\"Yes\") if v > 0 else print(\"No\") for v in ans]",
"+print((\"\\n\".join(\"Yes\" if v > 0 else \"No\" for v in ans)))"
] | false | 0.036578 | 0.035337 | 1.035113 | [
"s748551913",
"s228740166"
] |
u886655280 | p03478 | python | s445007635 | s270355577 | 47 | 38 | 3,060 | 3,060 | Accepted | Accepted | 19.15 | N, A, B = list(map(int, input().split()))
target_total = 0
for n in range(1, N + 1):
total_each_digit = 0
n_length = len(str(n))
for i in range(n_length):
total_each_digit += int(str(n)[i])
if A <= total_each_digit <= B:
target_total += n
print(target_total) | N, A, B = list(map(int, input().split()))
target_total = 0 # 加算対象の数値の和
for n in range(1, N + 1):
total_each_digit = 0 # 各位の和
str_n = str(n)
n_length = len(str_n) # nの桁数
for i in range(n_length):
total_each_digit += int(str_n[i])
if A <= total_each_digit <= B:... | 14 | 16 | 305 | 364 | N, A, B = list(map(int, input().split()))
target_total = 0
for n in range(1, N + 1):
total_each_digit = 0
n_length = len(str(n))
for i in range(n_length):
total_each_digit += int(str(n)[i])
if A <= total_each_digit <= B:
target_total += n
print(target_total)
| N, A, B = list(map(int, input().split()))
target_total = 0 # 加算対象の数値の和
for n in range(1, N + 1):
total_each_digit = 0 # 各位の和
str_n = str(n)
n_length = len(str_n) # nの桁数
for i in range(n_length):
total_each_digit += int(str_n[i])
if A <= total_each_digit <= B:
target_total += n
pri... | false | 12.5 | [
"-target_total = 0",
"+target_total = 0 # 加算対象の数値の和",
"- total_each_digit = 0",
"- n_length = len(str(n))",
"+ total_each_digit = 0 # 各位の和",
"+ str_n = str(n)",
"+ n_length = len(str_n) # nの桁数",
"- total_each_digit += int(str(n)[i])",
"+ total_each_digit += int(str_n[... | false | 0.045276 | 0.057594 | 0.78613 | [
"s445007635",
"s270355577"
] |
u444722572 | p02695 | python | s590750708 | s680440304 | 1,379 | 229 | 9,188 | 46,740 | Accepted | Accepted | 83.39 | import itertools
N,M,Q=list(map(int,input().split()))
a_b_c_d=[list(map(int,input().split())) for _ in range(Q)]
nums=[i for i in range(1,M+1)]
A_s=itertools.combinations_with_replacement(nums,N)
ans=0
for A in A_s:
tmp=0
for i in range(Q):
if A[a_b_c_d[i][1]-1]-A[a_b_c_d[i][0]-1]==a_b_c_d[i][2... | import sys
import itertools
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M, Q = list(map(int, readline().split()))
A = np.array(list(itertools.combinations_with_replacement(list(range(1, M + 1)), N)))
n = len(A)
score... | 14 | 20 | 394 | 487 | import itertools
N, M, Q = list(map(int, input().split()))
a_b_c_d = [list(map(int, input().split())) for _ in range(Q)]
nums = [i for i in range(1, M + 1)]
A_s = itertools.combinations_with_replacement(nums, N)
ans = 0
for A in A_s:
tmp = 0
for i in range(Q):
if A[a_b_c_d[i][1] - 1] - A[a_b_c_d[i][0] ... | import sys
import itertools
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M, Q = list(map(int, readline().split()))
A = np.array(list(itertools.combinations_with_replacement(list(range(1, M + 1)), N)))
n = len(A)
score = np.zeros(n, np.in... | false | 30 | [
"+import sys",
"+import numpy as np",
"-N, M, Q = list(map(int, input().split()))",
"-a_b_c_d = [list(map(int, input().split())) for _ in range(Q)]",
"-nums = [i for i in range(1, M + 1)]",
"-A_s = itertools.combinations_with_replacement(nums, N)",
"-ans = 0",
"-for A in A_s:",
"- tmp = 0",
"- ... | false | 0.047382 | 0.197648 | 0.239727 | [
"s590750708",
"s680440304"
] |
u572002343 | p03816 | python | s847529457 | s034811518 | 90 | 64 | 22,756 | 22,756 | Accepted | Accepted | 28.89 | from collections import defaultdict as dd
from functools import reduce
if __name__ == "__main__":
N = int(eval(input()))
arr = list(map(int, input().split()))
dic = dd(int)
for el in arr:
dic[el] += 1
count = len(dic) - len(list([x for x in list(dic.values()) if x %
... | from collections import Counter
from functools import reduce
if __name__ == "__main__":
N = int(eval(input()))
arr = list(map(int, input().split()))
dic = Counter(arr)
count = len(dic) - reduce(lambda sum, item: sum + 1, [x for x in list(dic.values()) if x % 2 == 0], 0) % 2
print(count)
| 15 | 10 | 368 | 304 | from collections import defaultdict as dd
from functools import reduce
if __name__ == "__main__":
N = int(eval(input()))
arr = list(map(int, input().split()))
dic = dd(int)
for el in arr:
dic[el] += 1
count = len(dic) - len(list([x for x in list(dic.values()) if x % 2 == 0])) % 2
print(... | from collections import Counter
from functools import reduce
if __name__ == "__main__":
N = int(eval(input()))
arr = list(map(int, input().split()))
dic = Counter(arr)
count = (
len(dic)
- reduce(
lambda sum, item: sum + 1, [x for x in list(dic.values()) if x % 2 == 0], 0
... | false | 33.333333 | [
"-from collections import defaultdict as dd",
"+from collections import Counter",
"- dic = dd(int)",
"- for el in arr:",
"- dic[el] += 1",
"- count = len(dic) - len(list([x for x in list(dic.values()) if x % 2 == 0])) % 2",
"+ dic = Counter(arr)",
"+ count = (",
"+ len(d... | false | 0.037814 | 0.038797 | 0.974663 | [
"s847529457",
"s034811518"
] |
u888092736 | p03634 | python | s800994110 | s597306017 | 643 | 446 | 61,348 | 47,604 | Accepted | Accepted | 30.64 | import sys
from collections import defaultdict
from heapq import heappush, heappop
def input():
return sys.stdin.readline().strip()
def dijkstra(adj_list, start):
n = len(adj_list)
dist = [float("inf")] * n
dist[start] = 0
pq = []
heappush(pq, (0, start))
visited = set()... | import sys
from collections import deque
def input():
return sys.stdin.readline().strip()
def bfs(start):
q = deque([start])
dist = [-1] * (N + 1)
dist[start] = 0
while q:
v = q.popleft()
for nv, nw in g[v]:
if dist[nv] > 0:
continue
... | 48 | 34 | 1,035 | 705 | import sys
from collections import defaultdict
from heapq import heappush, heappop
def input():
return sys.stdin.readline().strip()
def dijkstra(adj_list, start):
n = len(adj_list)
dist = [float("inf")] * n
dist[start] = 0
pq = []
heappush(pq, (0, start))
visited = set()
while pq:
... | import sys
from collections import deque
def input():
return sys.stdin.readline().strip()
def bfs(start):
q = deque([start])
dist = [-1] * (N + 1)
dist[start] = 0
while q:
v = q.popleft()
for nv, nw in g[v]:
if dist[nv] > 0:
continue
dist[n... | false | 29.166667 | [
"-from collections import defaultdict",
"-from heapq import heappush, heappop",
"+from collections import deque",
"-def dijkstra(adj_list, start):",
"- n = len(adj_list)",
"- dist = [float(\"inf\")] * n",
"+def bfs(start):",
"+ q = deque([start])",
"+ dist = [-1] * (N + 1)",
"- pq =... | false | 0.038864 | 0.040578 | 0.957746 | [
"s800994110",
"s597306017"
] |
u413021823 | p03106 | python | s522137493 | s305575745 | 170 | 70 | 38,512 | 64,900 | Accepted | Accepted | 58.82 | import sys
from itertools import combinations
import math
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
A, B, ... | import sys
from collections import deque
from itertools import *
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
... | 25 | 25 | 493 | 456 | import sys
from itertools import combinations
import math
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def S():
return sys.stdin.readline().rstrip()
def LS():
return list(sys.stdin.readline().rstrip().split())
A, B, K... | import sys
from collections import deque
from itertools import *
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def S():
return sys.stdin.readline().rstrip()
def LS():
return list(sys.stdin.readline().rstrip().split())
... | false | 0 | [
"-from itertools import combinations",
"-import math",
"+from collections import deque",
"+from itertools import *",
"-temp = 0",
"-for i in range(min(A, B), 0, -1):",
"+l = []",
"+for i in range(1, 100 + 1):",
"- temp += 1",
"- if temp == K:",
"- print(i)",
"- ... | false | 0.035925 | 0.053021 | 0.677565 | [
"s522137493",
"s305575745"
] |
u845573105 | p02735 | python | s399636670 | s309694386 | 35 | 29 | 3,192 | 3,188 | Accepted | Accepted | 17.14 | H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
vis = [[-1 for i in range(W)] for j in range(H)]
que = [(0,0)]
itr = 0
color = "."
if S[0][0]=="#":
itr=1
color="#"
vis[0][0]=itr
while len(que)>0:
v, h = que.pop(0)
itr = vis[v][h]
if itr%2==0:
color="."
els... | H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
vis = [[-1 for i in range(W)] for j in range(H)]
for v in range(H):
for h in range(W):
if v==0:
if h==0:
if S[v][h]=="#":
vis[v][h]=1
else:
vis[v][h]=0
else:
if S[v]... | 55 | 38 | 1,293 | 939 | H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
vis = [[-1 for i in range(W)] for j in range(H)]
que = [(0, 0)]
itr = 0
color = "."
if S[0][0] == "#":
itr = 1
color = "#"
vis[0][0] = itr
while len(que) > 0:
v, h = que.pop(0)
itr = vis[v][h]
if itr % 2 == 0:
color... | H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
vis = [[-1 for i in range(W)] for j in range(H)]
for v in range(H):
for h in range(W):
if v == 0:
if h == 0:
if S[v][h] == "#":
vis[v][h] = 1
else:
... | false | 30.909091 | [
"-que = [(0, 0)]",
"-itr = 0",
"-color = \".\"",
"-if S[0][0] == \"#\":",
"- itr = 1",
"- color = \"#\"",
"-vis[0][0] = itr",
"-while len(que) > 0:",
"- v, h = que.pop(0)",
"- itr = vis[v][h]",
"- if itr % 2 == 0:",
"- color = \".\"",
"- else:",
"- color = \... | false | 0.035939 | 0.045645 | 0.787351 | [
"s399636670",
"s309694386"
] |
u607563136 | p02676 | python | s774954632 | s762317658 | 29 | 25 | 9,012 | 9,056 | Accepted | Accepted | 13.79 | k = int(eval(input()))
s = eval(input())
if len(s) <= k:
print(s)
else:
print(("{}...".format(s[:k]))) | k = int(eval(input()))
s = eval(input())
print((s if len(s)<=k else s[:k]+"...")) | 7 | 3 | 103 | 69 | k = int(eval(input()))
s = eval(input())
if len(s) <= k:
print(s)
else:
print(("{}...".format(s[:k])))
| k = int(eval(input()))
s = eval(input())
print((s if len(s) <= k else s[:k] + "..."))
| false | 57.142857 | [
"-if len(s) <= k:",
"- print(s)",
"-else:",
"- print((\"{}...\".format(s[:k])))",
"+print((s if len(s) <= k else s[:k] + \"...\"))"
] | false | 0.037941 | 0.046244 | 0.820453 | [
"s774954632",
"s762317658"
] |
u040298438 | p02647 | python | s325432367 | s702540236 | 1,214 | 668 | 125,320 | 129,968 | Accepted | Accepted | 44.98 | import numpy as np
from numba import njit
@njit
def myfunc(n, k, A):
for _ in range(k):
l = np.zeros((n + 1,), dtype=np.int64)
for i, a in enumerate(A[:-1]):
l[max(0, i - a)] += 1
l[min(n, i + a + 1)] -= 1
A = np.cumsum(l)
if np.all(A[:-1] == n):... | import numpy as np
from numba import jit, i8
@jit(i8[:](i8, i8, i8[:]), nopython=True, cache=True)
def myfunc(n, k, A):
for _ in range(k):
l = np.zeros((n + 1,), dtype=np.int64)
for i, a in enumerate(A[:-1]):
l[max(0, i - a)] += 1
l[min(n, i + a + 1)] -= 1
... | 26 | 26 | 578 | 629 | import numpy as np
from numba import njit
@njit
def myfunc(n, k, A):
for _ in range(k):
l = np.zeros((n + 1,), dtype=np.int64)
for i, a in enumerate(A[:-1]):
l[max(0, i - a)] += 1
l[min(n, i + a + 1)] -= 1
A = np.cumsum(l)
if np.all(A[:-1] == n):
... | import numpy as np
from numba import jit, i8
@jit(i8[:](i8, i8, i8[:]), nopython=True, cache=True)
def myfunc(n, k, A):
for _ in range(k):
l = np.zeros((n + 1,), dtype=np.int64)
for i, a in enumerate(A[:-1]):
l[max(0, i - a)] += 1
l[min(n, i + a + 1)] -= 1
A = np.cu... | false | 0 | [
"-from numba import njit",
"+from numba import jit, i8",
"-@njit",
"+@jit(i8[:](i8, i8, i8[:]), nopython=True, cache=True)"
] | false | 0.195855 | 0.198407 | 0.987135 | [
"s325432367",
"s702540236"
] |
u252828980 | p02623 | python | s720569804 | s266673299 | 280 | 250 | 40,444 | 40,392 | Accepted | Accepted | 10.71 | n,m,k = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
for i in range(1,n):
a[i] += a[i-1]
for i in range(1,m):
b[i] += b[i-1]
a = [0]+a
b = [0]+b
ans = 0
ALL = 0
j = m
for i in range(n+1):
if a[i] > k:
continue
else:
... | a,b,k = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
from itertools import accumulate
A = list(accumulate(A))
B = list(accumulate(B))
A = [0] + A
B = [0] + B
ans = 0
num = b
for i in range(a+1):
if A[i] > k:
continue
while True :... | 22 | 23 | 394 | 446 | n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(1, n):
a[i] += a[i - 1]
for i in range(1, m):
b[i] += b[i - 1]
a = [0] + a
b = [0] + b
ans = 0
ALL = 0
j = m
for i in range(n + 1):
if a[i] > k:
continue
else:
... | a, b, k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
from itertools import accumulate
A = list(accumulate(A))
B = list(accumulate(B))
A = [0] + A
B = [0] + B
ans = 0
num = b
for i in range(a + 1):
if A[i] > k:
continue
while True:
if ... | false | 4.347826 | [
"-n, m, k = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"-for i in range(1, n):",
"- a[i] += a[i - 1]",
"-for i in range(1, m):",
"- b[i] += b[i - 1]",
"-a = [0] + a",
"-b = [0] + b",
"+a, b, k = list(map(int, input().spli... | false | 0.04325 | 0.045836 | 0.943584 | [
"s720569804",
"s266673299"
] |
u556589653 | p02766 | python | s446645950 | s231517996 | 691 | 17 | 18,864 | 3,060 | Accepted | Accepted | 97.54 | import numpy as np
N,K = list(map(int,input().split()))
print((len(np.base_repr(N,K)))) | N,K = list(map(int,input().split()))
a = N
ans = []
solve = ""
while a>=K:
ans.append(a%K)
a = a//K
ans.append(a)
print((len(ans))) | 3 | 9 | 84 | 135 | import numpy as np
N, K = list(map(int, input().split()))
print((len(np.base_repr(N, K))))
| N, K = list(map(int, input().split()))
a = N
ans = []
solve = ""
while a >= K:
ans.append(a % K)
a = a // K
ans.append(a)
print((len(ans)))
| false | 66.666667 | [
"-import numpy as np",
"-",
"-print((len(np.base_repr(N, K))))",
"+a = N",
"+ans = []",
"+solve = \"\"",
"+while a >= K:",
"+ ans.append(a % K)",
"+ a = a // K",
"+ans.append(a)",
"+print((len(ans)))"
] | false | 0.43101 | 0.035312 | 12.205924 | [
"s446645950",
"s231517996"
] |
u440566786 | p02665 | python | s365965241 | s606974879 | 411 | 74 | 83,568 | 83,604 | Accepted | Accepted | 82 | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
s = sum(A)
if n == 0:
print((1 if A[0] == 1 else -1))
return
i... | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
res = 0
not_leaf = 1
s = sum(A)
count = 1
for d in range(n + 1):
... | 41 | 25 | 864 | 570 | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
s = sum(A)
if n == 0:
print((1 if A[0] == 1 else -1))
return
if A[0] != 0... | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
res = 0
not_leaf = 1
s = sum(A)
count = 1
for d in range(n + 1):
res += n... | false | 39.02439 | [
"+ res = 0",
"+ not_leaf = 1",
"- if n == 0:",
"- print((1 if A[0] == 1 else -1))",
"- return",
"- if A[0] != 0:",
"- print((-1))",
"- return",
"- not_leaf = 1",
"- # check",
"+ count = 1",
"+ res += not_leaf",
"- not_leaf *= 2",... | false | 0.037442 | 0.04576 | 0.818223 | [
"s365965241",
"s606974879"
] |
u077291787 | p02813 | python | s376349722 | s066621523 | 32 | 27 | 3,060 | 8,052 | Accepted | Accepted | 15.62 | # ABC150C - Count Order
from itertools import permutations
def main():
N, *PQ = list(map(int, open(0).read().split()))
P, Q = PQ[:N], PQ[N:]
a, b = 0, 0
for i, perm in enumerate(permutations(list(range(1, N + 1)), N), 1):
perm = list(perm)
if perm == P:
a = i
... | # ABC150C - Count Order
from itertools import permutations
def main():
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
perms = list(permutations(list(range(1, N + 1))))
ans = abs(perms.index(P) - perms.index(Q))
print(ans)
if __na... | 20 | 15 | 429 | 340 | # ABC150C - Count Order
from itertools import permutations
def main():
N, *PQ = list(map(int, open(0).read().split()))
P, Q = PQ[:N], PQ[N:]
a, b = 0, 0
for i, perm in enumerate(permutations(list(range(1, N + 1)), N), 1):
perm = list(perm)
if perm == P:
a = i
if per... | # ABC150C - Count Order
from itertools import permutations
def main():
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
perms = list(permutations(list(range(1, N + 1))))
ans = abs(perms.index(P) - perms.index(Q))
print(ans)
if __name__ == "__ma... | false | 25 | [
"- N, *PQ = list(map(int, open(0).read().split()))",
"- P, Q = PQ[:N], PQ[N:]",
"- a, b = 0, 0",
"- for i, perm in enumerate(permutations(list(range(1, N + 1)), N), 1):",
"- perm = list(perm)",
"- if perm == P:",
"- a = i",
"- if perm == Q:",
"- ... | false | 0.040732 | 0.038253 | 1.064792 | [
"s376349722",
"s066621523"
] |
u332906195 | p02762 | python | s768615320 | s257054962 | 1,862 | 1,646 | 128,084 | 66,464 | Accepted | Accepted | 11.6 | class UnionFind:
def __init__(self, n):
# parent[x] < 0 means x is root and abs(parent[x]) == size[x]
self.parent, self.depth = [-1] * n, [0] * n
def find(self, x):
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[x]... | class UnionFind:
def __init__(self, n):
self.p, self.d = [-1] * n, [0] * n
def find(self, x):
if self.p[x] < 0:
return x
else:
self.p[x] = self.find(self.p[x])
return self.p[x]
def isSame(self, x, y):
return self.find(x) == ... | 55 | 52 | 1,554 | 1,335 | class UnionFind:
def __init__(self, n):
# parent[x] < 0 means x is root and abs(parent[x]) == size[x]
self.parent, self.depth = [-1] * n, [0] * n
def find(self, x):
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[x])
... | class UnionFind:
def __init__(self, n):
self.p, self.d = [-1] * n, [0] * n
def find(self, x):
if self.p[x] < 0:
return x
else:
self.p[x] = self.find(self.p[x])
return self.p[x]
def isSame(self, x, y):
return self.find(x) == self.find(y)
... | false | 5.454545 | [
"- # parent[x] < 0 means x is root and abs(parent[x]) == size[x]",
"- self.parent, self.depth = [-1] * n, [0] * n",
"+ self.p, self.d = [-1] * n, [0] * n",
"- if self.parent[x] < 0:",
"+ if self.p[x] < 0:",
"- self.parent[x] = self.find(self.parent[x])",
"- ... | false | 0.089271 | 0.048816 | 1.828746 | [
"s768615320",
"s257054962"
] |
u644907318 | p02633 | python | s373427998 | s980388274 | 64 | 28 | 61,940 | 9,160 | Accepted | Accepted | 56.25 | def gcd(x,y):
while y>0:
x,y = y,x%y
return x
X = int(eval(input()))
a = gcd(X,360)
Y = (X//a)*360
print((Y//X)) | def gcd(x,y):
while y>0:
x,y = y,x%y
return x
X = int(eval(input()))
a = gcd(360,X)
b = (X//a)*360
print((b//X)) | 8 | 8 | 127 | 127 | def gcd(x, y):
while y > 0:
x, y = y, x % y
return x
X = int(eval(input()))
a = gcd(X, 360)
Y = (X // a) * 360
print((Y // X))
| def gcd(x, y):
while y > 0:
x, y = y, x % y
return x
X = int(eval(input()))
a = gcd(360, X)
b = (X // a) * 360
print((b // X))
| false | 0 | [
"-a = gcd(X, 360)",
"-Y = (X // a) * 360",
"-print((Y // X))",
"+a = gcd(360, X)",
"+b = (X // a) * 360",
"+print((b // X))"
] | false | 0.035515 | 0.041071 | 0.864723 | [
"s373427998",
"s980388274"
] |
u076917070 | p02900 | python | s421541677 | s389989781 | 293 | 166 | 7,252 | 3,064 | Accepted | Accepted | 43.34 | import sys
input=sys.stdin.readline
import fractions
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
return divisors
import math
def prime_factorize(n... | import sys
input=sys.stdin.readline
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)
re... | 46 | 26 | 920 | 503 | import sys
input = sys.stdin.readline
import fractions
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
return divisors
import math
def prime_factorize(n):
... | import sys
input = sys.stdin.readline
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
def ... | false | 43.478261 | [
"-import fractions",
"-",
"-",
"-def make_divisors(n):",
"- divisors = []",
"- for i in range(1, int(n**0.5) + 1):",
"- if n % i == 0:",
"- divisors.append(i)",
"- if i != n // i:",
"- divisors.append(n // i)",
"- return divisors",
"-",
"-... | false | 0.070538 | 0.046804 | 1.507095 | [
"s421541677",
"s389989781"
] |
u631755487 | p02693 | python | s174403205 | s206884897 | 22 | 20 | 9,172 | 9,084 | Accepted | Accepted | 9.09 | k = int(eval(input()))
a, b = list(map(int, input().split()))
if k == 1:
print("OK")
else:
if b//k - a//k == 0 and a%k != 0:
print("NG")
else:
print("OK") | k = int(eval(input()))
a, b = list(map(int, input().split()))
if b//k - a//k == 0 and a%k != 0:
print('NG')
else:
print('OK') | 9 | 7 | 164 | 124 | k = int(eval(input()))
a, b = list(map(int, input().split()))
if k == 1:
print("OK")
else:
if b // k - a // k == 0 and a % k != 0:
print("NG")
else:
print("OK")
| k = int(eval(input()))
a, b = list(map(int, input().split()))
if b // k - a // k == 0 and a % k != 0:
print("NG")
else:
print("OK")
| false | 22.222222 | [
"-if k == 1:",
"+if b // k - a // k == 0 and a % k != 0:",
"+ print(\"NG\")",
"+else:",
"-else:",
"- if b // k - a // k == 0 and a % k != 0:",
"- print(\"NG\")",
"- else:",
"- print(\"OK\")"
] | false | 0.116129 | 0.045926 | 2.528618 | [
"s174403205",
"s206884897"
] |
u143903328 | p03160 | python | s672092050 | s629304476 | 555 | 193 | 466,376 | 13,924 | Accepted | Accepted | 65.23 | ##https://atcoder.jp/contests/dp/tasks/dp_a
N = int(eval(input()))
##N, M = map(int, input().split())
H = list(map(int, input().split()))
F = [0]*N#それぞれに対する回答を格納する箇所
C = [0]*N#Nに飛ぶ時の最小コストの格納
F[0] = 1
F[1] = 1
C[0] = 0
C[1] = abs(H[0] - H[1])
for i in range(2, N):
if C[i-2] + abs(H[i] - H[i-2]) > ... | ##https://atcoder.jp/contests/dp/tasks/dp_a
N = int(eval(input()))
##N, M = map(int, input().split())
H = list(map(int, input().split()))
C = [0]*N#Nに飛ぶ時の最小コストの格納
C[0] = 0
C[1] = abs(H[0] - H[1])
for i in range(2, N):
if C[i-2] + abs(H[i] - H[i-2]) > C[i-1] + abs(H[i] - H[i-1]):
C[i] = C[... | 25 | 20 | 656 | 531 | ##https://atcoder.jp/contests/dp/tasks/dp_a
N = int(eval(input()))
##N, M = map(int, input().split())
H = list(map(int, input().split()))
F = [0] * N # それぞれに対する回答を格納する箇所
C = [0] * N # Nに飛ぶ時の最小コストの格納
F[0] = 1
F[1] = 1
C[0] = 0
C[1] = abs(H[0] - H[1])
for i in range(2, N):
if C[i - 2] + abs(H[i] - H[i - 2]) > C[i -... | ##https://atcoder.jp/contests/dp/tasks/dp_a
N = int(eval(input()))
##N, M = map(int, input().split())
H = list(map(int, input().split()))
C = [0] * N # Nに飛ぶ時の最小コストの格納
C[0] = 0
C[1] = abs(H[0] - H[1])
for i in range(2, N):
if C[i - 2] + abs(H[i] - H[i - 2]) > C[i - 1] + abs(H[i] - H[i - 1]):
C[i] = C[i - 1]... | false | 20 | [
"-F = [0] * N # それぞれに対する回答を格納する箇所",
"-F[0] = 1",
"-F[1] = 1",
"- F[i] = F[i - 1]",
"- F[i] = F[i - 2]",
"- F[i] = F[i - 2] + F[i - 1]"
] | false | 0.041215 | 0.041184 | 1.000752 | [
"s672092050",
"s629304476"
] |
u263830634 | p03608 | python | s567171879 | s943922200 | 614 | 384 | 25,688 | 42,460 | Accepted | Accepted | 37.46 | import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations
N, M, R = list(map(int, input().split()))
r = list(input().split())
edge = np.array([input().split() for _ in range(M)], dtype = np.int64).T
graph = csr_matrix((edge[2], (ed... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7
from itertools import permutations
N, M, r = list(map(int, input().split()))
R = list(map(int, input().split()))
INF = 10 ** 9
G = [[INF] * (N + 1) for _ in range(N + 1)]
for i in range(N + 1):
G[i][i] = 0
fo... | 27 | 34 | 689 | 714 | import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations
N, M, R = list(map(int, input().split()))
r = list(input().split())
edge = np.array([input().split() for _ in range(M)], dtype=np.int64).T
graph = csr_matrix((edge[2], (edge[:2] - 1... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9 + 7
from itertools import permutations
N, M, r = list(map(int, input().split()))
R = list(map(int, input().split()))
INF = 10**9
G = [[INF] * (N + 1) for _ in range(N + 1)]
for i in range(N + 1):
G[i][i] = 0
for _ in range(M):
A, B... | false | 20.588235 | [
"-import numpy as np",
"-from scipy.sparse import csr_matrix",
"-from scipy.sparse.csgraph import floyd_warshall",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**9)",
"+MOD = 10**9 + 7",
"-N, M, R = list(map(int, input().split()))",
"-r = list(input().split())",
"... | false | 0.233023 | 0.036395 | 6.402566 | [
"s567171879",
"s943922200"
] |
u692336506 | p03494 | python | s798052276 | s693514073 | 32 | 28 | 9,092 | 9,140 | Accepted | Accepted | 12.5 | N = int(eval(input()))
A = list(map(int, input().split()))
# 操作回数
counter = 0
# 操作が行えなくなるまで操作を行う
while True:
# // 操作が行えるかどうかを判定する
can_do = True
for i in range(N):
if A[i] % 2 == 1:
can_do = False
# 操作を行えないならば、ループを打ち切る
if not can_do:
break
# 操作を行え... | N = int(eval(input()))
A = list(map(int, input().split()))
counter = 0
while not 1 in [a % 2 for a in A]:
A = [a // 2 for a in A]
counter += 1
print(counter) | 26 | 8 | 425 | 167 | N = int(eval(input()))
A = list(map(int, input().split()))
# 操作回数
counter = 0
# 操作が行えなくなるまで操作を行う
while True:
# // 操作が行えるかどうかを判定する
can_do = True
for i in range(N):
if A[i] % 2 == 1:
can_do = False
# 操作を行えないならば、ループを打ち切る
if not can_do:
break
# 操作を行えるならば、操作を行う
for i i... | N = int(eval(input()))
A = list(map(int, input().split()))
counter = 0
while not 1 in [a % 2 for a in A]:
A = [a // 2 for a in A]
counter += 1
print(counter)
| false | 69.230769 | [
"-# 操作回数",
"-# 操作が行えなくなるまで操作を行う",
"-while True:",
"- # // 操作が行えるかどうかを判定する",
"- can_do = True",
"- for i in range(N):",
"- if A[i] % 2 == 1:",
"- can_do = False",
"- # 操作を行えないならば、ループを打ち切る",
"- if not can_do:",
"- break",
"- # 操作を行えるならば、操作を行う",
"- ... | false | 0.041379 | 0.04169 | 0.992541 | [
"s798052276",
"s693514073"
] |
u111365362 | p03038 | python | s457261079 | s988127057 | 931 | 776 | 82,200 | 88,820 | Accepted | Accepted | 16.65 | n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
a.sort()
d = []
for _ in range(m):
b,c = list(map(int,input().split()))
d.append([c,b])
d.sort(reverse = True)
e = []
f = 0
for j in range(m):
for k in range(d[j][1]):
e.append(d[j][0])
f += 1
if f == n:
break... | #15:40
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
a.sort()
bc = []
for _ in range(m):
bc.append(list(map(int,input().split())))
bc.sort(key=lambda x: -x[1])
d = []
dl = 0
for x in bc:
b,c = x
d += [c] * b
dl += b
if dl >= n:
break
if dl < n:
d += [0] * (n-dl... | 27 | 25 | 460 | 427 | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
d = []
for _ in range(m):
b, c = list(map(int, input().split()))
d.append([c, b])
d.sort(reverse=True)
e = []
f = 0
for j in range(m):
for k in range(d[j][1]):
e.append(d[j][0])
f += 1
if f == n:
... | # 15:40
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
bc = []
for _ in range(m):
bc.append(list(map(int, input().split())))
bc.sort(key=lambda x: -x[1])
d = []
dl = 0
for x in bc:
b, c = x
d += [c] * b
dl += b
if dl >= n:
break
if dl < n:
d += [0] * ... | false | 7.407407 | [
"+# 15:40",
"+bc = []",
"+for _ in range(m):",
"+ bc.append(list(map(int, input().split())))",
"+bc.sort(key=lambda x: -x[1])",
"-for _ in range(m):",
"- b, c = list(map(int, input().split()))",
"- d.append([c, b])",
"-d.sort(reverse=True)",
"-e = []",
"-f = 0",
"-for j in range(m):",... | false | 0.038084 | 0.037245 | 1.022511 | [
"s457261079",
"s988127057"
] |
u693933222 | p02954 | python | s459568688 | s047915115 | 224 | 140 | 6,672 | 4,468 | Accepted | Accepted | 37.5 | S = input()
S = S[1:-1]
#print(S)
S = S.split("LR")
ans = []
for i in range(len(S)):
tp = "R" + S[i] + "L"
#print(tp)
rn = len(tp.split("RL")[0])+1
ln = len(tp) - rn
#print(rn,ln)
for k in range(rn-1):
ans.append(0)
ans.append(-(-rn//2) + ln//2)
ans.append(-(-ln/... | S = eval(input())
S = S[1:-1]
#print(S)
S = S.split("LR")
ans = ""
for i in range(len(S)):
tp = "R" + S[i] + "L"
#print(tp)
rn = len(tp.split("RL")[0])+1
ln = len(tp) - rn
#print(rn,ln)
for k in range(rn-1):
ans += "0 "
ans += str(-(-rn//2) + ln//2) +" "
ans += s... | 23 | 22 | 461 | 427 | S = input()
S = S[1:-1]
# print(S)
S = S.split("LR")
ans = []
for i in range(len(S)):
tp = "R" + S[i] + "L"
# print(tp)
rn = len(tp.split("RL")[0]) + 1
ln = len(tp) - rn
# print(rn,ln)
for k in range(rn - 1):
ans.append(0)
ans.append(-(-rn // 2) + ln // 2)
ans.append(-(-ln // 2) ... | S = eval(input())
S = S[1:-1]
# print(S)
S = S.split("LR")
ans = ""
for i in range(len(S)):
tp = "R" + S[i] + "L"
# print(tp)
rn = len(tp.split("RL")[0]) + 1
ln = len(tp) - rn
# print(rn,ln)
for k in range(rn - 1):
ans += "0 "
ans += str(-(-rn // 2) + ln // 2) + " "
ans += str(-(... | false | 4.347826 | [
"-S = input()",
"+S = eval(input())",
"-ans = []",
"+ans = \"\"",
"- ans.append(0)",
"- ans.append(-(-rn // 2) + ln // 2)",
"- ans.append(-(-ln // 2) + rn // 2)",
"+ ans += \"0 \"",
"+ ans += str(-(-rn // 2) + ln // 2) + \" \"",
"+ ans += str(-(-ln // 2) + rn // 2) + \" \... | false | 0.03403 | 0.033632 | 1.011829 | [
"s459568688",
"s047915115"
] |
u777923818 | p03289 | python | s443001047 | s718609889 | 20 | 17 | 3,316 | 3,060 | Accepted | Accepted | 15 | from collections import Counter
S = eval(input())
C = Counter(S[2:-1])
patience = 1
for s in S[1:]:
if s == "C" and patience:
patience -= 1
continue
if s.isupper():
print("WA")
exit()
if S[0] == "A" and C["C"] == 1:
print("AC")
else:
print("WA") | def inpl(): return list(map(int, input().split()))
S = eval(input())
ok = False
if S[0] == "A" and S[2:-1].count("C") == 1:
u = 0
for s in S[1:]:
u += s.isupper()
if u == 1:
ok = True
if (ok):
print("AC")
else:
print("WA") | 16 | 13 | 303 | 264 | from collections import Counter
S = eval(input())
C = Counter(S[2:-1])
patience = 1
for s in S[1:]:
if s == "C" and patience:
patience -= 1
continue
if s.isupper():
print("WA")
exit()
if S[0] == "A" and C["C"] == 1:
print("AC")
else:
print("WA")
| def inpl():
return list(map(int, input().split()))
S = eval(input())
ok = False
if S[0] == "A" and S[2:-1].count("C") == 1:
u = 0
for s in S[1:]:
u += s.isupper()
if u == 1:
ok = True
if ok:
print("AC")
else:
print("WA")
| false | 18.75 | [
"-from collections import Counter",
"+def inpl():",
"+ return list(map(int, input().split()))",
"+",
"-C = Counter(S[2:-1])",
"-patience = 1",
"-for s in S[1:]:",
"- if s == \"C\" and patience:",
"- patience -= 1",
"- continue",
"- if s.isupper():",
"- print(\"WA\... | false | 0.093407 | 0.045956 | 2.03253 | [
"s443001047",
"s718609889"
] |
u057109575 | p03221 | python | s634975269 | s761136088 | 624 | 544 | 47,328 | 112,520 | Accepted | Accepted | 12.82 | N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
ans = [''] * M
num = [1] * N
for i, v in sorted(enumerate(X), key=lambda x: (x[1][0], x[1][1])):
ans[i] = '{:06}{:06}'.format(v[0], num[v[0] - 1])
num[v[0] - 1] += 1
print(('\n'.join(ans))) |
N, M = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(M)]
res = [""] * M
ctr = [0] * (N + 1)
for i, (p, y) in sorted(enumerate(X), key=lambda x: (x[1][0], x[1][1])):
ctr[p] += 1
res[i] = "{:0>6}{:0>6}".format(p, ctr[p])
print(*res, sep="\n")
| 10 | 11 | 299 | 294 | N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(M)]
ans = [""] * M
num = [1] * N
for i, v in sorted(enumerate(X), key=lambda x: (x[1][0], x[1][1])):
ans[i] = "{:06}{:06}".format(v[0], num[v[0] - 1])
num[v[0] - 1] += 1
print(("\n".join(ans)))
| N, M = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(M)]
res = [""] * M
ctr = [0] * (N + 1)
for i, (p, y) in sorted(enumerate(X), key=lambda x: (x[1][0], x[1][1])):
ctr[p] += 1
res[i] = "{:0>6}{:0>6}".format(p, ctr[p])
print(*res, sep="\n")
| false | 9.090909 | [
"-N, M = list(map(int, input().split()))",
"+N, M = map(int, input().split())",
"-ans = [\"\"] * M",
"-num = [1] * N",
"-for i, v in sorted(enumerate(X), key=lambda x: (x[1][0], x[1][1])):",
"- ans[i] = \"{:06}{:06}\".format(v[0], num[v[0] - 1])",
"- num[v[0] - 1] += 1",
"-print((\"\\n\".join(an... | false | 0.035669 | 0.042198 | 0.84527 | [
"s634975269",
"s761136088"
] |
u545368057 | p03212 | python | s472506289 | s542764442 | 85 | 55 | 3,316 | 3,064 | Accepted | Accepted | 35.29 | from collections import deque
N = int(eval(input()))
stack = deque(["0"])
cnt = 0
while len(stack)>0:
c = stack.pop()
for s in "357":
cs = c + s
# print(cs)
if int(cs)<=N:
stack.append(cs)
if cs.count("3")*cs.count("5")*cs.count("7")>0:
... | """
dfsでとき直し114
7,5,3がそれぞれ1回以上現れる
3-3-3
-5
-7
-5-3
-5
-7
-7-3
-5
-7
とかそういうヤツ
3 33 35 37 5
"""
import sys
sys.setrecursionlimit(100000)
cnt = 0
num = "0"
X = int(eval(input()))
def dfs(num,is3,is5,is7):
# print(num,is3 and is5 and is7)
global cnt
if is3 and... | 14 | 42 | 335 | 634 | from collections import deque
N = int(eval(input()))
stack = deque(["0"])
cnt = 0
while len(stack) > 0:
c = stack.pop()
for s in "357":
cs = c + s
# print(cs)
if int(cs) <= N:
stack.append(cs)
if cs.count("3") * cs.count("5") * cs.count("7") > 0:
... | """
dfsでとき直し114
7,5,3がそれぞれ1回以上現れる
3-3-3
-5
-7
-5-3
-5
-7
-7-3
-5
-7
とかそういうヤツ
3 33 35 37 5
"""
import sys
sys.setrecursionlimit(100000)
cnt = 0
num = "0"
X = int(eval(input()))
def dfs(num, is3, is5, is7):
# print(num,is3 and is5 and is7)
global cnt
if is3 and is5 and is7:
cnt... | false | 66.666667 | [
"-from collections import deque",
"+\"\"\"",
"+dfsでとき直し114",
"+7,5,3がそれぞれ1回以上現れる",
"+3-3-3",
"+ -5",
"+ -7",
"+ -5-3",
"+ -5",
"+ -7",
"+ -7-3",
"+ -5",
"+ -7",
"+とかそういうヤツ",
"+3 33 35 37 5",
"+\"\"\"",
"+import sys",
"-N = int(eval(input()))",
"-stack = deque([\"0\"])... | false | 0.048241 | 0.055266 | 0.872882 | [
"s472506289",
"s542764442"
] |
u203843959 | p02596 | python | s180921984 | s170759188 | 81 | 72 | 63,196 | 63,316 | Accepted | Accepted | 11.11 | import sys
K=int(eval(input()))
if K%2==0 or K%5==0:
print((-1))
sys.exit(0)
k_mod=0
seven_k=0
for i in range(1,K+1):
k_mod=10*k_mod+7
k_mod%=K
if k_mod==0:
print(i)
break
else:
print((-1)) | K=int(eval(input()))
k_mod=0
for i in range(1,K+1):
k_mod=(10*k_mod+7)%K
if k_mod==0:
print(i)
break
else:
print((-1)) | 17 | 10 | 217 | 134 | import sys
K = int(eval(input()))
if K % 2 == 0 or K % 5 == 0:
print((-1))
sys.exit(0)
k_mod = 0
seven_k = 0
for i in range(1, K + 1):
k_mod = 10 * k_mod + 7
k_mod %= K
if k_mod == 0:
print(i)
break
else:
print((-1))
| K = int(eval(input()))
k_mod = 0
for i in range(1, K + 1):
k_mod = (10 * k_mod + 7) % K
if k_mod == 0:
print(i)
break
else:
print((-1))
| false | 41.176471 | [
"-import sys",
"-",
"-if K % 2 == 0 or K % 5 == 0:",
"- print((-1))",
"- sys.exit(0)",
"-seven_k = 0",
"- k_mod = 10 * k_mod + 7",
"- k_mod %= K",
"+ k_mod = (10 * k_mod + 7) % K"
] | false | 0.090696 | 0.095418 | 0.950518 | [
"s180921984",
"s170759188"
] |
u631277801 | p03209 | python | s082374559 | s399220633 | 19 | 17 | 3,064 | 3,064 | Accepted | Accepted | 10.53 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.re... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x) - 1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.r... | 40 | 46 | 1,116 | 1,034 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 13.043478 | [
"-sys.setrecursionlimit(10**5)",
"+sys.setrecursionlimit(10**7)",
"-n, x = li()",
"-top = [4 * pow(2, i) - 3 for i in range(n + 1)]",
"-med = [pow(2, i + 1) - 1 for i in range(n + 1)]",
"-bot = [1 for _ in range(n + 1)]",
"+def rec(n: int, x: int, a: list, p: list) -> int:",
"+ if x <= 0:",
"+ ... | false | 0.068716 | 0.070767 | 0.971023 | [
"s082374559",
"s399220633"
] |
u788137651 | p03069 | python | s004011809 | s947771976 | 843 | 721 | 25,848 | 18,356 | Accepted | Accepted | 14.47 | from numpy import cumsum
N = int(eval(input()))
S = eval(input())
ss = S.replace("#", "1").replace(".", "0")
* ls, = list(map(int, ss))
cum_ls = cumsum(ls)
first_black = -1
last_black = N
for i in range(N):
if S[i] == "#":
first_black = i
break
for i in reversed(list(range(N))):
i... | from numpy import cumsum
N = int(eval(input()))
S = eval(input())
# 黒を1,白を0として リスト化
ss = S.replace("#", "1").replace(".", "0")
* ls, = list(map(int, ss))
# 累積和
cum_ls = cumsum(ls)
# 左から何個目に初めてblackが出てくるか
first_black = -1
for i in range(N):
if S[i] == "#":
first_black = i
break
... | 32 | 39 | 773 | 826 | from numpy import cumsum
N = int(eval(input()))
S = eval(input())
ss = S.replace("#", "1").replace(".", "0")
(*ls,) = list(map(int, ss))
cum_ls = cumsum(ls)
first_black = -1
last_black = N
for i in range(N):
if S[i] == "#":
first_black = i
break
for i in reversed(list(range(N))):
if S[i] == "#"... | from numpy import cumsum
N = int(eval(input()))
S = eval(input())
# 黒を1,白を0として リスト化
ss = S.replace("#", "1").replace(".", "0")
(*ls,) = list(map(int, ss))
# 累積和
cum_ls = cumsum(ls)
# 左から何個目に初めてblackが出てくるか
first_black = -1
for i in range(N):
if S[i] == "#":
first_black = i
break
# blackが後ろから何個まで続いてい... | false | 17.948718 | [
"+# 黒を1,白を0として リスト化",
"+# 累積和",
"+# 左から何個目に初めてblackが出てくるか",
"-last_black = N",
"+# blackが後ろから何個まで続いているか",
"+last_black = N",
"- # print(cum_ls)",
"- mans = 10**10",
"+ # i番目より左をすべて白、それより右をすべて黒にしたとき何回塗り替えるか",
"+ ans_temp = 10**10",
"- # print(\" \", cum_ls[i], (N-(i+1) - (cum_... | false | 0.153497 | 0.154333 | 0.994586 | [
"s004011809",
"s947771976"
] |
u952708174 | p03240 | python | s496099438 | s113029729 | 200 | 28 | 3,064 | 3,064 | Accepted | Accepted | 86 | def c_pyramid(N, Pos):
from itertools import product
# 中心座標を全探索
for cx, cy in product(list(range(101)), repeat=2):
# ピラミッドの高さを求める
for x, y, h in Pos:
if h > 0:
height = h + abs(cx - x) + abs(cy - y)
# ピラミッドの高さが得られた情報に適合するか調べる
for x, y, h i... | def c_pyramid():
N = int(eval(input()))
Pos = [[int(i) for i in input().split()] for j in range(N)]
# 与えられた情報から頂点座標を一意に得られるので、h=0にならない
x, y, h = sorted(Pos, key=lambda x: x[2])[-1]
# 中心座標を全探索
for cx in range(101):
for cy in range(101):
# 頂点の高さ height を決めたとき、すべての座標の情報と... | 21 | 16 | 641 | 617 | def c_pyramid(N, Pos):
from itertools import product
# 中心座標を全探索
for cx, cy in product(list(range(101)), repeat=2):
# ピラミッドの高さを求める
for x, y, h in Pos:
if h > 0:
height = h + abs(cx - x) + abs(cy - y)
# ピラミッドの高さが得られた情報に適合するか調べる
for x, y, h in Pos:
... | def c_pyramid():
N = int(eval(input()))
Pos = [[int(i) for i in input().split()] for j in range(N)]
# 与えられた情報から頂点座標を一意に得られるので、h=0にならない
x, y, h = sorted(Pos, key=lambda x: x[2])[-1]
# 中心座標を全探索
for cx in range(101):
for cy in range(101):
# 頂点の高さ height を決めたとき、すべての座標の情報と一致するか?
... | false | 23.809524 | [
"-def c_pyramid(N, Pos):",
"- from itertools import product",
"-",
"+def c_pyramid():",
"+ N = int(eval(input()))",
"+ Pos = [[int(i) for i in input().split()] for j in range(N)]",
"+ # 与えられた情報から頂点座標を一意に得られるので、h=0にならない",
"+ x, y, h = sorted(Pos, key=lambda x: x[2])[-1]",
"- for cx,... | false | 0.044617 | 0.039209 | 1.137921 | [
"s496099438",
"s113029729"
] |
u977389981 | p03147 | python | s040562131 | s583019906 | 20 | 18 | 3,060 | 2,940 | Accepted | Accepted | 10 | n = int(eval(input()))
H = [int(i) for i in input().split()]
count = 0
for _ in range(100):
flag = 1
for i in range(n):
if H[i] > 0:
H[i] -= 1
if flag:
count += 1
flag = 0
else:
flag = 1
print(count) | n = int(eval(input()))
A = [0] + [int(i) for i in input().split()]
cnt = 0
for i in range(n):
if A[i + 1] > A[i]:
cnt += A[i + 1] - A[i]
print(cnt) | 16 | 7 | 314 | 159 | n = int(eval(input()))
H = [int(i) for i in input().split()]
count = 0
for _ in range(100):
flag = 1
for i in range(n):
if H[i] > 0:
H[i] -= 1
if flag:
count += 1
flag = 0
else:
flag = 1
print(count)
| n = int(eval(input()))
A = [0] + [int(i) for i in input().split()]
cnt = 0
for i in range(n):
if A[i + 1] > A[i]:
cnt += A[i + 1] - A[i]
print(cnt)
| false | 56.25 | [
"-H = [int(i) for i in input().split()]",
"-count = 0",
"-for _ in range(100):",
"- flag = 1",
"- for i in range(n):",
"- if H[i] > 0:",
"- H[i] -= 1",
"- if flag:",
"- count += 1",
"- flag = 0",
"- else:",
"- f... | false | 0.036902 | 0.059351 | 0.621755 | [
"s040562131",
"s583019906"
] |
u068862829 | p02630 | python | s353514647 | s503387295 | 375 | 326 | 26,100 | 24,120 | Accepted | Accepted | 13.07 | N = int(eval(input()))
A = list(map(int, input().split()))
Aset = set(A)
lst = {}
for i in Aset:
lst[i] = 0
for i in range(N):
lst[A[i]] += 1
Q = int(eval(input()))
# 最初の全てのA_iの和
ans_init = 0
for i in lst:
ans_init += i*lst[i]
# 初期値からのプラスマイナス分
ans_pm = 0
ans = []
for i in range... | import collections
N = int(eval(input()))
A = list(map(int, input().split()))
lst = collections.Counter(A)
Q = int(eval(input()))
# 最初の全てのA_iの和
ans_init = 0
for i in lst:
ans_init += i*lst[i]
# 初期値からのプラスマイナス分
ans_pm = 0
ans = []
for i in range(Q):
B, C = list(map(int, input().split()))
... | 43 | 38 | 792 | 739 | N = int(eval(input()))
A = list(map(int, input().split()))
Aset = set(A)
lst = {}
for i in Aset:
lst[i] = 0
for i in range(N):
lst[A[i]] += 1
Q = int(eval(input()))
# 最初の全てのA_iの和
ans_init = 0
for i in lst:
ans_init += i * lst[i]
# 初期値からのプラスマイナス分
ans_pm = 0
ans = []
for i in range(Q):
B, C = list(map(int... | import collections
N = int(eval(input()))
A = list(map(int, input().split()))
lst = collections.Counter(A)
Q = int(eval(input()))
# 最初の全てのA_iの和
ans_init = 0
for i in lst:
ans_init += i * lst[i]
# 初期値からのプラスマイナス分
ans_pm = 0
ans = []
for i in range(Q):
B, C = list(map(int, input().split()))
if B in lst:
... | false | 11.627907 | [
"+import collections",
"+",
"-Aset = set(A)",
"-lst = {}",
"-for i in Aset:",
"- lst[i] = 0",
"-for i in range(N):",
"- lst[A[i]] += 1",
"+lst = collections.Counter(A)"
] | false | 0.053592 | 0.052752 | 1.015927 | [
"s353514647",
"s503387295"
] |
u107077660 | p04030 | python | s679095667 | s126661103 | 36 | 23 | 3,064 | 3,064 | Accepted | Accepted | 36.11 | s = eval(input())
a = ""
for i in range(len(s)):
if s[i] == "0":
a += "0"
elif s[i] == "1":
a += "1"
else:
if a != "":
a = a[:len(a)-1]
print(a)
| s = eval(input())
ans = ""
for l in s:
if l == "B":
ans = ans[:-1]
else:
ans += l
print(ans) | 12 | 8 | 163 | 117 | s = eval(input())
a = ""
for i in range(len(s)):
if s[i] == "0":
a += "0"
elif s[i] == "1":
a += "1"
else:
if a != "":
a = a[: len(a) - 1]
print(a)
| s = eval(input())
ans = ""
for l in s:
if l == "B":
ans = ans[:-1]
else:
ans += l
print(ans)
| false | 33.333333 | [
"-a = \"\"",
"-for i in range(len(s)):",
"- if s[i] == \"0\":",
"- a += \"0\"",
"- elif s[i] == \"1\":",
"- a += \"1\"",
"+ans = \"\"",
"+for l in s:",
"+ if l == \"B\":",
"+ ans = ans[:-1]",
"- if a != \"\":",
"- a = a[: len(a) - 1]",
"-print(... | false | 0.059892 | 0.042716 | 1.402118 | [
"s679095667",
"s126661103"
] |
u517724953 | p02911 | python | s693904543 | s206764190 | 634 | 577 | 54,244 | 51,660 | Accepted | Accepted | 8.99 | def main():
n, k, q = list(map(int, input().split()))
point = [0]+[k-q]*n
point_add = [0]*(n+1)
for a in range(q):
a = int(eval(input()))
point[a] += 1
result = [x + y for (x, y) in zip(point, point_add)]
for i in result[1:]:
if i <= 0:
print("No... | def main():
n, k, q = list(map(int, input().split()))
point = [0]+[k-q]*n
for a in range(q):
point[int(eval(input()))] += 1
for i in point[1:]:
if i <= 0:
print("No")
else:
print("Yes")
if __name__ == '__main__':
main()
| 19 | 16 | 396 | 295 | def main():
n, k, q = list(map(int, input().split()))
point = [0] + [k - q] * n
point_add = [0] * (n + 1)
for a in range(q):
a = int(eval(input()))
point[a] += 1
result = [x + y for (x, y) in zip(point, point_add)]
for i in result[1:]:
if i <= 0:
print("No")
... | def main():
n, k, q = list(map(int, input().split()))
point = [0] + [k - q] * n
for a in range(q):
point[int(eval(input()))] += 1
for i in point[1:]:
if i <= 0:
print("No")
else:
print("Yes")
if __name__ == "__main__":
main()
| false | 15.789474 | [
"- point_add = [0] * (n + 1)",
"- a = int(eval(input()))",
"- point[a] += 1",
"- result = [x + y for (x, y) in zip(point, point_add)]",
"- for i in result[1:]:",
"+ point[int(eval(input()))] += 1",
"+ for i in point[1:]:"
] | false | 0.060745 | 0.043623 | 1.392486 | [
"s693904543",
"s206764190"
] |
u461573913 | p03331 | python | s277325942 | s742962375 | 268 | 18 | 3,060 | 3,064 | Accepted | Accepted | 93.28 | def DigitsSum(n):
sum = 0
while (n != 0):
sum += (n % 10)
n = int(n / 10)
return sum
N = int(eval(input()))
min_sum = 10**5
for i in range(1, N):
sum = DigitsSum(i) + DigitsSum(N-i)
if (sum < min_sum):
min_sum = sum
print(min_sum)
| def Digitsum(n):
sum = 0
while(n > 0):
sum += (n % 10)
n = int(n / 10)
return sum
N = int(eval(input()))
n = N
ans = 0
while(True):
if (n % 10 >= 2):
#10のべき乗ではない
ans = Digitsum(N)
break
elif (n % 10 == 1 and n >= 10):
#10のべき乗ではない
... | 16 | 25 | 287 | 437 | def DigitsSum(n):
sum = 0
while n != 0:
sum += n % 10
n = int(n / 10)
return sum
N = int(eval(input()))
min_sum = 10**5
for i in range(1, N):
sum = DigitsSum(i) + DigitsSum(N - i)
if sum < min_sum:
min_sum = sum
print(min_sum)
| def Digitsum(n):
sum = 0
while n > 0:
sum += n % 10
n = int(n / 10)
return sum
N = int(eval(input()))
n = N
ans = 0
while True:
if n % 10 >= 2:
# 10のべき乗ではない
ans = Digitsum(N)
break
elif n % 10 == 1 and n >= 10:
# 10のべき乗ではない
ans = Digitsum(N)
... | false | 36 | [
"-def DigitsSum(n):",
"+def Digitsum(n):",
"- while n != 0:",
"+ while n > 0:",
"-min_sum = 10**5",
"-for i in range(1, N):",
"- sum = DigitsSum(i) + DigitsSum(N - i)",
"- if sum < min_sum:",
"- min_sum = sum",
"-print(min_sum)",
"+n = N",
"+ans = 0",
"+while True:",
"+ ... | false | 0.102194 | 0.036915 | 2.768386 | [
"s277325942",
"s742962375"
] |
u280552586 | p03854 | python | s744528434 | s514710921 | 57 | 32 | 9,172 | 9,060 | Accepted | Accepted | 43.86 | s = input()[::-1]
n = len(s)
words = ['maerd', 'remaerd', 'esare', 'resare']
while True:
if s[:5] == words[0]:
s = s[5:]
continue
elif s[:7] == words[1]:
s = s[7:]
continue
elif s[:5] == words[2]:
s = s[5:]
continue
elif s[:6] == words[3]:
... | s = eval(input())
words = ['eraser', 'erase', 'dreamer', 'dream']
for w in words:
s = s.replace(w, '')
print(('NO' if s else 'YES'))
| 18 | 5 | 394 | 134 | s = input()[::-1]
n = len(s)
words = ["maerd", "remaerd", "esare", "resare"]
while True:
if s[:5] == words[0]:
s = s[5:]
continue
elif s[:7] == words[1]:
s = s[7:]
continue
elif s[:5] == words[2]:
s = s[5:]
continue
elif s[:6] == words[3]:
s = s[6:... | s = eval(input())
words = ["eraser", "erase", "dreamer", "dream"]
for w in words:
s = s.replace(w, "")
print(("NO" if s else "YES"))
| false | 72.222222 | [
"-s = input()[::-1]",
"-n = len(s)",
"-words = [\"maerd\", \"remaerd\", \"esare\", \"resare\"]",
"-while True:",
"- if s[:5] == words[0]:",
"- s = s[5:]",
"- continue",
"- elif s[:7] == words[1]:",
"- s = s[7:]",
"- continue",
"- elif s[:5] == words[2]:",
"... | false | 0.03537 | 0.031378 | 1.127221 | [
"s744528434",
"s514710921"
] |
u275934251 | p03814 | python | s787206765 | s641769459 | 76 | 35 | 4,840 | 3,512 | Accepted | Accepted | 53.95 | s = list(eval(input()))
a_index = 0
z_index = 0
max_z_index = 0
for i in range(len(s)):
if s[i] == "A":
a_index = i
break
for j in range(len(s)):
if j <= a_index:
continue
else:
if s[j] == "Z":
z_index = j
max_z_index = max(max_z_in... | s=eval(input())
a=0
z=0
for i in range(len(s)):
if s[i]=="A":
a=i
break
for i in range(len(s)-1,-1,-1):
if s[i]=="Z":
z=i
break
print((z-a+1))
| 20 | 12 | 363 | 186 | s = list(eval(input()))
a_index = 0
z_index = 0
max_z_index = 0
for i in range(len(s)):
if s[i] == "A":
a_index = i
break
for j in range(len(s)):
if j <= a_index:
continue
else:
if s[j] == "Z":
z_index = j
max_z_index = max(max_z_index, z_index)
print(... | s = eval(input())
a = 0
z = 0
for i in range(len(s)):
if s[i] == "A":
a = i
break
for i in range(len(s) - 1, -1, -1):
if s[i] == "Z":
z = i
break
print((z - a + 1))
| false | 40 | [
"-s = list(eval(input()))",
"-a_index = 0",
"-z_index = 0",
"-max_z_index = 0",
"+s = eval(input())",
"+a = 0",
"+z = 0",
"- a_index = i",
"+ a = i",
"-for j in range(len(s)):",
"- if j <= a_index:",
"- continue",
"- else:",
"- if s[j] == \"Z\":",
"- ... | false | 0.086722 | 0.036207 | 2.395165 | [
"s787206765",
"s641769459"
] |
u755830696 | p03128 | python | s732359378 | s279137399 | 417 | 134 | 109,148 | 20,560 | Accepted | Accepted | 67.87 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
dp = [[-1 for i in range(10)] for j in range(N+1)]
B = [0 for i in range(10)]
C = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
for i in range(10):
if i in A:
B[i] = C[i]
for i in range(10):
dp[N][i] = 0
for i in range(N, ... | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
dp = [-1] * (n + 1)
dp[n] = 0
for i in range(n, -1, -1):
for j in range(m):
x = b[a[j]]
if dp[i] != -1 and i - x >= 0:
dp[i - x] = max(dp[i - x], 10 * dp[i] + a[j])... | 28 | 14 | 634 | 342 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
dp = [[-1 for i in range(10)] for j in range(N + 1)]
B = [0 for i in range(10)]
C = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
for i in range(10):
if i in A:
B[i] = C[i]
for i in range(10):
dp[N][i] = 0
for i in range(N, -1, -1):
for j i... | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
dp = [-1] * (n + 1)
dp[n] = 0
for i in range(n, -1, -1):
for j in range(m):
x = b[a[j]]
if dp[i] != -1 and i - x >= 0:
dp[i - x] = max(dp[i - x], 10 * dp[i] + a[j])
print((dp[0])... | false | 50 | [
"-N, M = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-dp = [[-1 for i in range(10)] for j in range(N + 1)]",
"-B = [0 for i in range(10)]",
"-C = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]",
"-for i in range(10):",
"- if i in A:",
"- B[i] = C[i]",
"-for i in range(10):",... | false | 0.039294 | 0.037658 | 1.043449 | [
"s732359378",
"s279137399"
] |
u046158516 | p02756 | python | s912159257 | s571445992 | 662 | 312 | 7,808 | 110,312 | Accepted | Accepted | 52.87 | S=eval(input())
# Python3 program to Split string into characters
def split(word):
return [char for char in word]
def convert(s):
# initialization of string to ""
new = ""
# traverse in the string
for x in s:
new += x
# return string
return new
... | S=eval(input())
# Python3 program to Split string into characters
def split(word):
return [char for char in word]
word = S
splits=split(S)
Q=int(eval(input()))
flipcounter=0
prestring=[]
poststring=[]
for i in range(0,Q):
inputforround=eval(input())
if inputforround=='1':
flipcounter=flipco... | 44 | 29 | 878 | 650 | S = eval(input())
# Python3 program to Split string into characters
def split(word):
return [char for char in word]
def convert(s):
# initialization of string to ""
new = ""
# traverse in the string
for x in s:
new += x
# return string
return new
# Driver code
word = S
splits = s... | S = eval(input())
# Python3 program to Split string into characters
def split(word):
return [char for char in word]
word = S
splits = split(S)
Q = int(eval(input()))
flipcounter = 0
prestring = []
poststring = []
for i in range(0, Q):
inputforround = eval(input())
if inputforround == "1":
flipcoun... | false | 34.090909 | [
"-def convert(s):",
"- # initialization of string to \"\"",
"- new = \"\"",
"- # traverse in the string",
"- for x in s:",
"- new += x",
"- # return string",
"- return new",
"-",
"-",
"-# Driver code",
"-ans = convert(prestring)",
"+ans = \"\".join(prestring)"
] | false | 0.041547 | 0.047028 | 0.883455 | [
"s912159257",
"s571445992"
] |
u340781749 | p02787 | python | s655681819 | s164093052 | 404 | 82 | 14,532 | 6,256 | Accepted | Accepted | 79.7 | import sys
import numpy as np
h, n = list(map(int, input().split()))
ab = np.array(sys.stdin.read().split(), dtype=np.int64)
aaa = ab[0::2]
bbb = ab[1::2]
dp = np.zeros(10001, dtype=np.int64)
for i in range(1, h + 1):
dp[i] = (dp[i - aaa] + bbb).min()
print((dp[h]))
| import sys
def solve(h, n, ab):
ab.sort(key=lambda x: x[1] / x[0])
INF = 10 ** 18
cache = {}
# とりあえず一番コスパいいやつだけを使った結果を暫定最良値としておく
best = ((h - 1) // ab[0][0] + 1) * ab[0][1]
def dp(k, i=0, cost=0):
nonlocal best
if k <= 0:
return cost
if (k, i)... | 12 | 38 | 276 | 947 | import sys
import numpy as np
h, n = list(map(int, input().split()))
ab = np.array(sys.stdin.read().split(), dtype=np.int64)
aaa = ab[0::2]
bbb = ab[1::2]
dp = np.zeros(10001, dtype=np.int64)
for i in range(1, h + 1):
dp[i] = (dp[i - aaa] + bbb).min()
print((dp[h]))
| import sys
def solve(h, n, ab):
ab.sort(key=lambda x: x[1] / x[0])
INF = 10**18
cache = {}
# とりあえず一番コスパいいやつだけを使った結果を暫定最良値としておく
best = ((h - 1) // ab[0][0] + 1) * ab[0][1]
def dp(k, i=0, cost=0):
nonlocal best
if k <= 0:
return cost
if (k, i) in cache:
... | false | 68.421053 | [
"-import numpy as np",
"+",
"+def solve(h, n, ab):",
"+ ab.sort(key=lambda x: x[1] / x[0])",
"+ INF = 10**18",
"+ cache = {}",
"+ # とりあえず一番コスパいいやつだけを使った結果を暫定最良値としておく",
"+ best = ((h - 1) // ab[0][0] + 1) * ab[0][1]",
"+",
"+ def dp(k, i=0, cost=0):",
"+ nonlocal best",
... | false | 0.357882 | 0.053843 | 6.64679 | [
"s655681819",
"s164093052"
] |
u952022797 | p03476 | python | s144569573 | s739326851 | 731 | 428 | 63,448 | 52,316 | Accepted | Accepted | 41.45 | # -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,var... | # -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
##### リストの 二分木検索 #####
# bisect_le... | 53 | 100 | 1,168 | 2,677 | # -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
# NO, PAY-PAY
# import numpy as np
# import statistics
# from statistics import mean, median,variance,stde... | # -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# ... | false | 47 | [
"-import copy",
"-import collections",
"+import math",
"+import collections",
"+import copy",
"+import heapq",
"-import math",
"+import itertools",
"-# NO, PAY-PAY",
"-# import numpy as np",
"-# import statistics",
"-# from statistics import mean, median,variance,stdev",
"+input = sys.stdin.... | false | 0.682302 | 0.665438 | 1.025342 | [
"s144569573",
"s739326851"
] |
u976225138 | p03625 | python | s953198604 | s661078386 | 79 | 73 | 22,192 | 22,120 | Accepted | Accepted | 7.59 | from collections import Counter as C
_ = eval(input())
a = C([int(x) for x in input().split()])
b = [0] * 2
for k, v in list(a.items()):
if 4 <= v:
b.append(k)
if 2 <= v:
b.append(k)
else:
b.sort()
print((b[-1] * b[-2])) | from collections import Counter as C
_ = eval(input())
a = C([int(x) for x in input().split()])
b = []
for k, v in list(a.items()):
if 4 <= v:
b.append(k)
if 2 <= v:
b.append(k)
else:
if len(b) <= 1:
print((0))
else:
b.sort()
print((b[-1] * b[-2]... | 14 | 17 | 253 | 306 | from collections import Counter as C
_ = eval(input())
a = C([int(x) for x in input().split()])
b = [0] * 2
for k, v in list(a.items()):
if 4 <= v:
b.append(k)
if 2 <= v:
b.append(k)
else:
b.sort()
print((b[-1] * b[-2]))
| from collections import Counter as C
_ = eval(input())
a = C([int(x) for x in input().split()])
b = []
for k, v in list(a.items()):
if 4 <= v:
b.append(k)
if 2 <= v:
b.append(k)
else:
if len(b) <= 1:
print((0))
else:
b.sort()
print((b[-1] * b[-2]))
| false | 17.647059 | [
"-b = [0] * 2",
"+b = []",
"- b.sort()",
"- print((b[-1] * b[-2]))",
"+ if len(b) <= 1:",
"+ print((0))",
"+ else:",
"+ b.sort()",
"+ print((b[-1] * b[-2]))"
] | false | 0.044584 | 0.043431 | 1.026563 | [
"s953198604",
"s661078386"
] |
u699089116 | p03611 | python | s224998965 | s252684645 | 313 | 226 | 111,300 | 56,900 | Accepted | Accepted | 27.8 | from itertools import accumulate
n = int(eval(input()))
a = list(map(int, input().split()))
# 0が混ざってる場合に対応して、1ずつ足しておく
a = [i+1 for i in a]
# 10**5だと99999がコーナーケースになる
l = [0] * 10 ** 6
# いもす法
for i in a:
l[i-1] += 1
l[i+2] -= 1
b = accumulate(l)
print((max(list(b)))) | from itertools import accumulate
n = int(eval(input()))
a = list(map(int, input().split()))
a = [i+1 for i in a]
imos = [0] * (10**5 + 3)
for i in a:
imos[i-1] += 1
imos[i+2] -= 1
i = accumulate(imos)
print((max(i)))
| 15 | 13 | 281 | 232 | from itertools import accumulate
n = int(eval(input()))
a = list(map(int, input().split()))
# 0が混ざってる場合に対応して、1ずつ足しておく
a = [i + 1 for i in a]
# 10**5だと99999がコーナーケースになる
l = [0] * 10**6
# いもす法
for i in a:
l[i - 1] += 1
l[i + 2] -= 1
b = accumulate(l)
print((max(list(b))))
| from itertools import accumulate
n = int(eval(input()))
a = list(map(int, input().split()))
a = [i + 1 for i in a]
imos = [0] * (10**5 + 3)
for i in a:
imos[i - 1] += 1
imos[i + 2] -= 1
i = accumulate(imos)
print((max(i)))
| false | 13.333333 | [
"-# 0が混ざってる場合に対応して、1ずつ足しておく",
"-# 10**5だと99999がコーナーケースになる",
"-l = [0] * 10**6",
"-# いもす法",
"+imos = [0] * (10**5 + 3)",
"- l[i - 1] += 1",
"- l[i + 2] -= 1",
"-b = accumulate(l)",
"-print((max(list(b))))",
"+ imos[i - 1] += 1",
"+ imos[i + 2] -= 1",
"+i = accumulate(imos)",
"+pri... | false | 0.515614 | 0.090952 | 5.669077 | [
"s224998965",
"s252684645"
] |
u072717685 | p03457 | python | s291111573 | s273349853 | 363 | 204 | 17,344 | 9,040 | Accepted | Accepted | 43.8 | import sys
def main():
n = int(eval(input()))
txy = []
for _ in range(n):
txy.append(tuple(map(int, input().split())))
t = x = y = 0
for i1 in range(n):
txye = txy[i1]
t, dt = txye[0], txye[0] - t
x, dx = txye[1], abs(txye[1] - x)
y, dy = txye[2],... | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
n = int(eval(input()))
pre_t = 0
pre_x = 0
pre_y = 0
for _ in range(n):
t, x, y = list(map(int, input().split()))
d_dis = abs(x - pre_x) + abs(y - pre_y)
d_t = abs(t - pre_t)
if d... | 25 | 26 | 580 | 600 | import sys
def main():
n = int(eval(input()))
txy = []
for _ in range(n):
txy.append(tuple(map(int, input().split())))
t = x = y = 0
for i1 in range(n):
txye = txy[i1]
t, dt = txye[0], txye[0] - t
x, dx = txye[1], abs(txye[1] - x)
y, dy = txye[2], abs(txye[2... | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
n = int(eval(input()))
pre_t = 0
pre_x = 0
pre_y = 0
for _ in range(n):
t, x, y = list(map(int, input().split()))
d_dis = abs(x - pre_x) + abs(y - pre_y)
d_t = abs(t - pre_t)
if d_dis > d_... | false | 3.846154 | [
"+",
"+read = sys.stdin.read",
"+readlines = sys.stdin.readlines",
"- txy = []",
"+ pre_t = 0",
"+ pre_x = 0",
"+ pre_y = 0",
"- txy.append(tuple(map(int, input().split())))",
"- t = x = y = 0",
"- for i1 in range(n):",
"- txye = txy[i1]",
"- t, dt = txye... | false | 0.074969 | 0.036822 | 2.036024 | [
"s291111573",
"s273349853"
] |
u502731482 | p02996 | python | s467927209 | s581813585 | 865 | 668 | 38,028 | 42,220 | Accepted | Accepted | 22.77 |
n = int(eval(input()))
data = []
for i in range(n):
a, b = list(map(int, input().split()))
data.append([a, b])
data.sort(key = lambda x: x[1])
flag = True
sum = 0
for i in range(n):
sum += data[i][0]
if sum > data[i][1]:
flag = False
break
print(("Yes" if flag == True ... | n = int(eval(input()))
data = []
for i in range(n):
a, b = list(map(int, input().split()))
data.append([a, b])
data = sorted(data, key = lambda x: x[1])
time = 0
ans = "Yes"
for i in range(n):
if time + data[i][0] > data[i][1]:
ans = "No"
time += data[i][0]
print(ans) | 17 | 14 | 317 | 294 | n = int(eval(input()))
data = []
for i in range(n):
a, b = list(map(int, input().split()))
data.append([a, b])
data.sort(key=lambda x: x[1])
flag = True
sum = 0
for i in range(n):
sum += data[i][0]
if sum > data[i][1]:
flag = False
break
print(("Yes" if flag == True else "No"))
| n = int(eval(input()))
data = []
for i in range(n):
a, b = list(map(int, input().split()))
data.append([a, b])
data = sorted(data, key=lambda x: x[1])
time = 0
ans = "Yes"
for i in range(n):
if time + data[i][0] > data[i][1]:
ans = "No"
time += data[i][0]
print(ans)
| false | 17.647059 | [
"-data.sort(key=lambda x: x[1])",
"-flag = True",
"-sum = 0",
"+data = sorted(data, key=lambda x: x[1])",
"+time = 0",
"+ans = \"Yes\"",
"- sum += data[i][0]",
"- if sum > data[i][1]:",
"- flag = False",
"- break",
"-print((\"Yes\" if flag == True else \"No\"))",
"+ if t... | false | 0.041793 | 0.039033 | 1.070706 | [
"s467927209",
"s581813585"
] |
u843768197 | p02802 | python | s566930291 | s298761774 | 204 | 185 | 10,304 | 10,352 | Accepted | Accepted | 9.31 | n, m = list(map(int, input().split()))
P = [0]*n
AC = [False]*n
correct = 0
penalty = 0
for i in range(m):
ans = input().split()
problem = int(ans[0])
result = ans[1]
if AC[problem-1] == False:
if result == 'AC':
AC[problem-1] = True
correct += 1
penalty += P[problem-1]
e... | n, m = list(map(int, input().split()))
Penalty = [0]*(n+1)
AC = [False]*(n+1)
correct = 0
penalty = 0
for i in range(m):
ans = input().split()
problem = int(ans[0])
result = ans[1]
if AC[problem] == False:
if result == 'AC':
AC[problem] = True
correct += 1
penalty += Penalty[p... | 17 | 17 | 368 | 386 | n, m = list(map(int, input().split()))
P = [0] * n
AC = [False] * n
correct = 0
penalty = 0
for i in range(m):
ans = input().split()
problem = int(ans[0])
result = ans[1]
if AC[problem - 1] == False:
if result == "AC":
AC[problem - 1] = True
correct += 1
penal... | n, m = list(map(int, input().split()))
Penalty = [0] * (n + 1)
AC = [False] * (n + 1)
correct = 0
penalty = 0
for i in range(m):
ans = input().split()
problem = int(ans[0])
result = ans[1]
if AC[problem] == False:
if result == "AC":
AC[problem] = True
correct += 1
... | false | 0 | [
"-P = [0] * n",
"-AC = [False] * n",
"+Penalty = [0] * (n + 1)",
"+AC = [False] * (n + 1)",
"- if AC[problem - 1] == False:",
"+ if AC[problem] == False:",
"- AC[problem - 1] = True",
"+ AC[problem] = True",
"- penalty += P[problem - 1]",
"+ penalt... | false | 0.097128 | 0.049697 | 1.9544 | [
"s566930291",
"s298761774"
] |
u390727364 | p02706 | python | s497578037 | s963836329 | 109 | 59 | 27,636 | 68,160 | Accepted | Accepted | 45.87 | import numpy as np
from sys import stdin
def main():
n, m = map(int, stdin.readline().split())
a = list(map(int, stdin.readline().split()))
a = np.array(a)
ans = n - np.sum(a)
print(-1) if ans < 0 else print(ans)
if __name__ == "__main__":
main()
| from sys import stdin, setrecursionlimit
def main():
input = stdin.buffer.readline
n, m = list(map(int, input().split()))
sum_a = sum(list(map(int, input().split())))
ans = n - sum_a
if ans < 0:
print((-1))
else:
print(ans)
if __name__ == "__main__":
setrec... | 17 | 17 | 294 | 343 | import numpy as np
from sys import stdin
def main():
n, m = map(int, stdin.readline().split())
a = list(map(int, stdin.readline().split()))
a = np.array(a)
ans = n - np.sum(a)
print(-1) if ans < 0 else print(ans)
if __name__ == "__main__":
main()
| from sys import stdin, setrecursionlimit
def main():
input = stdin.buffer.readline
n, m = list(map(int, input().split()))
sum_a = sum(list(map(int, input().split())))
ans = n - sum_a
if ans < 0:
print((-1))
else:
print(ans)
if __name__ == "__main__":
setrecursionlimit(100... | false | 0 | [
"-import numpy as np",
"-from sys import stdin",
"+from sys import stdin, setrecursionlimit",
"- n, m = map(int, stdin.readline().split())",
"- a = list(map(int, stdin.readline().split()))",
"- a = np.array(a)",
"- ans = n - np.sum(a)",
"- print(-1) if ans < 0 else print(ans)",
"+ ... | false | 0.243827 | 0.036646 | 6.6536 | [
"s497578037",
"s963836329"
] |
u966695411 | p03986 | python | s151115967 | s398078899 | 990 | 58 | 5,352 | 5,352 | Accepted | Accepted | 94.14 | s = ''.join(input().split('ST'))
while 1:
i = s.find('ST')
if i > -1:
cnt = 0
for j in range(min(i, len(s)-2-i)):
if s[i-j-1] == 'S' and s[i+j+2] == 'T':
cnt += 1
else:
break
s = s[:i-cnt] + s[i+cnt+2:]
else:
... | s = ''.join(input().split('ST'))
cnts = 0
cnt = 0
for i in s:
if i == 'S' :
cnts += 1
elif cnts > 0:
cnts -= 1
cnt += 1
print((len(s)-cnt*2)) | 14 | 10 | 341 | 180 | s = "".join(input().split("ST"))
while 1:
i = s.find("ST")
if i > -1:
cnt = 0
for j in range(min(i, len(s) - 2 - i)):
if s[i - j - 1] == "S" and s[i + j + 2] == "T":
cnt += 1
else:
break
s = s[: i - cnt] + s[i + cnt + 2 :]
else:... | s = "".join(input().split("ST"))
cnts = 0
cnt = 0
for i in s:
if i == "S":
cnts += 1
elif cnts > 0:
cnts -= 1
cnt += 1
print((len(s) - cnt * 2))
| false | 28.571429 | [
"-while 1:",
"- i = s.find(\"ST\")",
"- if i > -1:",
"- cnt = 0",
"- for j in range(min(i, len(s) - 2 - i)):",
"- if s[i - j - 1] == \"S\" and s[i + j + 2] == \"T\":",
"- cnt += 1",
"- else:",
"- break",
"- s = s[: i - ... | false | 0.164433 | 0.033254 | 4.944762 | [
"s151115967",
"s398078899"
] |
u982591663 | p02959 | python | s120377276 | s150614370 | 174 | 148 | 18,624 | 19,116 | Accepted | Accepted | 14.94 | #ABC-136-C
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
hunted_monsters = 0
for i in range(N):
#勇者iが街iのモンスターを全て倒しても余力がある場合
if A[i] < B[i]:
B[i] -= A[i]
hunted_monsters += A[i]
A[i] = 0
#街i+1のモンスターも全て倒せる場合
if ... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i in range(N):
# 勇者に余力がある場合
if B[i] >= A[i]:
ans += A[i]
B[i] -= A[i]
if B[i] >= A[i+1]:
ans += A[i+1]
A[i+1] = 0
else:
an... | 30 | 20 | 715 | 414 | # ABC-136-C
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
hunted_monsters = 0
for i in range(N):
# 勇者iが街iのモンスターを全て倒しても余力がある場合
if A[i] < B[i]:
B[i] -= A[i]
hunted_monsters += A[i]
A[i] = 0
# 街i+1のモンスターも全て倒せる場合
if A[i + 1] <=... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i in range(N):
# 勇者に余力がある場合
if B[i] >= A[i]:
ans += A[i]
B[i] -= A[i]
if B[i] >= A[i + 1]:
ans += A[i + 1]
A[i + 1] = 0
else:
ans += B[i]... | false | 33.333333 | [
"-# ABC-136-C",
"-hunted_monsters = 0",
"+ans = 0",
"- # 勇者iが街iのモンスターを全て倒しても余力がある場合",
"- if A[i] < B[i]:",
"+ # 勇者に余力がある場合",
"+ if B[i] >= A[i]:",
"+ ans += A[i]",
"- hunted_monsters += A[i]",
"- A[i] = 0",
"- # 街i+1のモンスターも全て倒せる場合",
"- if A[i + 1]... | false | 0.064966 | 0.044814 | 1.449675 | [
"s120377276",
"s150614370"
] |
u703950586 | p02868 | python | s485463680 | s725574408 | 1,006 | 845 | 108,424 | 109,536 | Accepted | Accepted | 16 | import sys,queue,math,copy,itertools,bisect,collections,heapq
class Node:
def __init__(self,x):
self.data = x
self.left = None
self.right = None
def insert(node,x):
if node is None: return Node(x)
elif x < node.data:
node.left = insert(node.left,x)
else:
... | import sys,queue,math,copy,itertools,bisect,collections,heapq
class Node:
def __init__(self,x):
self.data = x
self.count = 1
self.left = None
self.right = None
def insert(node,x):
if node is None: return Node(x)
if node.data == x:
node.count += 1
el... | 74 | 84 | 1,839 | 2,079 | import sys, queue, math, copy, itertools, bisect, collections, heapq
class Node:
def __init__(self, x):
self.data = x
self.left = None
self.right = None
def insert(node, x):
if node is None:
return Node(x)
elif x < node.data:
node.left = insert(node.left, x)
e... | import sys, queue, math, copy, itertools, bisect, collections, heapq
class Node:
def __init__(self, x):
self.data = x
self.count = 1
self.left = None
self.right = None
def insert(node, x):
if node is None:
return Node(x)
if node.data == x:
node.count += 1
... | false | 11.904762 | [
"+ self.count = 1",
"+ if node.data == x:",
"+ node.count += 1",
"- return node.right",
"- node.left = delete_min(node.left)",
"+ if node.count > 1:",
"+ node.count -= 1",
"+ else:",
"+ return node.right",
"+ else:",
"+ nod... | false | 0.131888 | 0.04658 | 2.831414 | [
"s485463680",
"s725574408"
] |
u451017206 | p03945 | python | s645267347 | s831170356 | 441 | 44 | 3,444 | 3,188 | Accepted | Accepted | 90.02 | from collections import Counter
S = eval(input())
ans = 0
c = Counter(S)
if c['W'] == 0 or c['B'] == 0:
print((0))
exit()
a = S[0]
while True:
for i, s in enumerate(S):
if s != a: break
S = S[i:]
c[a] -= i
a = S[0]
ans += 1
if c['W'] == 0 or c['B'] == 0:break
prin... | S = eval(input())
ans = 0
for i in range(len(S) - 1):
if S[i] != S[i+1]: ans+=1
print(ans) | 17 | 5 | 318 | 92 | from collections import Counter
S = eval(input())
ans = 0
c = Counter(S)
if c["W"] == 0 or c["B"] == 0:
print((0))
exit()
a = S[0]
while True:
for i, s in enumerate(S):
if s != a:
break
S = S[i:]
c[a] -= i
a = S[0]
ans += 1
if c["W"] == 0 or c["B"] == 0:
brea... | S = eval(input())
ans = 0
for i in range(len(S) - 1):
if S[i] != S[i + 1]:
ans += 1
print(ans)
| false | 70.588235 | [
"-from collections import Counter",
"-",
"-c = Counter(S)",
"-if c[\"W\"] == 0 or c[\"B\"] == 0:",
"- print((0))",
"- exit()",
"-a = S[0]",
"-while True:",
"- for i, s in enumerate(S):",
"- if s != a:",
"- break",
"- S = S[i:]",
"- c[a] -= i",
"- a = S[0... | false | 0.035785 | 0.068393 | 0.523219 | [
"s645267347",
"s831170356"
] |
u538361257 | p02899 | python | s038130436 | s185447778 | 373 | 187 | 66,088 | 13,812 | Accepted | Accepted | 49.87 | N = int(input())
A = list(map(int, input().split()))
student_dic = {}
for i in range(N):
student_dic[A[i]] = i+1
tmp = sorted(student_dic.items())
for i in range(N):
if i == N-1:
print(tmp[i][1])
else:
print(tmp[i][1], end=" ")
| N = int(input())
A = list(map(int, input().split()))
student_dic = [0 for i in range(N)]
for i in range(N):
student_dic[A[i]-1] = i+1
for i in range(N):
if i == N-1:
print(student_dic[i])
else:
print(student_dic[i], end=" ")
| 14 | 13 | 272 | 268 | N = int(input())
A = list(map(int, input().split()))
student_dic = {}
for i in range(N):
student_dic[A[i]] = i + 1
tmp = sorted(student_dic.items())
for i in range(N):
if i == N - 1:
print(tmp[i][1])
else:
print(tmp[i][1], end=" ")
| N = int(input())
A = list(map(int, input().split()))
student_dic = [0 for i in range(N)]
for i in range(N):
student_dic[A[i] - 1] = i + 1
for i in range(N):
if i == N - 1:
print(student_dic[i])
else:
print(student_dic[i], end=" ")
| false | 7.142857 | [
"-student_dic = {}",
"+student_dic = [0 for i in range(N)]",
"- student_dic[A[i]] = i + 1",
"-tmp = sorted(student_dic.items())",
"+ student_dic[A[i] - 1] = i + 1",
"- print(tmp[i][1])",
"+ print(student_dic[i])",
"- print(tmp[i][1], end=\" \")",
"+ print(student_di... | false | 0.083272 | 0.006683 | 12.460831 | [
"s038130436",
"s185447778"
] |
u281303342 | p03837 | python | s222343778 | s121103789 | 257 | 172 | 18,040 | 14,252 | Accepted | Accepted | 33.07 | # python3 (3.4.3)
import sys
input = sys.stdin.readline
# main
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
N,M = list(map(int,input().split()))
ABC = [list(map(int,input().split())) for _ in range(M)]
g = [[0 for _ in range(N)] for _ in range(N)]
for a,b,c in ABC:
g[a-1][b-1] ... | # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# --------------------------------------... | 23 | 30 | 477 | 753 | # python3 (3.4.3)
import sys
input = sys.stdin.readline
# main
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
N, M = list(map(int, input().split()))
ABC = [list(map(int, input().split())) for _ in range(M)]
g = [[0 for _ in range(N)] for _ in range(N)]
for a, b, c in ABC:
g[a - 1][b - 1] = c
... | # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# ---------------------------------------------------... | false | 23.333333 | [
"-# python3 (3.4.3)",
"+# Python3 (3.4.3)",
"+# function",
"-from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall",
"-",
"+from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall",
"+"
] | false | 0.403455 | 0.628695 | 0.641733 | [
"s222343778",
"s121103789"
] |
u846694620 | p03665 | python | s628793791 | s090562499 | 24 | 18 | 3,572 | 3,064 | Accepted | Accepted | 25 | import functools
import math
@functools.lru_cache()
def combinations(n, r):
return math.factorial(n) / math.factorial(r) / math.factorial(n - r)
def main():
n, p = list(map(int, input().split()))
a = tuple([int(x) % 2 for x in input().split()])
if n == 1 and a[0] % 2 != p:
pri... | import math
def comb(n, r):
return math.factorial(n) / math.factorial(r) / math.factorial(n - r)
def main():
n, p = list(map(int, input().split()))
a = tuple([int(x) % 2 for x in input().split()])
if n == 1 and a[0] % 2 != p:
print((0))
return 0
t = len(tuple([x ... | 43 | 39 | 972 | 771 | import functools
import math
@functools.lru_cache()
def combinations(n, r):
return math.factorial(n) / math.factorial(r) / math.factorial(n - r)
def main():
n, p = list(map(int, input().split()))
a = tuple([int(x) % 2 for x in input().split()])
if n == 1 and a[0] % 2 != p:
print((0))
... | import math
def comb(n, r):
return math.factorial(n) / math.factorial(r) / math.factorial(n - r)
def main():
n, p = list(map(int, input().split()))
a = tuple([int(x) % 2 for x in input().split()])
if n == 1 and a[0] % 2 != p:
print((0))
return 0
t = len(tuple([x for x in a if x =... | false | 9.302326 | [
"-import functools",
"-@functools.lru_cache()",
"-def combinations(n, r):",
"+def comb(n, r):",
"- count = 0",
"+ f_comb = 0",
"+ for j in range(f + 1):",
"+ f_comb += comb(f, j)",
"+ t_comb = 0",
"- c = 0",
"- for j in range(f + 1):",
"- ... | false | 0.038228 | 0.037078 | 1.031019 | [
"s628793791",
"s090562499"
] |
u419877586 | p02777 | python | s697680804 | s219175229 | 165 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.7 | S, T=input().split()
A, B=list(map(int, input().split()))
U=eval(input())
if S==U:
print((A-1, B))
else:
print((A, B-1)) | S, T = input().split()
A, B = list(map(int, input().split()))
U = eval(input())
if U == S:
print((A-1, B))
else:
print((A, B-1)) | 7 | 7 | 118 | 127 | S, T = input().split()
A, B = list(map(int, input().split()))
U = eval(input())
if S == U:
print((A - 1, B))
else:
print((A, B - 1))
| S, T = input().split()
A, B = list(map(int, input().split()))
U = eval(input())
if U == S:
print((A - 1, B))
else:
print((A, B - 1))
| false | 0 | [
"-if S == U:",
"+if U == S:"
] | false | 0.040455 | 0.03622 | 1.116942 | [
"s697680804",
"s219175229"
] |
u077291787 | p03005 | python | s100928627 | s923889660 | 185 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.81 | # div2019-2A - Ball Distribution
n, k = list(map(int, input().rstrip().split()))
print((n % k)) | # diverta2019-2A - Ball Distribution
def main():
n, k = list(map(int, input().rstrip().split()))
print((n % k))
if __name__ == "__main__":
main() | 3 | 8 | 95 | 158 | # div2019-2A - Ball Distribution
n, k = list(map(int, input().rstrip().split()))
print((n % k))
| # diverta2019-2A - Ball Distribution
def main():
n, k = list(map(int, input().rstrip().split()))
print((n % k))
if __name__ == "__main__":
main()
| false | 62.5 | [
"-# div2019-2A - Ball Distribution",
"-n, k = list(map(int, input().rstrip().split()))",
"-print((n % k))",
"+# diverta2019-2A - Ball Distribution",
"+def main():",
"+ n, k = list(map(int, input().rstrip().split()))",
"+ print((n % k))",
"+",
"+",
"+if __name__ == \"__main__\":",
"+ mai... | false | 0.087059 | 0.066284 | 1.313422 | [
"s100928627",
"s923889660"
] |
u644907318 | p02861 | python | s243753852 | s018159047 | 239 | 208 | 41,324 | 40,812 | Accepted | Accepted | 12.97 | from itertools import permutations
import math
def dist(x,y):
return ((x[0]-y[0])**2+(x[1]-y[1])**2)**(0.5)
N = int(eval(input()))
X = [list(map(int,input().split())) for _ in range(N)]
ans = 0
for z in permutations(list(range(N)),N):
for i in range(N-1):
ans += dist(X[z[i]],X[z[(i+1)%N]])
pri... | from itertools import permutations
def dist(x,y):
return ((x[0]-y[0])**2+(x[1]-y[1])**2)**0.5
N = int(eval(input()))
X = [list(map(int,input().split())) for _ in range(N)]
tot = 0
cnt = 0
for z in permutations(list(range(N))):
cnt += 1
for i in range(1,N):
tot += dist(X[z[i]],X[z[i-1]])
p... | 11 | 12 | 333 | 321 | from itertools import permutations
import math
def dist(x, y):
return ((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2) ** (0.5)
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for z in permutations(list(range(N)), N):
for i in range(N - 1):
ans += dist(X[z[i]], X[z[(i... | from itertools import permutations
def dist(x, y):
return ((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2) ** 0.5
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
tot = 0
cnt = 0
for z in permutations(list(range(N))):
cnt += 1
for i in range(1, N):
tot += dist(X[z[i]], X[z... | false | 8.333333 | [
"-import math",
"- return ((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2) ** (0.5)",
"+ return ((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2) ** 0.5",
"-ans = 0",
"-for z in permutations(list(range(N)), N):",
"- for i in range(N - 1):",
"- ans += dist(X[z[i]], X[z[(i + 1) % N]])",
"-print((ans / ... | false | 0.047959 | 0.05473 | 0.876298 | [
"s243753852",
"s018159047"
] |
u768896740 | p03645 | python | s965657892 | s898493683 | 680 | 587 | 21,820 | 21,852 | Accepted | Accepted | 13.68 | n, m = list(map(int, input().split()))
first = []
second = []
for i in range(m):
a = list(map(int, input().split()))
if a[0] == 1:
first.append(a[1])
if a[1] == n:
second.append(a[0])
if len(set(first) & set(second)) > 0:
print('POSSIBLE')
else:
print('IMPOSSIBLE') | n, m = list(map(int, input().split()))
a = []
b = []
for i in range(m):
x, y = list(map(int, input().split()))
if x == 1:
a.append(y)
elif y == n:
b.append(x)
if set(a) & set(b):
print('POSSIBLE')
else:
print('IMPOSSIBLE')
| 16 | 15 | 313 | 263 | n, m = list(map(int, input().split()))
first = []
second = []
for i in range(m):
a = list(map(int, input().split()))
if a[0] == 1:
first.append(a[1])
if a[1] == n:
second.append(a[0])
if len(set(first) & set(second)) > 0:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
| n, m = list(map(int, input().split()))
a = []
b = []
for i in range(m):
x, y = list(map(int, input().split()))
if x == 1:
a.append(y)
elif y == n:
b.append(x)
if set(a) & set(b):
print("POSSIBLE")
else:
print("IMPOSSIBLE")
| false | 6.25 | [
"-first = []",
"-second = []",
"+a = []",
"+b = []",
"- a = list(map(int, input().split()))",
"- if a[0] == 1:",
"- first.append(a[1])",
"- if a[1] == n:",
"- second.append(a[0])",
"-if len(set(first) & set(second)) > 0:",
"+ x, y = list(map(int, input().split()))",
"... | false | 0.039166 | 0.043257 | 0.905424 | [
"s965657892",
"s898493683"
] |
u869919400 | p02862 | python | s515880329 | s059113628 | 537 | 236 | 40,300 | 73,028 | Accepted | Accepted | 56.05 | X, Y = list(map(int, input().split()))
mod = 10**9+7
if (X+Y) % 3 != 0:
print((0))
else:
n = (2*Y-X)//3
m = (2*X-Y)//3
'''
n*(1,2) + m*(2,1) = (x, y)
x = n+2m
y = 2n+m
2x = 2n+4m
2x-y = 3m
m = (2x-y)/3
n = (2y-x)/3
'''
if 0 > n or 0 > m:
pr... | X, Y = list(map(int, input().split()))
m, r = divmod(2*Y-X, 3)
if r != 0:
print((0))
exit()
n = Y - 2*m
if n < 0 or m < 0:
print((0))
exit()
def modinv(a, mod=10**9+7):
return pow(a, mod-2, mod)
def combination(n, r, mod=10**9+7):
r = min(r, n-r)
res = 1
for i in ... | 25 | 24 | 470 | 417 | X, Y = list(map(int, input().split()))
mod = 10**9 + 7
if (X + Y) % 3 != 0:
print((0))
else:
n = (2 * Y - X) // 3
m = (2 * X - Y) // 3
"""
n*(1,2) + m*(2,1) = (x, y)
x = n+2m
y = 2n+m
2x = 2n+4m
2x-y = 3m
m = (2x-y)/3
n = (2y-x)/3
"""
if 0 > n or 0 > m:
print... | X, Y = list(map(int, input().split()))
m, r = divmod(2 * Y - X, 3)
if r != 0:
print((0))
exit()
n = Y - 2 * m
if n < 0 or m < 0:
print((0))
exit()
def modinv(a, mod=10**9 + 7):
return pow(a, mod - 2, mod)
def combination(n, r, mod=10**9 + 7):
r = min(r, n - r)
res = 1
for i in range(... | false | 4 | [
"-mod = 10**9 + 7",
"-if (X + Y) % 3 != 0:",
"+m, r = divmod(2 * Y - X, 3)",
"+if r != 0:",
"-else:",
"- n = (2 * Y - X) // 3",
"- m = (2 * X - Y) // 3",
"- \"\"\"",
"- n*(1,2) + m*(2,1) = (x, y)",
"- x = n+2m",
"- y = 2n+m",
"- 2x = 2n+4m",
"- 2x-y = 3m",
"- m =... | false | 0.414597 | 0.280781 | 1.476584 | [
"s515880329",
"s059113628"
] |
u200887663 | p02623 | python | s427026716 | s430660013 | 991 | 328 | 47,352 | 47,368 | Accepted | Accepted | 66.9 | #n=int(input())
n,m,k=list(map(int,input().split()))
al=list(map(int,input().split()))
bl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
A=[0]
for i in range(n):
A.append(A[i]+al[i])
B=[0]
for i in range(m):
B.append(B[i]+bl[i])
B.append(max(B[m],k)+1)
mx=0
f... | #n=int(input())
n,m,k=list(map(int,input().split()))
al=list(map(int,input().split()))
bl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
import bisect
A=[0]
for i in range(n):
A.append(A[i]+al[i])
B=[0]
for i in range(m):
B.append(B[i]+bl[i])
#B.append(max(B[m],... | 28 | 22 | 579 | 472 | # n=int(input())
n, m, k = list(map(int, input().split()))
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
A = [0]
for i in range(n):
A.append(A[i] + al[i])
B = [0]
for i in range(m):
B.append(B[i] + bl[i])
B.append(max(B[m], k) + ... | # n=int(input())
n, m, k = list(map(int, input().split()))
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
import bisect
A = [0]
for i in range(n):
A.append(A[i] + al[i])
B = [0]
for i in range(m):
B.append(B[i] + bl[i])
# B.appen... | false | 21.428571 | [
"+import bisect",
"+",
"-B.append(max(B[m], k) + 1)",
"+# B.append(max(B[m],k)+1)",
"- left = 0",
"- right = m + 1",
"- while right - left > 1:",
"- mid = (left + right) // 2",
"- if B[mid] > rem:",
"- right = mid",
"- else:",
"- left = mid",... | false | 0.007184 | 0.031723 | 0.226471 | [
"s427026716",
"s430660013"
] |
u489959379 | p04031 | python | s645904749 | s082962557 | 28 | 25 | 3,060 | 3,060 | Accepted | Accepted | 10.71 | n = int(eval(input()))
A = list(map(int, input().split()))
res = float("inf")
for x in range(min(A), max(A) + 1):
cost = 0
for j in range(n):
y = A[j]
cost += pow(x - y, 2)
res = min(res, cost)
print(res)
| import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
res = f_inf
for y in range(-100, 101):
cost = 0
for i in range(n):
cost += pow(abs(A[i] - y), 2)
... | 11 | 22 | 238 | 402 | n = int(eval(input()))
A = list(map(int, input().split()))
res = float("inf")
for x in range(min(A), max(A) + 1):
cost = 0
for j in range(n):
y = A[j]
cost += pow(x - y, 2)
res = min(res, cost)
print(res)
| import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = list(map(int, input().split()))
res = f_inf
for y in range(-100, 101):
cost = 0
for i in range(n):
cost += pow(abs(A[i] - y), 2)
res = min(res, co... | false | 50 | [
"-n = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-res = float(\"inf\")",
"-for x in range(min(A), max(A) + 1):",
"- cost = 0",
"- for j in range(n):",
"- y = A[j]",
"- cost += pow(x - y, 2)",
"- res = min(res, cost)",
"-print(res)",
"+import sys",
"+",... | false | 0.034771 | 0.080848 | 0.430073 | [
"s645904749",
"s082962557"
] |
u497046426 | p03624 | python | s916402648 | s442583529 | 29 | 19 | 3,188 | 3,188 | Accepted | Accepted | 34.48 | S = eval(input())
alphabets = set(list('abcdefghijklmnopqrstuvwxyz'))
for s in S:
alphabets.discard(s)
if len(alphabets) != 0:
print((sorted(alphabets)[0]))
else:
print('None') | S = set(eval(input()))
diff = set('abcdefghijklmnopqrstuvwxyz') - S
if diff:
print((min(diff)))
else:
print('None') | 10 | 6 | 191 | 120 | S = eval(input())
alphabets = set(list("abcdefghijklmnopqrstuvwxyz"))
for s in S:
alphabets.discard(s)
if len(alphabets) != 0:
print((sorted(alphabets)[0]))
else:
print("None")
| S = set(eval(input()))
diff = set("abcdefghijklmnopqrstuvwxyz") - S
if diff:
print((min(diff)))
else:
print("None")
| false | 40 | [
"-S = eval(input())",
"-alphabets = set(list(\"abcdefghijklmnopqrstuvwxyz\"))",
"-for s in S:",
"- alphabets.discard(s)",
"-if len(alphabets) != 0:",
"- print((sorted(alphabets)[0]))",
"+S = set(eval(input()))",
"+diff = set(\"abcdefghijklmnopqrstuvwxyz\") - S",
"+if diff:",
"+ print((min... | false | 0.041251 | 0.044907 | 0.918594 | [
"s916402648",
"s442583529"
] |
u674395364 | p03494 | python | s748256224 | s523304309 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | N = int(eval(input()))
As = list(map(int, input().split()))
i = 0
while True:
for a in As:
if a % pow(2, (i+1)) != 0:
break
else:
i += 1
continue
break
print(i)
| N = int(eval(input()))
A = list(map(int, input().split()))
count = 0
div = 2
flag = False
while True:
for a in A:
if a % div != 0:
flag = True
break
if flag:
break
else:
count += 1
div *= 2
print(count)
| 13 | 17 | 189 | 248 | N = int(eval(input()))
As = list(map(int, input().split()))
i = 0
while True:
for a in As:
if a % pow(2, (i + 1)) != 0:
break
else:
i += 1
continue
break
print(i)
| N = int(eval(input()))
A = list(map(int, input().split()))
count = 0
div = 2
flag = False
while True:
for a in A:
if a % div != 0:
flag = True
break
if flag:
break
else:
count += 1
div *= 2
print(count)
| false | 23.529412 | [
"-As = list(map(int, input().split()))",
"-i = 0",
"+A = list(map(int, input().split()))",
"+count = 0",
"+div = 2",
"+flag = False",
"- for a in As:",
"- if a % pow(2, (i + 1)) != 0:",
"+ for a in A:",
"+ if a % div != 0:",
"+ flag = True",
"+ if flag:",
"+... | false | 0.034401 | 0.035585 | 0.966745 | [
"s748256224",
"s523304309"
] |
u533232830 | p02573 | python | s874865279 | s602402323 | 686 | 465 | 158,840 | 112,240 | Accepted | Accepted | 32.22 | from collections import deque
N, M = list(map(int, input().split()))
g = {i:set() for i in range(N)}
v = [-1 for i in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
g[a].add(b)
g[b].add(a)
Q = deque()
ans = 0
for a in g:
if v[a]==-1:
v[a] = 1
ans_... | from collections import deque
N, M = list(map(int, input().split()))
friends = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
friends[a].append(b)
friends[b].append(a)
checked = [False] * N
ans = 0
for i in range(N):
if checked[i] ... | 27 | 29 | 537 | 651 | from collections import deque
N, M = list(map(int, input().split()))
g = {i: set() for i in range(N)}
v = [-1 for i in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
g[a].add(b)
g[b].add(a)
Q = deque()
ans = 0
for a in g:
if v[a] == -1:
v[a] = 1
... | from collections import deque
N, M = list(map(int, input().split()))
friends = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
friends[a].append(b)
friends[b].append(a)
checked = [False] * N
ans = 0
for i in range(N):
if checked[i] == False:
... | false | 6.896552 | [
"-g = {i: set() for i in range(N)}",
"-v = [-1 for i in range(N)]",
"+friends = [[] for _ in range(N)]",
"- g[a].add(b)",
"- g[b].add(a)",
"-Q = deque()",
"+ friends[a].append(b)",
"+ friends[b].append(a)",
"+checked = [False] * N",
"-for a in g:",
"- if v[a] == -1:",
"- ... | false | 0.045434 | 0.0455 | 0.998536 | [
"s874865279",
"s602402323"
] |
u476604182 | p03808 | python | s178811589 | s017649349 | 98 | 79 | 14,068 | 14,068 | Accepted | Accepted | 19.39 | N, *A = list(map(int, open(0).read().split()))
M = (N+1)*N//2
S = sum(A)
if S%M!=0:
print('NO')
import sys
sys.exit()
cnt = S//M
x = 0
for i in range(N):
df = A[(i+1)%N]-A[i]
if (cnt-df)%N!=0 or cnt<df:
print('NO')
break
x += (cnt-df)//N
else:
if x==cnt:
print('YES')
else:
... | N, *A = list(map(int, open(0).read().split()))
M = (N+1)*N//2
S = sum(A)
if S%M!=0:
print('NO')
exit()
cnt = S//M
for i in range(N):
df = A[(i+1)%N]-A[i]
if (cnt-df)%N!=0 or cnt<df:
print('NO')
break
else:
print('YES') | 20 | 14 | 330 | 243 | N, *A = list(map(int, open(0).read().split()))
M = (N + 1) * N // 2
S = sum(A)
if S % M != 0:
print("NO")
import sys
sys.exit()
cnt = S // M
x = 0
for i in range(N):
df = A[(i + 1) % N] - A[i]
if (cnt - df) % N != 0 or cnt < df:
print("NO")
break
x += (cnt - df) // N
else:
i... | N, *A = list(map(int, open(0).read().split()))
M = (N + 1) * N // 2
S = sum(A)
if S % M != 0:
print("NO")
exit()
cnt = S // M
for i in range(N):
df = A[(i + 1) % N] - A[i]
if (cnt - df) % N != 0 or cnt < df:
print("NO")
break
else:
print("YES")
| false | 30 | [
"- import sys",
"-",
"- sys.exit()",
"+ exit()",
"-x = 0",
"- x += (cnt - df) // N",
"- if x == cnt:",
"- print(\"YES\")",
"- else:",
"- print(\"NO\")",
"+ print(\"YES\")"
] | false | 0.044901 | 0.007643 | 5.874839 | [
"s178811589",
"s017649349"
] |
u028393857 | p03389 | python | s487882331 | s006934168 | 35 | 11 | 27,884 | 2,696 | Accepted | Accepted | 68.57 | def middle(lst):
_lst = lst
_lst.sort()
return _lst[-2]
def min_times(lst):
data = lst
times = 0
idx_even = []
idx_odd = []
for i, v in enumerate(data):
if v % 2 == 0:
idx_even.append(i)
else:
idx_odd.append(i)
odd_len = len(idx... | def middle(lst):
_lst = lst
_lst.sort()
return _lst[-2]
def min_times(lst):
data = lst
times = 0
idx_even = []
idx_odd = []
for i, v in enumerate(data):
if v % 2 == 0:
idx_even.append(i)
else:
idx_odd.append(i)
odd_len = len(idx... | 32 | 32 | 770 | 778 | def middle(lst):
_lst = lst
_lst.sort()
return _lst[-2]
def min_times(lst):
data = lst
times = 0
idx_even = []
idx_odd = []
for i, v in enumerate(data):
if v % 2 == 0:
idx_even.append(i)
else:
idx_odd.append(i)
odd_len = len(idx_odd)
if o... | def middle(lst):
_lst = lst
_lst.sort()
return _lst[-2]
def min_times(lst):
data = lst
times = 0
idx_even = []
idx_odd = []
for i, v in enumerate(data):
if v % 2 == 0:
idx_even.append(i)
else:
idx_odd.append(i)
odd_len = len(idx_odd)
if o... | false | 0 | [
"-use_data = [int(i) for i in input().split()]",
"+use_data = [int(i) for i in input().strip().split()]"
] | false | 0.082341 | 0.045111 | 1.825286 | [
"s487882331",
"s006934168"
] |
u320567105 | p03240 | python | s072089190 | s267553342 | 39 | 36 | 3,188 | 3,188 | Accepted | Accepted | 7.69 | ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18
N=ri()
xyh=[]
for i in range(N):
xyh += [rl()]
xyh.sort(reverse=True, key=lambda x:x[2])
ans=[-1]*3
for x in range(101):
if... | ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18
N=ri()
X=[0]*N
Y=[0]*N
H=[0]*N
for i in range(N):
X[i],Y[i],H[i]=rl()
xyh=list(zip(X,Y,H))
xyh.sort(reverse=True,key=lambda x:x[2... | 42 | 33 | 1,306 | 849 | ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print("YES") if b else print("NO")
INF = 10**18
N = ri()
xyh = []
for i in range(N):
xyh += [rl()]
xyh.sort(reverse=True, key=lambda x: x[2])
ans = [-1] * 3
for x in range(101):
if ans[0... | ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print("YES") if b else print("NO")
INF = 10**18
N = ri()
X = [0] * N
Y = [0] * N
H = [0] * N
for i in range(N):
X[i], Y[i], H[i] = rl()
xyh = list(zip(X, Y, H))
xyh.sort(reverse=True, key=la... | false | 21.428571 | [
"-xyh = []",
"+X = [0] * N",
"+Y = [0] * N",
"+H = [0] * N",
"- xyh += [rl()]",
"+ X[i], Y[i], H[i] = rl()",
"+xyh = list(zip(X, Y, H))",
"+X, Y, H = zip(*xyh)",
"- if xyh[0][2] == 0:",
"- h_m = xyh[0][2] + abs(x - xyh[0][0]) + abs(y - xyh[0][1])",
"- for i in ... | false | 0.051635 | 0.050119 | 1.030244 | [
"s072089190",
"s267553342"
] |
u773265208 | p03436 | python | s059385166 | s191003497 | 50 | 25 | 4,080 | 3,444 | Accepted | Accepted | 50 | import queue
H,W = list(map(int,input().split()))
s = [ list(eval(input())) for _ in range(H)]
count = 0
for i in range(H):
for j in range(W):
if s[i][j] == '.':
count += 1
ans = [[0 for _ in range(W)] for _ in range(H)]
q = queue.Queue()
def bfs(x,y):
global q
global c
q.put([x,y])
s[... | from collections import deque
H,W = list(map(int,input().split()))
c =[]
c.append(['#' for _ in range(W+2)])
ans = [[0 for _ in range(W+2)]for _ in range(H+2)]
score = 0
for i in range(H):
tmp = list('#'+eval(input())+'#')
c.append(tmp)
for j in range(W+2):
if tmp[j] == '.':
... | 48 | 46 | 922 | 1,131 | import queue
H, W = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(H)]
count = 0
for i in range(H):
for j in range(W):
if s[i][j] == ".":
count += 1
ans = [[0 for _ in range(W)] for _ in range(H)]
q = queue.Queue()
def bfs(x, y):
global q
global c
q.put([x... | from collections import deque
H, W = list(map(int, input().split()))
c = []
c.append(["#" for _ in range(W + 2)])
ans = [[0 for _ in range(W + 2)] for _ in range(H + 2)]
score = 0
for i in range(H):
tmp = list("#" + eval(input()) + "#")
c.append(tmp)
for j in range(W + 2):
if tmp[j] == ".":
... | false | 4.166667 | [
"-import queue",
"+from collections import deque",
"-s = [list(eval(input())) for _ in range(H)]",
"-count = 0",
"+c = []",
"+c.append([\"#\" for _ in range(W + 2)])",
"+ans = [[0 for _ in range(W + 2)] for _ in range(H + 2)]",
"+score = 0",
"- for j in range(W):",
"- if s[i][j] == \".\"... | false | 0.046751 | 0.097794 | 0.478061 | [
"s059385166",
"s191003497"
] |
u727148417 | p02702 | python | s832620052 | s346477347 | 198 | 142 | 81,464 | 88,056 | Accepted | Accepted | 28.28 | #import sys
from collections import deque
#def input():
# return sys.stdin.readline()[:-1]
S = deque(list(map(int, list(eval(input())))))
num = 0
dict = {}
dict[0] = 1
ans = 0
for i in range(len(S)):
num += S.pop() * pow(10,i,2019)
cand = num % 2019
if cand in list(dict.keys()):
... | import sys
def input():
return sys.stdin.readline()[:-1]
S = list(map(int, list(eval(input()))))
num = 0
dict = {}
dict[0] = 1
ans = 0
for i , n in enumerate(S[::-1]):
num += n * pow(10,i,2019)
cand = num % 2019
if cand in list(dict.keys()):
dict[cand] += 1
else:
di... | 22 | 21 | 437 | 405 | # import sys
from collections import deque
# def input():
# return sys.stdin.readline()[:-1]
S = deque(list(map(int, list(eval(input())))))
num = 0
dict = {}
dict[0] = 1
ans = 0
for i in range(len(S)):
num += S.pop() * pow(10, i, 2019)
cand = num % 2019
if cand in list(dict.keys()):
dict[cand] +... | import sys
def input():
return sys.stdin.readline()[:-1]
S = list(map(int, list(eval(input()))))
num = 0
dict = {}
dict[0] = 1
ans = 0
for i, n in enumerate(S[::-1]):
num += n * pow(10, i, 2019)
cand = num % 2019
if cand in list(dict.keys()):
dict[cand] += 1
else:
dict[cand] = 1
... | false | 4.545455 | [
"-# import sys",
"-from collections import deque",
"+import sys",
"-# def input():",
"-# return sys.stdin.readline()[:-1]",
"-S = deque(list(map(int, list(eval(input())))))",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+",
"+S = list(map(int, list(eval(input()))))",... | false | 0.03568 | 0.036607 | 0.974664 | [
"s832620052",
"s346477347"
] |
u569117803 | p03610 | python | s410904303 | s730950766 | 29 | 24 | 4,268 | 4,268 | Accepted | Accepted | 17.24 | s = list(eval(input()))
ans_list = []
for v in range(- (-len(s)//2)):
ans_list.append(s[2 * v])
ans = "".join(ans_list)
print(ans) | s = list(eval(input()))
ans_list = [s[2 *i] for i in range(- (-len(s)//2))]
ans = "".join(ans_list)
print(ans) | 7 | 5 | 139 | 113 | s = list(eval(input()))
ans_list = []
for v in range(-(-len(s) // 2)):
ans_list.append(s[2 * v])
ans = "".join(ans_list)
print(ans)
| s = list(eval(input()))
ans_list = [s[2 * i] for i in range(-(-len(s) // 2))]
ans = "".join(ans_list)
print(ans)
| false | 28.571429 | [
"-ans_list = []",
"-for v in range(-(-len(s) // 2)):",
"- ans_list.append(s[2 * v])",
"+ans_list = [s[2 * i] for i in range(-(-len(s) // 2))]"
] | false | 0.044121 | 0.046232 | 0.954355 | [
"s410904303",
"s730950766"
] |
u721316601 | p02948 | python | s946077265 | s235429349 | 454 | 232 | 26,020 | 17,604 | Accepted | Accepted | 48.9 | import heapq
N, M = list(map(int, input().split()))
AB = {}
q = []
ans = 0
for i in range(N):
A, B = list(map(int, input().split()))
if A in AB:
AB[A].append(-B)
else:
AB[A] = [-B]
for i in range(1, M+1):
if i in AB:
for B in AB[i]:
heapq.hea... | import sys
from heapq import heappush, heappop
input = sys.stdin.readline
def main():
N, M = list(map(int, input().split()))
A, B = [[] for i in range(M)], []
for i in range(N):
a, b = list(map(int, input().split()))
if a > M: continue
A[a-1].append(-b)
... | 24 | 28 | 400 | 539 | import heapq
N, M = list(map(int, input().split()))
AB = {}
q = []
ans = 0
for i in range(N):
A, B = list(map(int, input().split()))
if A in AB:
AB[A].append(-B)
else:
AB[A] = [-B]
for i in range(1, M + 1):
if i in AB:
for B in AB[i]:
heapq.heappush(q, B)
if len(... | import sys
from heapq import heappush, heappop
input = sys.stdin.readline
def main():
N, M = list(map(int, input().split()))
A, B = [[] for i in range(M)], []
for i in range(N):
a, b = list(map(int, input().split()))
if a > M:
continue
A[a - 1].append(-b)
ans = 0
... | false | 14.285714 | [
"-import heapq",
"+import sys",
"+from heapq import heappush, heappop",
"-N, M = list(map(int, input().split()))",
"-AB = {}",
"-q = []",
"-ans = 0",
"-for i in range(N):",
"- A, B = list(map(int, input().split()))",
"- if A in AB:",
"- AB[A].append(-B)",
"- else:",
"- ... | false | 0.052968 | 0.036502 | 1.451099 | [
"s946077265",
"s235429349"
] |
u392319141 | p03593 | python | s990854598 | s600287043 | 26 | 24 | 3,316 | 3,316 | Accepted | Accepted | 7.69 | from collections import Counter
H, W = list(map(int, input().split()))
cntA = Counter()
for _ in range(H):
cntA += Counter(list(eval(input())))
if H % 2 + W % 2 == 0:
if all(c % 4 == 0 for c in list(cntA.values())):
print('Yes')
else:
print('No')
exit()
if H % 2 + W % 2 ==... | from collections import Counter
H, W = list(map(int, input().split()))
cntA = Counter()
for _ in range(H):
cntA += Counter(list(eval(input())))
four = (H // 2) * (W // 2)
for a, c in list(cntA.items()):
if four <= 0:
break
while c >= 4 and four > 0:
c -= 4
four -= 1
... | 45 | 30 | 896 | 605 | from collections import Counter
H, W = list(map(int, input().split()))
cntA = Counter()
for _ in range(H):
cntA += Counter(list(eval(input())))
if H % 2 + W % 2 == 0:
if all(c % 4 == 0 for c in list(cntA.values())):
print("Yes")
else:
print("No")
exit()
if H % 2 + W % 2 == 1:
two = ... | from collections import Counter
H, W = list(map(int, input().split()))
cntA = Counter()
for _ in range(H):
cntA += Counter(list(eval(input())))
four = (H // 2) * (W // 2)
for a, c in list(cntA.items()):
if four <= 0:
break
while c >= 4 and four > 0:
c -= 4
four -= 1
cntA[a] = c
... | false | 33.333333 | [
"-if H % 2 + W % 2 == 0:",
"- if all(c % 4 == 0 for c in list(cntA.values())):",
"- print(\"Yes\")",
"+four = (H // 2) * (W // 2)",
"+for a, c in list(cntA.items()):",
"+ if four <= 0:",
"+ break",
"+ while c >= 4 and four > 0:",
"+ c -= 4",
"+ four -= 1",
"+... | false | 0.084175 | 0.039558 | 2.127867 | [
"s990854598",
"s600287043"
] |
u888092736 | p03627 | python | s084191105 | s502970035 | 94 | 70 | 24,224 | 24,232 | Accepted | Accepted | 25.53 | from collections import Counter
N = int(eval(input()))
c = Counter(list(map(int, input().split())))
usables = sorted([(k, v) for k, v in list(c.items()) if v >= 2])
if len(usables) <= 1:
print((0))
else:
if usables[-1][1] >= 4:
print((usables[-1][0] ** 2))
else:
print((usables[... | from collections import Counter
def solve():
N = int(eval(input()))
c = Counter(list(map(int, input().split())))
usables = sorted([k for k, v in list(c.items()) if v > 1])
if len(usables) == 0:
return 0
else:
ans = usables[-1]
if c[ans] > 3:
return... | 13 | 22 | 322 | 466 | from collections import Counter
N = int(eval(input()))
c = Counter(list(map(int, input().split())))
usables = sorted([(k, v) for k, v in list(c.items()) if v >= 2])
if len(usables) <= 1:
print((0))
else:
if usables[-1][1] >= 4:
print((usables[-1][0] ** 2))
else:
print((usables[-1][0] * usab... | from collections import Counter
def solve():
N = int(eval(input()))
c = Counter(list(map(int, input().split())))
usables = sorted([k for k, v in list(c.items()) if v > 1])
if len(usables) == 0:
return 0
else:
ans = usables[-1]
if c[ans] > 3:
return ans**2
... | false | 40.909091 | [
"-N = int(eval(input()))",
"-c = Counter(list(map(int, input().split())))",
"-usables = sorted([(k, v) for k, v in list(c.items()) if v >= 2])",
"-if len(usables) <= 1:",
"- print((0))",
"-else:",
"- if usables[-1][1] >= 4:",
"- print((usables[-1][0] ** 2))",
"+",
"+def solve():",
"... | false | 0.044654 | 0.051641 | 0.864699 | [
"s084191105",
"s502970035"
] |
u231095456 | p03643 | python | s124646864 | s760204348 | 28 | 25 | 9,068 | 9,136 | Accepted | Accepted | 10.71 | print(("ABC"+eval(input()))) | print((eval(input("ABC")))) | 1 | 1 | 20 | 19 | print(("ABC" + eval(input())))
| print((eval(input("ABC"))))
| false | 0 | [
"-print((\"ABC\" + eval(input())))",
"+print((eval(input(\"ABC\"))))"
] | false | 0.044793 | 0.044223 | 1.012882 | [
"s124646864",
"s760204348"
] |
u565387531 | p03013 | python | s780348186 | s530744988 | 1,719 | 253 | 6,900 | 6,900 | Accepted | Accepted | 85.28 | N, M = list(map(int, input().split()))
mod_num = 10 ** 9 + 7
a = [0] * N
for i in range(M):
a[i] = int(eval(input()))
val = [0,1]
for i in range(1, N + 1):
ans = (val[0] + val[1]) % mod_num
val[0] = val[1]
val[1] = ans
if len(a) > 0:
if i == a[0]:
val[1] = 0
... | N, M = list(map(int, input().split()))
mod_num = 10 ** 9 + 7
a = [0] * N
for i in range(M):
a[i] = int(eval(input()))
val = [0,1]
j = 0
for i in range(1, N + 1):
ans = (val[0] + val[1]) % mod_num
val[0] = val[1]
val[1] = ans
if len(a) > 0:
if i == a[j]:
val[1] ... | 19 | 21 | 341 | 383 | N, M = list(map(int, input().split()))
mod_num = 10**9 + 7
a = [0] * N
for i in range(M):
a[i] = int(eval(input()))
val = [0, 1]
for i in range(1, N + 1):
ans = (val[0] + val[1]) % mod_num
val[0] = val[1]
val[1] = ans
if len(a) > 0:
if i == a[0]:
val[1] = 0
a.pop(0)
p... | N, M = list(map(int, input().split()))
mod_num = 10**9 + 7
a = [0] * N
for i in range(M):
a[i] = int(eval(input()))
val = [0, 1]
j = 0
for i in range(1, N + 1):
ans = (val[0] + val[1]) % mod_num
val[0] = val[1]
val[1] = ans
if len(a) > 0:
if i == a[j]:
val[1] = 0
if l... | false | 9.52381 | [
"+j = 0",
"- if i == a[0]:",
"+ if i == a[j]:",
"- a.pop(0)",
"+ if len(a) - 1 != j:",
"+ j += 1"
] | false | 0.093034 | 0.038529 | 2.414662 | [
"s780348186",
"s530744988"
] |
u633255271 | p02585 | python | s702469022 | s658810096 | 585 | 321 | 132,104 | 69,328 | Accepted | Accepted | 45.13 | 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**9-1
for i in range(N):
seen = [-1]*N
cumsum = [0]*(N+1)
now = i
j = 0
while seen[now] == -1:
seen[now] = 1
now = P[now]
cumsum[j... | from itertools import accumulate
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**18-1
seen = [False]*N
for i in range(N):
if seen[i]:
continue
loop = []
now = i
while seen[now] == False:
... | 27 | 26 | 841 | 729 | 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**9) - 1
for i in range(N):
seen = [-1] * N
cumsum = [0] * (N + 1)
now = i
j = 0
while seen[now] == -1:
seen[now] = 1
now = P[now]
cumsum[j + 1... | from itertools import accumulate
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**18) - 1
seen = [False] * N
for i in range(N):
if seen[i]:
continue
loop = []
now = i
while seen[now] == False:
seen[now... | false | 3.703704 | [
"+from itertools import accumulate",
"+",
"-ans = -(10**9) - 1",
"+ans = -(10**18) - 1",
"+seen = [False] * N",
"- seen = [-1] * N",
"- cumsum = [0] * (N + 1)",
"+ if seen[i]:",
"+ continue",
"+ loop = []",
"- j = 0",
"- while seen[now] == -1:",
"- seen[now] =... | false | 0.057593 | 0.079753 | 0.722144 | [
"s702469022",
"s658810096"
] |
u532966492 | p02981 | python | s003718017 | s622335207 | 21 | 18 | 3,316 | 2,940 | Accepted | Accepted | 14.29 | N,A,B=list(map(int,input().split()))
print((min(N*A,B))) | n,a,b=list(map(int,input().split()))
print((min(n*a,b))) | 2 | 2 | 49 | 49 | N, A, B = list(map(int, input().split()))
print((min(N * A, B)))
| n, a, b = list(map(int, input().split()))
print((min(n * a, b)))
| false | 0 | [
"-N, A, B = list(map(int, input().split()))",
"-print((min(N * A, B)))",
"+n, a, b = list(map(int, input().split()))",
"+print((min(n * a, b)))"
] | false | 0.113447 | 0.069561 | 1.630908 | [
"s003718017",
"s622335207"
] |
u893962649 | p02707 | python | s892578784 | s729153904 | 179 | 131 | 32,372 | 32,228 | Accepted | Accepted | 26.82 | N = int(eval(input()))
A = list(map(int, input().split()))
man=1
cnt=0
man_list=[0]*N
A.sort()
A += [0]
for a in A:
if a != man:
man_list[man-1] = cnt
man = a
cnt=0
cnt+=1
print((*man_list)) | N = int(eval(input()))
A = list(map(int, input().split()))
man_list=[0]*N
for a in A:
man_list[a-1] += 1
print((*man_list)) | 18 | 9 | 219 | 128 | N = int(eval(input()))
A = list(map(int, input().split()))
man = 1
cnt = 0
man_list = [0] * N
A.sort()
A += [0]
for a in A:
if a != man:
man_list[man - 1] = cnt
man = a
cnt = 0
cnt += 1
print((*man_list))
| N = int(eval(input()))
A = list(map(int, input().split()))
man_list = [0] * N
for a in A:
man_list[a - 1] += 1
print((*man_list))
| false | 50 | [
"-man = 1",
"-cnt = 0",
"-A.sort()",
"-A += [0]",
"- if a != man:",
"- man_list[man - 1] = cnt",
"- man = a",
"- cnt = 0",
"- cnt += 1",
"+ man_list[a - 1] += 1"
] | false | 0.043335 | 0.037937 | 1.142287 | [
"s892578784",
"s729153904"
] |
u145231176 | p03557 | python | s950478424 | s762938335 | 537 | 391 | 119,956 | 116,156 | Accepted | Accepted | 27.19 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
from collections import d... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | 54 | 84 | 1,150 | 1,998 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
from collections import def... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | false | 35.714286 | [
"+def rand_N(ran1, ran2):",
"+ return random.randint(ran1, ran2)",
"+",
"+",
"+def rand_List(ran1, ran2, rantime):",
"+ return [random.randint(ran1, ran2) for i in range(rantime)]",
"+",
"+",
"+def rand_ints_nodup(ran1, ran2, rantime):",
"+ ns = []",
"+ while len(ns) < rantime:",
"... | false | 0.072358 | 0.166771 | 0.433873 | [
"s950478424",
"s762938335"
] |
u809819902 | p02641 | python | s837974082 | s142679810 | 32 | 29 | 9,200 | 9,180 | Accepted | Accepted | 9.38 | x,n=list(map(int,input().split()))
p=list(map(int, input().split()))
youso=[]
for i in range(-300,1000):
if not i in p:
youso+=[i]
hikaku=[]
for i in youso:
hikaku+=[(i,abs(x-i))]
hikaku1=sorted(hikaku,key=lambda x:x[1])
res=hikaku1[0][0]
print(res) | x,n=list(map(int,input().split()))
p=list(map(int, input().split()))
if not x in p:print(x)
else:
for i in range(500):
if not x-i in p:
print((x-i))
break
elif not x+i in p:
print((x+i))
break | 12 | 11 | 270 | 260 | x, n = list(map(int, input().split()))
p = list(map(int, input().split()))
youso = []
for i in range(-300, 1000):
if not i in p:
youso += [i]
hikaku = []
for i in youso:
hikaku += [(i, abs(x - i))]
hikaku1 = sorted(hikaku, key=lambda x: x[1])
res = hikaku1[0][0]
print(res)
| x, n = list(map(int, input().split()))
p = list(map(int, input().split()))
if not x in p:
print(x)
else:
for i in range(500):
if not x - i in p:
print((x - i))
break
elif not x + i in p:
print((x + i))
break
| false | 8.333333 | [
"-youso = []",
"-for i in range(-300, 1000):",
"- if not i in p:",
"- youso += [i]",
"-hikaku = []",
"-for i in youso:",
"- hikaku += [(i, abs(x - i))]",
"-hikaku1 = sorted(hikaku, key=lambda x: x[1])",
"-res = hikaku1[0][0]",
"-print(res)",
"+if not x in p:",
"+ print(x)",
"... | false | 0.044036 | 0.042633 | 1.032902 | [
"s837974082",
"s142679810"
] |
u329143273 | p03284 | python | s678594042 | s441950091 | 20 | 18 | 3,060 | 2,940 | Accepted | Accepted | 10 | n,k=list(map(int,input().split()))
if n%k>=1:
print((1))
else:
print((0)) | a,b=list(map(int,input().split()))
print((1 if a%b else 0)) | 5 | 2 | 71 | 52 | n, k = list(map(int, input().split()))
if n % k >= 1:
print((1))
else:
print((0))
| a, b = list(map(int, input().split()))
print((1 if a % b else 0))
| false | 60 | [
"-n, k = list(map(int, input().split()))",
"-if n % k >= 1:",
"- print((1))",
"-else:",
"- print((0))",
"+a, b = list(map(int, input().split()))",
"+print((1 if a % b else 0))"
] | false | 0.036272 | 0.035859 | 1.011504 | [
"s678594042",
"s441950091"
] |
u367130284 | p03682 | python | s628965863 | s665774010 | 1,616 | 1,246 | 89,408 | 53,020 | Accepted | Accepted | 22.9 | import sys
from heapq import*
from collections import*
input=sys.stdin.readline
p=defaultdict(lambda: -1)
class UNION_FIND(object):
def __init__(self,n):
self.parent=defaultdict(lambda: -1)
def root(self,x):
if type(self.parent[x])!=tuple:
return x
... | #import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph)
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse import csr_matrix
from collections import* #defaultdict Counter deque appendleft
f... | 61 | 76 | 1,472 | 2,199 | import sys
from heapq import *
from collections import *
input = sys.stdin.readline
p = defaultdict(lambda: -1)
class UNION_FIND(object):
def __init__(self, n):
self.parent = defaultdict(lambda: -1)
def root(self, x):
if type(self.parent[x]) != tuple:
return x
else:
... | # import numpy as np
# from numpy import*
# from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph)
# from scipy.sparse.csgraph import dijkstra
# from scipy.sparse.csgraph import floyd_warshall
# from scipy.sparse import csr_matrix
from collections import * # defaultdict Counter deque appendleft
f... | false | 19.736842 | [
"+# import numpy as np",
"+# from numpy import*",
"+# from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph)",
"+# from scipy.sparse.csgraph import dijkstra",
"+# from scipy.sparse.csgraph import floyd_warshall",
"+# from scipy.sparse import csr_matrix",
"+from collections import *... | false | 0.160937 | 0.048807 | 3.297427 | [
"s628965863",
"s665774010"
] |
u075012704 | p03151 | python | s670302349 | s750159225 | 253 | 111 | 21,552 | 19,068 | Accepted | Accepted | 56.13 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
# 各テストの余裕を小さい順に
margins = [[i, a - b] for i, (a, b) in enumerate(zip(A, B)) if (a - b) > 0]
margins.sort(key=lambda m: m[1])
# 調整済みA
X = A[:]
# 余裕が大きい方から使っていく
for i in range(N):
while (A[i] < B[i]) and m... | from itertools import accumulate
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
surplus = [(a - b) for a, b in zip(A, B) if (a - b) > 0]
surplus.sort(reverse=True)
surplus_acc = [0] + list(accumulate(surplus))
short = [(b - a) for a, b in zip(A, B) if (b - a)... | 39 | 23 | 758 | 555 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
# 各テストの余裕を小さい順に
margins = [[i, a - b] for i, (a, b) in enumerate(zip(A, B)) if (a - b) > 0]
margins.sort(key=lambda m: m[1])
# 調整済みA
X = A[:]
# 余裕が大きい方から使っていく
for i in range(N):
while (A[i] < B[i]) and margins:
co... | from itertools import accumulate
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
surplus = [(a - b) for a, b in zip(A, B) if (a - b) > 0]
surplus.sort(reverse=True)
surplus_acc = [0] + list(accumulate(surplus))
short = [(b - a) for a, b in zip(A, B) if (b - a) > 0]
need =... | false | 41.025641 | [
"+from itertools import accumulate",
"+",
"-# 各テストの余裕を小さい順に",
"-margins = [[i, a - b] for i, (a, b) in enumerate(zip(A, B)) if (a - b) > 0]",
"-margins.sort(key=lambda m: m[1])",
"-# 調整済みA",
"-X = A[:]",
"-# 余裕が大きい方から使っていく",
"-for i in range(N):",
"- while (A[i] < B[i]) and margins:",
"- ... | false | 0.037286 | 0.036334 | 1.02621 | [
"s670302349",
"s750159225"
] |
u724687935 | p02787 | python | s288003928 | s286951517 | 374 | 298 | 46,172 | 40,560 | Accepted | Accepted | 20.32 | def main():
import sys
readline = sys.stdin.readline
# readlines = sys.stdin.readlines
H, N = list(map(int, input().split()))
M = [tuple(map(int, readline().split())) for _ in range(N)]
INF = float('inf')
dp = [INF] * (H + 1)
dp[0] = 0
for i in range(N):
a, b ... | def main():
import sys
readline = sys.stdin.readline
# readlines = sys.stdin.readlines
H, N = list(map(int, input().split()))
M = [tuple(map(int, readline().split())) for _ in range(N)]
INF = 10 ** 9
dp = [INF] * (H + 1)
dp[0] = 0
for i in range(N):
a, b = M[i... | 21 | 21 | 490 | 485 | def main():
import sys
readline = sys.stdin.readline
# readlines = sys.stdin.readlines
H, N = list(map(int, input().split()))
M = [tuple(map(int, readline().split())) for _ in range(N)]
INF = float("inf")
dp = [INF] * (H + 1)
dp[0] = 0
for i in range(N):
a, b = M[i]
... | def main():
import sys
readline = sys.stdin.readline
# readlines = sys.stdin.readlines
H, N = list(map(int, input().split()))
M = [tuple(map(int, readline().split())) for _ in range(N)]
INF = 10**9
dp = [INF] * (H + 1)
dp[0] = 0
for i in range(N):
a, b = M[i]
for j i... | false | 0 | [
"- INF = float(\"inf\")",
"+ INF = 10**9"
] | false | 0.11891 | 0.113295 | 1.049558 | [
"s288003928",
"s286951517"
] |
u879309973 | p03378 | python | s888289144 | s977168181 | 11 | 10 | 2,572 | 2,568 | Accepted | Accepted | 9.09 | n, m, x = list(map(int, input().split()))
a = [0] * (n + 1)
for _ in map(int, input().split()):
a[_ - 1] = 1
print(min(sum(a[:x - 1]), sum(a[x:])))
| N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
p = len([a for a in A if a < X])
q = len([a for a in A if a > X])
print(min(p, q)) | 7 | 5 | 161 | 165 | n, m, x = list(map(int, input().split()))
a = [0] * (n + 1)
for _ in map(int, input().split()):
a[_ - 1] = 1
print(min(sum(a[: x - 1]), sum(a[x:])))
| N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
p = len([a for a in A if a < X])
q = len([a for a in A if a > X])
print(min(p, q))
| false | 28.571429 | [
"-n, m, x = list(map(int, input().split()))",
"-a = [0] * (n + 1)",
"-for _ in map(int, input().split()):",
"- a[_ - 1] = 1",
"-print(min(sum(a[: x - 1]), sum(a[x:])))",
"+N, M, X = list(map(int, input().split()))",
"+A = list(map(int, input().split()))",
"+p = len([a for a in A if a < X])",
"+q ... | false | 0.04314 | 0.043607 | 0.9893 | [
"s888289144",
"s977168181"
] |
u380524497 | p03660 | python | s491263830 | s881212599 | 589 | 459 | 110,276 | 27,704 | Accepted | Accepted | 22.07 | import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
n = int(eval(input()))
edges = [[] for _ in range(n)]
for _ in range(n-1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
edges[a].append(b)
edges[b].append(a)
seen = [-1] * n
def dfs(node, prev):
i... | import sys
input = sys.stdin.readline
n = int(eval(input()))
edges = [[] for _ in range(n)]
for _ in range(n-1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
edges[a].append(b)
edges[b].append(a)
seen = [-1] * n
todo = [(0, 0)]
while todo:
node, prev = todo.pop()
... | 73 | 73 | 1,371 | 1,425 | import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
n = int(eval(input()))
edges = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
edges[a].append(b)
edges[b].append(a)
seen = [-1] * n
def dfs(node, prev):
if seen[node] != -1:
... | import sys
input = sys.stdin.readline
n = int(eval(input()))
edges = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
edges[a].append(b)
edges[b].append(a)
seen = [-1] * n
todo = [(0, 0)]
while todo:
node, prev = todo.pop()
if seen[node] != ... | false | 0 | [
"-sys.setrecursionlimit(10**6)",
"-",
"-",
"-def dfs(node, prev):",
"+todo = [(0, 0)]",
"+while todo:",
"+ node, prev = todo.pop()",
"- return",
"+ continue",
"- dfs(to, node)",
"-",
"-",
"-dfs(0, 0)",
"+ if seen[to] != -1:",
"+ continue",
"+ ... | false | 0.073284 | 0.041857 | 1.750817 | [
"s491263830",
"s881212599"
] |
u362291462 | p03163 | python | s012333372 | s765758901 | 617 | 283 | 119,740 | 45,680 | Accepted | Accepted | 54.13 | from sys import stdin
n,W=list(map(int,input().split()))
k=[[0 for i in range(W+1)] for i in range(2)]
for i in range(1,n+1):
w,v=list(map(int,stdin.readline().split()))
for j in range(1,W+1):
if w<=j:
k[1][j]=max(v+k[0][j-w],k[0][j])
else:
k[1][j]=k[0][j]
k... | from sys import stdin
n,W=list(map(int,input().split()))
dp=[0 for i in range(W+1)]
for i in range(n):
w,v=list(map(int,stdin.readline().split()))
for j in range(W-w,-1,-1):
dp[j+w]=max(dp[j]+v,dp[j+w])
print((dp[-1])) | 13 | 8 | 366 | 227 | from sys import stdin
n, W = list(map(int, input().split()))
k = [[0 for i in range(W + 1)] for i in range(2)]
for i in range(1, n + 1):
w, v = list(map(int, stdin.readline().split()))
for j in range(1, W + 1):
if w <= j:
k[1][j] = max(v + k[0][j - w], k[0][j])
else:
k[1... | from sys import stdin
n, W = list(map(int, input().split()))
dp = [0 for i in range(W + 1)]
for i in range(n):
w, v = list(map(int, stdin.readline().split()))
for j in range(W - w, -1, -1):
dp[j + w] = max(dp[j] + v, dp[j + w])
print((dp[-1]))
| false | 38.461538 | [
"-k = [[0 for i in range(W + 1)] for i in range(2)]",
"-for i in range(1, n + 1):",
"+dp = [0 for i in range(W + 1)]",
"+for i in range(n):",
"- for j in range(1, W + 1):",
"- if w <= j:",
"- k[1][j] = max(v + k[0][j - w], k[0][j])",
"- else:",
"- k[1][j] = k[0... | false | 0.039795 | 0.070685 | 0.562993 | [
"s012333372",
"s765758901"
] |
u631755487 | p02995 | python | s673211975 | s019764794 | 38 | 35 | 5,048 | 5,048 | Accepted | Accepted | 7.89 | from fractions import gcd
a, b, c, d = list(map(int, input().split(' ')))
# cye bolunenler
c_numbers = b//c - (a-1)//c
# dye bolunenler
d_numbers = b//d - (a-1)//d
# ortak bolunenler
gcd_number = c*d // gcd(c, d)
ortak = b//(gcd_number) - (a-1)//(gcd_number)
# result
print((b-a+1-(c_numbers+d_numbers-ortak)... | from fractions import gcd
a, b, c, d = list(map(int, input().split(' ')))
# cye bolunenler
c_numbers = b//c - (a-1)//c
# dye bolunenler
d_numbers = b//d - (a-1)//d
# ortak bolunenler
gcd_number = c*d // gcd(c, d)
ortak = b//gcd_number - (a-1)//gcd_number
# result
print((b-a+1-(c_numbers+d_numbers-ortak))) | 12 | 12 | 314 | 310 | from fractions import gcd
a, b, c, d = list(map(int, input().split(" ")))
# cye bolunenler
c_numbers = b // c - (a - 1) // c
# dye bolunenler
d_numbers = b // d - (a - 1) // d
# ortak bolunenler
gcd_number = c * d // gcd(c, d)
ortak = b // (gcd_number) - (a - 1) // (gcd_number)
# result
print((b - a + 1 - (c_numbers +... | from fractions import gcd
a, b, c, d = list(map(int, input().split(" ")))
# cye bolunenler
c_numbers = b // c - (a - 1) // c
# dye bolunenler
d_numbers = b // d - (a - 1) // d
# ortak bolunenler
gcd_number = c * d // gcd(c, d)
ortak = b // gcd_number - (a - 1) // gcd_number
# result
print((b - a + 1 - (c_numbers + d_n... | false | 0 | [
"-ortak = b // (gcd_number) - (a - 1) // (gcd_number)",
"+ortak = b // gcd_number - (a - 1) // gcd_number"
] | false | 0.008112 | 0.169645 | 0.047818 | [
"s673211975",
"s019764794"
] |
u072053884 | p02296 | python | s310484994 | s078458199 | 80 | 20 | 7,968 | 7,940 | Accepted | Accepted | 75 | class Point:
def __init__(self, x , y):
self.x = x
self.y = y
def __sub__(self, p):
x_sub = self.x - p.x
y_sub = self.y - p.y
return Point(x_sub, y_sub)
class Vector:
def __init__(self, p):
self.x = p.x
self.y = p.y
self.norm = (p... | def cross(c1, c2):
return c1.real * c2.imag - c1.imag * c2.real
def dot(c1, c2):
return c1.real * c2.real + c1.imag * c2.imag
def ccw(p0, p1, p2):
a = p1 - p0
b = p2 - p0
cross_ab = cross(a, b)
if cross_ab > 0:
return 1
elif cross_ab < 0:
return -1
elif do... | 76 | 64 | 1,840 | 1,625 | class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def __sub__(self, p):
x_sub = self.x - p.x
y_sub = self.y - p.y
return Point(x_sub, y_sub)
class Vector:
def __init__(self, p):
self.x = p.x
self.y = p.y
self.norm = (p.x**2 + p.y*... | def cross(c1, c2):
return c1.real * c2.imag - c1.imag * c2.real
def dot(c1, c2):
return c1.real * c2.real + c1.imag * c2.imag
def ccw(p0, p1, p2):
a = p1 - p0
b = p2 - p0
cross_ab = cross(a, b)
if cross_ab > 0:
return 1
elif cross_ab < 0:
return -1
elif dot(a, b) < 0:... | false | 15.789474 | [
"-class Point:",
"- def __init__(self, x, y):",
"- self.x = x",
"- self.y = y",
"-",
"- def __sub__(self, p):",
"- x_sub = self.x - p.x",
"- y_sub = self.y - p.y",
"- return Point(x_sub, y_sub)",
"+def cross(c1, c2):",
"+ return c1.real * c2.imag - c1.... | false | 0.034877 | 0.036265 | 0.961716 | [
"s310484994",
"s078458199"
] |
u924691798 | p02659 | python | s138126404 | s188260187 | 24 | 22 | 9,036 | 9,128 | Accepted | Accepted | 8.33 | A, B = list(map(float, input().split()))
A = int(A)
B = int(B*100+0.1)
print((int(A*B//100))) | A, B = input().split()
A = int(A)
B = int(float(B)*100+0.1)
print((int(A*B//100)))
| 4 | 4 | 88 | 84 | A, B = list(map(float, input().split()))
A = int(A)
B = int(B * 100 + 0.1)
print((int(A * B // 100)))
| A, B = input().split()
A = int(A)
B = int(float(B) * 100 + 0.1)
print((int(A * B // 100)))
| false | 0 | [
"-A, B = list(map(float, input().split()))",
"+A, B = input().split()",
"-B = int(B * 100 + 0.1)",
"+B = int(float(B) * 100 + 0.1)"
] | false | 0.036792 | 0.036505 | 1.007877 | [
"s138126404",
"s188260187"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.