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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u069838609 | p03714 | python | s135808051 | s184351853 | 829 | 352 | 39,516 | 41,564 | Accepted | Accepted | 57.54 | import sys
# If available, use C implementation
try:
from _heapq import heapify, heappushpop
except ImportError:
from heapq import heapify, heappushpop
try:
from _heapq import _heapreplace_max
except ImportError:
pass
try:
from _heapq import _heapify_max as heapify_max
except ImportError... | import sys
from heapq import heapify, heappushpop
fin = sys.stdin.readline
N = int(fin())
a_list = [int(elem) for elem in fin().split()]
left_pq = a_list[:N]
right_pq = [-item for item in a_list[2 * N:]]
heapify(left_pq)
heapify(right_pq)
left_sum = [sum(left_pq)]
right_sum = [sum(right_pq)]
for k in... | 46 | 23 | 1,225 | 641 | import sys
# If available, use C implementation
try:
from _heapq import heapify, heappushpop
except ImportError:
from heapq import heapify, heappushpop
try:
from _heapq import _heapreplace_max
except ImportError:
pass
try:
from _heapq import _heapify_max as heapify_max
except ImportError:
from ... | import sys
from heapq import heapify, heappushpop
fin = sys.stdin.readline
N = int(fin())
a_list = [int(elem) for elem in fin().split()]
left_pq = a_list[:N]
right_pq = [-item for item in a_list[2 * N :]]
heapify(left_pq)
heapify(right_pq)
left_sum = [sum(left_pq)]
right_sum = [sum(right_pq)]
for k in range(N, 2 * N):... | false | 50 | [
"-",
"-# If available, use C implementation",
"-try:",
"- from _heapq import heapify, heappushpop",
"-except ImportError:",
"- from heapq import heapify, heappushpop",
"-try:",
"- from _heapq import _heapreplace_max",
"-except ImportError:",
"- pass",
"-try:",
"- from _heapq imp... | false | 0.035858 | 0.035272 | 1.016628 | [
"s135808051",
"s184351853"
] |
u991567869 | p02971 | python | s185680512 | s022612019 | 876 | 559 | 50,180 | 14,112 | Accepted | Accepted | 36.19 | n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
a1 = []
b = []
for s in a:
a1.extend(s)
b = sorted(a1)
for i in range(n):
if a1[i] == b[n - 1]:
print((b[n - 2]))
else:
print((b[n - 1])) | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = sorted(a)
for i in range(n):
if a[i] == b[n - 1]:
print((b[n - 2]))
else:
print((b[n - 1])) | 13 | 9 | 247 | 178 | n = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(n)]
a1 = []
b = []
for s in a:
a1.extend(s)
b = sorted(a1)
for i in range(n):
if a1[i] == b[n - 1]:
print((b[n - 2]))
else:
print((b[n - 1]))
| n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = sorted(a)
for i in range(n):
if a[i] == b[n - 1]:
print((b[n - 2]))
else:
print((b[n - 1]))
| false | 30.769231 | [
"-a = [list(map(int, input().split())) for _ in range(n)]",
"-a1 = []",
"-b = []",
"-for s in a:",
"- a1.extend(s)",
"-b = sorted(a1)",
"+a = [int(eval(input())) for _ in range(n)]",
"+b = sorted(a)",
"- if a1[i] == b[n - 1]:",
"+ if a[i] == b[n - 1]:"
] | false | 0.043721 | 0.101226 | 0.431915 | [
"s185680512",
"s022612019"
] |
u924308178 | p03478 | python | s414424877 | s629369685 | 34 | 27 | 3,300 | 3,296 | Accepted | Accepted | 20.59 | N,A,B = list(map(int,input().split(" ")))
def check(n,c):
c+=n%10
return (c if n/10==0 else check(int(n/10),c))
print((sum([i for i in range(1,N+1) if A<=check(i,0)<=B])))
| N,A,B = list(map(int,input().split(" ")))
print((sum([i for i in range(1,N+1) if A<=sum(map(int,str(i)))<=B])))
| 8 | 4 | 190 | 115 | N, A, B = list(map(int, input().split(" ")))
def check(n, c):
c += n % 10
return c if n / 10 == 0 else check(int(n / 10), c)
print((sum([i for i in range(1, N + 1) if A <= check(i, 0) <= B])))
| N, A, B = list(map(int, input().split(" ")))
print((sum([i for i in range(1, N + 1) if A <= sum(map(int, str(i))) <= B])))
| false | 50 | [
"-",
"-",
"-def check(n, c):",
"- c += n % 10",
"- return c if n / 10 == 0 else check(int(n / 10), c)",
"-",
"-",
"-print((sum([i for i in range(1, N + 1) if A <= check(i, 0) <= B])))",
"+print((sum([i for i in range(1, N + 1) if A <= sum(map(int, str(i))) <= B])))"
] | false | 0.099852 | 0.097055 | 1.028814 | [
"s414424877",
"s629369685"
] |
u496821919 | p02583 | python | s503022658 | s243162995 | 159 | 123 | 9,196 | 8,960 | Accepted | Accepted | 22.64 | from itertools import combinations
n = int(eval(input()))
L = list(map(int,input().split()))
ans = 0
for x in combinations(L,3):
a,b,c = list(map(int,x))
if a == b or b == c or c == a:
continue
ans += (2*max(a,b,c) < a+b+c)
print(ans) | from itertools import combinations
n = int(eval(input()))
L = list(map(int,input().split()))
ans = 0
for a,b,c in combinations(L,3):
ans += (2*max(a,b,c) < a+b+c)*(a != b and b != c and c != a)
print(ans) | 10 | 7 | 251 | 208 | from itertools import combinations
n = int(eval(input()))
L = list(map(int, input().split()))
ans = 0
for x in combinations(L, 3):
a, b, c = list(map(int, x))
if a == b or b == c or c == a:
continue
ans += 2 * max(a, b, c) < a + b + c
print(ans)
| from itertools import combinations
n = int(eval(input()))
L = list(map(int, input().split()))
ans = 0
for a, b, c in combinations(L, 3):
ans += (2 * max(a, b, c) < a + b + c) * (a != b and b != c and c != a)
print(ans)
| false | 30 | [
"-for x in combinations(L, 3):",
"- a, b, c = list(map(int, x))",
"- if a == b or b == c or c == a:",
"- continue",
"- ans += 2 * max(a, b, c) < a + b + c",
"+for a, b, c in combinations(L, 3):",
"+ ans += (2 * max(a, b, c) < a + b + c) * (a != b and b != c and c != a)"
] | false | 0.045525 | 0.044531 | 1.022322 | [
"s503022658",
"s243162995"
] |
u400765446 | p02390 | python | s738018731 | s369737492 | 30 | 20 | 7,760 | 5,588 | Accepted | Accepted | 33.33 | def main():
x = eval(input())
y = int(x)
h, z = divmod(y, 3600)
m, s = divmod(z, 60)
print((str(h)+":"+str(m)+":"+str(s)))
if __name__ == "__main__":
main() | S = int(input())
h, tmp = divmod(S, 3600)
m, s = divmod(tmp, 60)
print(h,m,s,sep=':')
| 10 | 4 | 187 | 89 | def main():
x = eval(input())
y = int(x)
h, z = divmod(y, 3600)
m, s = divmod(z, 60)
print((str(h) + ":" + str(m) + ":" + str(s)))
if __name__ == "__main__":
main()
| S = int(input())
h, tmp = divmod(S, 3600)
m, s = divmod(tmp, 60)
print(h, m, s, sep=":")
| false | 60 | [
"-def main():",
"- x = eval(input())",
"- y = int(x)",
"- h, z = divmod(y, 3600)",
"- m, s = divmod(z, 60)",
"- print((str(h) + \":\" + str(m) + \":\" + str(s)))",
"-",
"-",
"-if __name__ == \"__main__\":",
"- main()",
"+S = int(input())",
"+h, tmp = divmod(S, 3600)",
"+m, ... | false | 0.048546 | 0.049083 | 0.989061 | [
"s738018731",
"s369737492"
] |
u354638986 | p03696 | python | s629270561 | s221695719 | 25 | 17 | 3,444 | 2,940 | Accepted | Accepted | 32 | from collections import deque
def check(s):
x = 0
for i in range(len(s)):
if s[i] == "(":
x += 1
else:
x -= 1
if x < 0:
return False
if x == 0:
return True
else:
return False
def main():
n, s = int... | def main():
n, s = int(eval(input())), eval(input())
cnt, f = 0, 0
for i in range(n):
if s[i] == "(":
cnt += 1
else:
cnt -= 1
if cnt < 0:
f += 1
cnt = 0
ans = f * "(" + s + cnt * ")"
print(ans)
i... | 59 | 19 | 1,131 | 346 | from collections import deque
def check(s):
x = 0
for i in range(len(s)):
if s[i] == "(":
x += 1
else:
x -= 1
if x < 0:
return False
if x == 0:
return True
else:
return False
def main():
n, s = int(eval(input())), eval(i... | def main():
n, s = int(eval(input())), eval(input())
cnt, f = 0, 0
for i in range(n):
if s[i] == "(":
cnt += 1
else:
cnt -= 1
if cnt < 0:
f += 1
cnt = 0
ans = f * "(" + s + cnt * ")"
print(ans)
if __name__ == "__ma... | false | 67.79661 | [
"-from collections import deque",
"-",
"-",
"-def check(s):",
"- x = 0",
"- for i in range(len(s)):",
"- if s[i] == \"(\":",
"- x += 1",
"- else:",
"- x -= 1",
"- if x < 0:",
"- return False",
"- if x == 0:",
"- return T... | false | 0.035941 | 0.035934 | 1.00021 | [
"s629270561",
"s221695719"
] |
u867848444 | p02936 | python | s632403558 | s031086784 | 1,997 | 1,531 | 121,500 | 134,640 | Accepted | Accepted | 23.34 | from collections import deque
#グラフの連結成分を調べる
def Graph(ab):
G=[[] for i in range(n)]
for a,b in ab:
G[a-1].append(b)
G[b-1].append(a)
return G
n, q = list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(n - 1)]
px = [list(map(int,input().split())) for... | import sys
input=sys.stdin.readline
from collections import deque
#グラフの連結成分を調べる
def Graph(ab):
G=[[] for i in range(n)]
for a,b in ab:
G[a-1].append(b)
G[b-1].append(a)
return G
n, q = list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(n - 1)]
px... | 30 | 32 | 638 | 676 | from collections import deque
# グラフの連結成分を調べる
def Graph(ab):
G = [[] for i in range(n)]
for a, b in ab:
G[a - 1].append(b)
G[b - 1].append(a)
return G
n, q = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(n - 1)]
px = [list(map(int, input().split())) f... | import sys
input = sys.stdin.readline
from collections import deque
# グラフの連結成分を調べる
def Graph(ab):
G = [[] for i in range(n)]
for a, b in ab:
G[a - 1].append(b)
G[b - 1].append(a)
return G
n, q = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(n - 1)]
... | false | 6.25 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.03285 | 0.035895 | 0.915173 | [
"s632403558",
"s031086784"
] |
u838644735 | p02708 | python | s150180697 | s303523761 | 61 | 22 | 9,172 | 9,196 | Accepted | Accepted | 63.93 | def main():
N, K = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
for i in range(K, N + 2):
a = N - i + 1
ans = (ans + i * a + 1) % mod
print(ans)
if __name__ == '__main__':
main()
| def main():
N, K = list(map(int, input().split()))
mod = 10**9 + 7
ans1 = (N + 2 - K) % mod
ans2 = ((N + 1) * (N + 1) * (N + 2) // 2 - (N + 1) * K * (K - 1) // 2) % mod
ans3 = ((N + 1) * (N + 2) * (2 * N + 3) // 6 - (K - 1) * K * (2 * K - 1) // 6) % mod
ans = (ans1 + ans2 - ans3) % mod
... | 11 | 11 | 235 | 370 | def main():
N, K = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
for i in range(K, N + 2):
a = N - i + 1
ans = (ans + i * a + 1) % mod
print(ans)
if __name__ == "__main__":
main()
| def main():
N, K = list(map(int, input().split()))
mod = 10**9 + 7
ans1 = (N + 2 - K) % mod
ans2 = ((N + 1) * (N + 1) * (N + 2) // 2 - (N + 1) * K * (K - 1) // 2) % mod
ans3 = ((N + 1) * (N + 2) * (2 * N + 3) // 6 - (K - 1) * K * (2 * K - 1) // 6) % mod
ans = (ans1 + ans2 - ans3) % mod
print... | false | 0 | [
"- ans = 0",
"- for i in range(K, N + 2):",
"- a = N - i + 1",
"- ans = (ans + i * a + 1) % mod",
"+ ans1 = (N + 2 - K) % mod",
"+ ans2 = ((N + 1) * (N + 1) * (N + 2) // 2 - (N + 1) * K * (K - 1) // 2) % mod",
"+ ans3 = ((N + 1) * (N + 2) * (2 * N + 3) // 6 - (K - 1) * K * (... | false | 0.04071 | 0.036207 | 1.124365 | [
"s150180697",
"s303523761"
] |
u606045429 | p03880 | python | s872572057 | s324636444 | 187 | 68 | 14,588 | 14,584 | Accepted | Accepted | 63.64 | from functools import reduce
from operator import xor
N, *A = list(map(int, open(0).read().split()))
x = reduce(xor, A)
ans = 0
K = x.bit_length()
for k in reversed(list(range(K))):
if (x >> k) & 1:
for a in A:
t = a ^ (a - 1)
if t == 2 ** (k + 1) - 1:
... | from functools import reduce
from operator import xor
N, *A = list(map(int, open(0).read().split()))
x = reduce(xor, A)
memo = set(a ^ (a - 1) for a in A)
ans = 0
K = x.bit_length()
for k in reversed(list(range(K))):
if (x >> k) & 1:
t = (2 << k) - 1
if t in memo:
x ^= t... | 22 | 21 | 417 | 382 | from functools import reduce
from operator import xor
N, *A = list(map(int, open(0).read().split()))
x = reduce(xor, A)
ans = 0
K = x.bit_length()
for k in reversed(list(range(K))):
if (x >> k) & 1:
for a in A:
t = a ^ (a - 1)
if t == 2 ** (k + 1) - 1:
x ^= t
... | from functools import reduce
from operator import xor
N, *A = list(map(int, open(0).read().split()))
x = reduce(xor, A)
memo = set(a ^ (a - 1) for a in A)
ans = 0
K = x.bit_length()
for k in reversed(list(range(K))):
if (x >> k) & 1:
t = (2 << k) - 1
if t in memo:
x ^= t
ans... | false | 4.545455 | [
"+memo = set(a ^ (a - 1) for a in A)",
"- for a in A:",
"- t = a ^ (a - 1)",
"- if t == 2 ** (k + 1) - 1:",
"- x ^= t",
"- ans += 1",
"- break",
"+ t = (2 << k) - 1",
"+ if t in memo:",
"+ x ^= t",
... | false | 0.066003 | 0.036601 | 1.803327 | [
"s872572057",
"s324636444"
] |
u347640436 | p02780 | python | s145638815 | s388241280 | 172 | 133 | 25,060 | 25,060 | Accepted | Accepted | 22.67 | N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
m = [(e + 1) / 2 for e in p]
t = sum(m[0:K])
result = t
for i in range(N - K):
t -= m[i]
t += m[i + K]
if t > result:
result = t
print(result)
| N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
m = [(e + 1) / 2 for e in p]
t = sum(m[0:K])
result = t
for i in range(N - K):
t += m[i + K] - m[i]
if t > result:
result = t
print(result)
| 13 | 12 | 246 | 238 | N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
m = [(e + 1) / 2 for e in p]
t = sum(m[0:K])
result = t
for i in range(N - K):
t -= m[i]
t += m[i + K]
if t > result:
result = t
print(result)
| N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
m = [(e + 1) / 2 for e in p]
t = sum(m[0:K])
result = t
for i in range(N - K):
t += m[i + K] - m[i]
if t > result:
result = t
print(result)
| false | 7.692308 | [
"- t -= m[i]",
"- t += m[i + K]",
"+ t += m[i + K] - m[i]"
] | false | 0.041417 | 0.03924 | 1.055487 | [
"s145638815",
"s388241280"
] |
u548624367 | p03835 | python | s988887495 | s377913027 | 1,745 | 19 | 2,940 | 3,060 | Accepted | Accepted | 98.91 | ans = 0
k,s = list(map(int,input().split()))
for x in range(k+1):
for y in range(k+1):
z = s - x - y
if 0 <= z and z <= k:
ans += 1
print(ans) | k,s=list(map(int,input().split()))
print((sum([max(0,min(k,s-i)-max(0,s-i-k)+1) for i in range(k+1)]))) | 8 | 2 | 151 | 96 | ans = 0
k, s = list(map(int, input().split()))
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if 0 <= z and z <= k:
ans += 1
print(ans)
| k, s = list(map(int, input().split()))
print((sum([max(0, min(k, s - i) - max(0, s - i - k) + 1) for i in range(k + 1)])))
| false | 75 | [
"-ans = 0",
"-for x in range(k + 1):",
"- for y in range(k + 1):",
"- z = s - x - y",
"- if 0 <= z and z <= k:",
"- ans += 1",
"-print(ans)",
"+print((sum([max(0, min(k, s - i) - max(0, s - i - k) + 1) for i in range(k + 1)])))"
] | false | 0.060199 | 0.060331 | 0.997813 | [
"s988887495",
"s377913027"
] |
u797673668 | p02271 | python | s572964006 | s056792411 | 1,970 | 410 | 220,828 | 7,804 | Accepted | Accepted | 79.19 | from itertools import combinations
n, a, q, ms, cache = int(eval(input())), list(map(int, input().split())), eval(input()), list(map(int, input().split())), {}
def sum_a(tmp, t):
global a, cache
if t in cache:
return tmp + cache[t]
elif len(t) == 1:
return tmp + a[t[0]]
els... | from itertools import combinations
n, a, q, ms, cache = int(eval(input())), list(map(int, input().split())), eval(input()), list(map(int, input().split())), {}
l = set(sum(t) for i in range(n) for t in combinations(a, i + 1))
for m in ms:
print(('yes' if m in l else 'no')) | 20 | 8 | 521 | 267 | from itertools import combinations
n, a, q, ms, cache = (
int(eval(input())),
list(map(int, input().split())),
eval(input()),
list(map(int, input().split())),
{},
)
def sum_a(tmp, t):
global a, cache
if t in cache:
return tmp + cache[t]
elif len(t) == 1:
return tmp + a... | from itertools import combinations
n, a, q, ms, cache = (
int(eval(input())),
list(map(int, input().split())),
eval(input()),
list(map(int, input().split())),
{},
)
l = set(sum(t) for i in range(n) for t in combinations(a, i + 1))
for m in ms:
print(("yes" if m in l else "no"))
| false | 60 | [
"-",
"-",
"-def sum_a(tmp, t):",
"- global a, cache",
"- if t in cache:",
"- return tmp + cache[t]",
"- elif len(t) == 1:",
"- return tmp + a[t[0]]",
"- else:",
"- cache[t] = result = sum_a(tmp + a[t[0]], t[1:])",
"- return result",
"-",
"-",
"-l = s... | false | 0.253562 | 0.038521 | 6.582381 | [
"s572964006",
"s056792411"
] |
u752522099 | p03206 | python | s540832572 | s161875350 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | d = int(eval(input()))
if d == 25:
print("Christmas")
elif d == 24:
print("Christmas Eve")
elif d == 23:
print("Christmas Eve Eve")
elif d == 22:
print("Christmas Eve Eve Eve")
| d = int(eval(input()))
print(("Christmas"+" Eve"*(25-d))) | 11 | 3 | 202 | 52 | d = int(eval(input()))
if d == 25:
print("Christmas")
elif d == 24:
print("Christmas Eve")
elif d == 23:
print("Christmas Eve Eve")
elif d == 22:
print("Christmas Eve Eve Eve")
| d = int(eval(input()))
print(("Christmas" + " Eve" * (25 - d)))
| false | 72.727273 | [
"-if d == 25:",
"- print(\"Christmas\")",
"-elif d == 24:",
"- print(\"Christmas Eve\")",
"-elif d == 23:",
"- print(\"Christmas Eve Eve\")",
"-elif d == 22:",
"- print(\"Christmas Eve Eve Eve\")",
"+print((\"Christmas\" + \" Eve\" * (25 - d)))"
] | false | 0.039879 | 0.03835 | 1.039873 | [
"s540832572",
"s161875350"
] |
u867848444 | p03476 | python | s031390344 | s792432497 | 816 | 702 | 30,528 | 62,168 | Accepted | Accepted | 13.97 | def check(i):
num=int(i**0.5)
if i==1:return 0
if i==2:return 1
for j in range(2,num+1):
if i%j==0:break
else:return 1
return 0
q=int(eval(input()))
lr=[list(map(int,input().split())) for i in range(q)]
L=[0]*(10**5+1)#0~100000
for i in range(10**5+1):
if i%2==0:
... | def check_prime(k):
'''
素数の時1、合成数の時0を返す
'''
if k == 1:return 0
num = int(k ** 0.5 // 1)
for i in range(2, num + 1):
if k % i == 0:return 0
return 1
q = int(eval(input()))
lr = []
l_min = 10 ** 9
r_max = 0
for i in range(q):
l, r = list(map(int,input().split()))
... | 22 | 41 | 442 | 1,034 | def check(i):
num = int(i**0.5)
if i == 1:
return 0
if i == 2:
return 1
for j in range(2, num + 1):
if i % j == 0:
break
else:
return 1
return 0
q = int(eval(input()))
lr = [list(map(int, input().split())) for i in range(q)]
L = [0] * (10**5 + 1) # ... | def check_prime(k):
"""
素数の時1、合成数の時0を返す
"""
if k == 1:
return 0
num = int(k**0.5 // 1)
for i in range(2, num + 1):
if k % i == 0:
return 0
return 1
q = int(eval(input()))
lr = []
l_min = 10**9
r_max = 0
for i in range(q):
l, r = list(map(int, input().split()... | false | 46.341463 | [
"-def check(i):",
"- num = int(i**0.5)",
"- if i == 1:",
"+def check_prime(k):",
"+ \"\"\"",
"+ 素数の時1、合成数の時0を返す",
"+ \"\"\"",
"+ if k == 1:",
"- if i == 2:",
"- return 1",
"- for j in range(2, num + 1):",
"- if i % j == 0:",
"- break",
"- ... | false | 0.483563 | 0.14579 | 3.316842 | [
"s031390344",
"s792432497"
] |
u374146618 | p03962 | python | s901350420 | s625459700 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | import collections
p = [int(x) for x in input().split()]
c = collections.Counter(p)
print((len(c)))
| p = [int(x) for x in input().split()]
print((len(set(p)))) | 5 | 2 | 103 | 57 | import collections
p = [int(x) for x in input().split()]
c = collections.Counter(p)
print((len(c)))
| p = [int(x) for x in input().split()]
print((len(set(p))))
| false | 60 | [
"-import collections",
"-",
"-c = collections.Counter(p)",
"-print((len(c)))",
"+print((len(set(p))))"
] | false | 0.038939 | 0.037943 | 1.026236 | [
"s901350420",
"s625459700"
] |
u923172145 | p03579 | python | s562005718 | s364983636 | 640 | 366 | 110,596 | 36,320 | Accepted | Accepted | 42.81 | from collections import deque
N, M = list(map(int, input().split()))
adj = [ [] for _ in range(N)]
clr = [-1 for _ in range(N)]
#グラフ構築
for _ in range(1,M+1):
u, v = list(map(int, input().split()))
u -= 1
v -= 1
adj[u].append((v,1))
adj[v].append((u,1))
#二部グラフか否か判定
vis = [0 for _ in range(N... | import sys
N, M = list(map(int, input().split()))
sys.setrecursionlimit(10**6)
I = [[] for _ in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
I[a].append(b)
I[b].append(a)
C = [-1 for _ in range(N)]
visited = set()
def DFS(p, c):
C[p] = c
flag = Tru... | 44 | 36 | 821 | 596 | from collections import deque
N, M = list(map(int, input().split()))
adj = [[] for _ in range(N)]
clr = [-1 for _ in range(N)]
# グラフ構築
for _ in range(1, M + 1):
u, v = list(map(int, input().split()))
u -= 1
v -= 1
adj[u].append((v, 1))
adj[v].append((u, 1))
# 二部グラフか否か判定
vis = [0 for _ in range(N)]
... | import sys
N, M = list(map(int, input().split()))
sys.setrecursionlimit(10**6)
I = [[] for _ in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
I[a].append(b)
I[b].append(a)
C = [-1 for _ in range(N)]
visited = set()
def DFS(p, c):
C[p] = c
flag = True
... | false | 18.181818 | [
"-from collections import deque",
"+import sys",
"-adj = [[] for _ in range(N)]",
"-clr = [-1 for _ in range(N)]",
"-# グラフ構築",
"-for _ in range(1, M + 1):",
"- u, v = list(map(int, input().split()))",
"- u -= 1",
"- v -= 1",
"- adj[u].append((v, 1))",
"- adj[v].append((u, 1))",
... | false | 0.08887 | 0.090899 | 0.977679 | [
"s562005718",
"s364983636"
] |
u102461423 | p03718 | python | s836807314 | s188269400 | 57 | 42 | 7,540 | 5,492 | Accepted | Accepted | 26.32 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
H,W = list(map(int,readline().split()))
A = [line.rstrip().decode('utf-8') for line in readlines()]
class Dinic:
def __init__(self, N, source, sink):
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
H,W = list(map(int,readline().split()))
A = [line.rstrip().decode('utf-8') for line in readlines()]
class Dinic:
def __init__(self, N, source, sink):
... | 110 | 111 | 2,942 | 3,022 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
H, W = list(map(int, readline().split()))
A = [line.rstrip().decode("utf-8") for line in readlines()]
class Dinic:
def __init__(self, N, source, sink):
self.N... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
H, W = list(map(int, readline().split()))
A = [line.rstrip().decode("utf-8") for line in readlines()]
class Dinic:
def __init__(self, N, source, sink):
self.N... | false | 0.900901 | [
"+",
"+ def add_edge_undirected(self, fr, to, cap):",
"+ n1 = len(self.G[fr])",
"+ n2 = len(self.G[to])",
"+ self.G[fr].append([to, cap, n2])",
"+ self.G[to].append([fr, cap, n1]) # 逆辺を cap 0 で追加",
"-add = dinic.add_edge",
"+add = dinic.add_edge_undirected",
"- ... | false | 0.09201 | 0.074859 | 1.229111 | [
"s836807314",
"s188269400"
] |
u947883560 | p02695 | python | s082587393 | s612185145 | 713 | 236 | 23,456 | 74,444 | Accepted | Accepted | 66.9 | #!/usr/bin/env python3
import sys
import functools
sys.setrecursionlimit(10**8)
INF = float("inf")
def solve(N: int, M: int, Q: int,
a: "List[int]", b: "List[int]", c: "List[int]", d: "List[int]"):
# 全列挙行けるかを確認
@functools.lru_cache(maxsize=None)
def f(n, m):
if n == 1:
... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
def ZIP(n): return [LIST() for _ in range(n)]
INF = float(... | 72 | 61 | 1,778 | 1,285 | #!/usr/bin/env python3
import sys
import functools
sys.setrecursionlimit(10**8)
INF = float("inf")
def solve(
N: int,
M: int,
Q: int,
a: "List[int]",
b: "List[int]",
c: "List[int]",
d: "List[int]",
):
# 全列挙行けるかを確認
@functools.lru_cache(maxsize=None)
def f(n, m):
if n ==... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
def input():
return sys.stdin.readline().strip()
def INT():
return int(eval(input()))
def MAP():
return list(map(int, input().split()))
def LIST():
return list(map(int, input().split()))
def ZIP(n):
return [LIST() for _ in ran... | false | 15.277778 | [
"-import functools",
"-INF = float(\"inf\")",
"-def solve(",
"- N: int,",
"- M: int,",
"- Q: int,",
"- a: \"List[int]\",",
"- b: \"List[int]\",",
"- c: \"List[int]\",",
"- d: \"List[int]\",",
"-):",
"- # 全列挙行けるかを確認",
"- @functools.lru_cache(maxsize=None)",
"- ... | false | 0.062208 | 0.072617 | 0.856653 | [
"s082587393",
"s612185145"
] |
u808427016 | p03330 | python | s460795125 | s732650080 | 725 | 163 | 7,564 | 5,748 | Accepted | Accepted | 77.52 | N, C = [int(_) for _ in input().split()]
D = [[int(_) for _ in input().split()] for i in range(C)]
c = [[int(_) - 1 for _ in input().split()] for i in range(N)]
xs = [[], [], []]
for i, row in enumerate(c):
for j, x in enumerate(row):
xs[(i + j) % 3].append(x)
cs = [[sum(D[x][j] for x in xs[i])... | N, C = [int(_) for _ in input().split()]
D = [[int(_) for _ in input().split()] for i in range(C)]
c = [[int(_) - 1 for _ in input().split()] for i in range(N)]
from collections import defaultdict
from itertools import permutations
xs = [defaultdict(int) for _ in range(3)]
for i, row in enumerate(c):
f... | 26 | 22 | 693 | 608 | N, C = [int(_) for _ in input().split()]
D = [[int(_) for _ in input().split()] for i in range(C)]
c = [[int(_) - 1 for _ in input().split()] for i in range(N)]
xs = [[], [], []]
for i, row in enumerate(c):
for j, x in enumerate(row):
xs[(i + j) % 3].append(x)
cs = [[sum(D[x][j] for x in xs[i]) for j in ran... | N, C = [int(_) for _ in input().split()]
D = [[int(_) for _ in input().split()] for i in range(C)]
c = [[int(_) - 1 for _ in input().split()] for i in range(N)]
from collections import defaultdict
from itertools import permutations
xs = [defaultdict(int) for _ in range(3)]
for i, row in enumerate(c):
for j, x in e... | false | 15.384615 | [
"-xs = [[], [], []]",
"+from collections import defaultdict",
"+from itertools import permutations",
"+",
"+xs = [defaultdict(int) for _ in range(3)]",
"- xs[(i + j) % 3].append(x)",
"-cs = [[sum(D[x][j] for x in xs[i]) for j in range(C)] for i in range(3)]",
"-result = 100000000000000000000000... | false | 0.007209 | 0.042212 | 0.170769 | [
"s460795125",
"s732650080"
] |
u953237709 | p03290 | python | s165120485 | s545330243 | 462 | 249 | 55,516 | 44,144 | Accepted | Accepted | 46.1 | import heapq
n, need = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
ret = float('inf')
for mask in range(1 << n):
total = 0
count = 0
pq = []
for bit in range(n):
num, bonus = a[bit]
points = (bit + 1) * 100
if (mask >> bi... | n, need = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
ret = float('inf')
for mask in range(1 << n):
total = 0
count = 0
for bit in range(n):
if (mask >> bit) & 1:
num, bonus = a[bit]
points = (bit + 1) * 100
... | 26 | 26 | 640 | 735 | import heapq
n, need = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
ret = float("inf")
for mask in range(1 << n):
total = 0
count = 0
pq = []
for bit in range(n):
num, bonus = a[bit]
points = (bit + 1) * 100
if (mask >> bit) & 1:
... | n, need = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
ret = float("inf")
for mask in range(1 << n):
total = 0
count = 0
for bit in range(n):
if (mask >> bit) & 1:
num, bonus = a[bit]
points = (bit + 1) * 100
total += poi... | false | 0 | [
"-import heapq",
"-",
"- pq = []",
"- num, bonus = a[bit]",
"- points = (bit + 1) * 100",
"+ num, bonus = a[bit]",
"+ points = (bit + 1) * 100",
"- else:",
"+ for bit in range(n - 1, -1, -1):",
"+ if (mask >> bit) & 1 == 0:",
"+ ... | false | 0.052184 | 0.032755 | 1.593149 | [
"s165120485",
"s545330243"
] |
u732074899 | p03086 | python | s581139909 | s744447091 | 19 | 17 | 2,940 | 3,060 | Accepted | Accepted | 10.53 | # -*- coding: utf-8 -*-
def main():
b = eval(input())
maxcnt = 0
scnt = 0
for c in b:
if(c=='A' or c=='C' or c=='G' or c=='T'):
scnt += 1
else:
if(maxcnt<scnt):
maxcnt=scnt
scnt = 0
print((max(scnt,maxcnt)))
mai... | from sys import stdin
matches = ['A','C','G','T']
S = stdin.readline().rstrip()
cnt_row = 0
cnt_max = 0
for s in S:
if s in matches:
cnt_row += 1
if cnt_max < cnt_row:
cnt_max = cnt_row
else:
cnt_row = 0
print(cnt_max) | 18 | 14 | 315 | 276 | # -*- coding: utf-8 -*-
def main():
b = eval(input())
maxcnt = 0
scnt = 0
for c in b:
if c == "A" or c == "C" or c == "G" or c == "T":
scnt += 1
else:
if maxcnt < scnt:
maxcnt = scnt
scnt = 0
print((max(scnt, maxcnt)))
main()
| from sys import stdin
matches = ["A", "C", "G", "T"]
S = stdin.readline().rstrip()
cnt_row = 0
cnt_max = 0
for s in S:
if s in matches:
cnt_row += 1
if cnt_max < cnt_row:
cnt_max = cnt_row
else:
cnt_row = 0
print(cnt_max)
| false | 22.222222 | [
"-# -*- coding: utf-8 -*-",
"-def main():",
"- b = eval(input())",
"- maxcnt = 0",
"- scnt = 0",
"- for c in b:",
"- if c == \"A\" or c == \"C\" or c == \"G\" or c == \"T\":",
"- scnt += 1",
"- else:",
"- if maxcnt < scnt:",
"- maxcn... | false | 0.047373 | 0.04654 | 1.017908 | [
"s581139909",
"s744447091"
] |
u648315264 | p02707 | python | s447202545 | s123892255 | 147 | 120 | 32,368 | 32,976 | Accepted | Accepted | 18.37 | n = int(eval(input()))
l = list(map(int, input().split()))
ans = [0]*n
for i in l:
ans[i-1] += 1
for i in ans:
print(i)
| n = int(eval(input()))
l = list(map(int, input().split()))
ans = [0]*n
for i in l:
ans[i-1] += 1
print(("\n".join(map(str,ans))))
| 10 | 9 | 134 | 137 | n = int(eval(input()))
l = list(map(int, input().split()))
ans = [0] * n
for i in l:
ans[i - 1] += 1
for i in ans:
print(i)
| n = int(eval(input()))
l = list(map(int, input().split()))
ans = [0] * n
for i in l:
ans[i - 1] += 1
print(("\n".join(map(str, ans))))
| false | 10 | [
"-for i in ans:",
"- print(i)",
"+print((\"\\n\".join(map(str, ans))))"
] | false | 0.042791 | 0.09286 | 0.460805 | [
"s447202545",
"s123892255"
] |
u300968187 | p03239 | python | s845758764 | s634052791 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | N, T = list(map(int, input().split()))
path_list = [list(map(int, input().split())) for _ in range(N)]
min_cost = 1001
for path in path_list:
if T >= path[1] and path[0] < min_cost:
min_cost = path[0]
print((min_cost if min_cost < 1001 else 'TLE')) | n, t = list(map(int, input().split()))
ct = list([x for x in [list(map(int, input().split())) for i in range(n)] if x[1] <= t])
print(("TLE" if len(ct) == 0 else min(ct)[0]))
| 7 | 3 | 249 | 172 | N, T = list(map(int, input().split()))
path_list = [list(map(int, input().split())) for _ in range(N)]
min_cost = 1001
for path in path_list:
if T >= path[1] and path[0] < min_cost:
min_cost = path[0]
print((min_cost if min_cost < 1001 else "TLE"))
| n, t = list(map(int, input().split()))
ct = list([x for x in [list(map(int, input().split())) for i in range(n)] if x[1] <= t])
print(("TLE" if len(ct) == 0 else min(ct)[0]))
| false | 57.142857 | [
"-N, T = list(map(int, input().split()))",
"-path_list = [list(map(int, input().split())) for _ in range(N)]",
"-min_cost = 1001",
"-for path in path_list:",
"- if T >= path[1] and path[0] < min_cost:",
"- min_cost = path[0]",
"-print((min_cost if min_cost < 1001 else \"TLE\"))",
"+n, t = li... | false | 0.046585 | 0.046399 | 1.004017 | [
"s845758764",
"s634052791"
] |
u677440371 | p03073 | python | s435414507 | s866062471 | 89 | 74 | 3,188 | 3,188 | Accepted | Accepted | 16.85 | S = str(eval(input()))
check1 = 0
for i in range(len(S)):
if i % 2 == 0 and S[i] != "0":
# print(i,'yes')
check1 += 1
if i % 2 != 0 and S[i] == "0":
# print(i,"no")
check1 += 1
# print(check1)
check2 = 0
for i in range(len(S)):
if i % 2 == 0 and S[i] != "1":
# ... | s = eval(input())
ans1 = 0
ans2 = 0
for i,j in enumerate(s):
if i % 2 == 0 and j == '0':
ans1 += 1
if i % 2 == 1 and j == '1':
ans1 += 1
if i % 2 == 0 and j == '1':
ans2 += 1
if i % 2 == 1 and j == '0':
ans2 += 1
print((min(ans1, ans2))) | 22 | 14 | 485 | 291 | S = str(eval(input()))
check1 = 0
for i in range(len(S)):
if i % 2 == 0 and S[i] != "0":
# print(i,'yes')
check1 += 1
if i % 2 != 0 and S[i] == "0":
# print(i,"no")
check1 += 1
# print(check1)
check2 = 0
for i in range(len(S)):
if i % 2 == 0 and S[i] != "1":
... | s = eval(input())
ans1 = 0
ans2 = 0
for i, j in enumerate(s):
if i % 2 == 0 and j == "0":
ans1 += 1
if i % 2 == 1 and j == "1":
ans1 += 1
if i % 2 == 0 and j == "1":
ans2 += 1
if i % 2 == 1 and j == "0":
ans2 += 1
print((min(ans1, ans2)))
| false | 36.363636 | [
"-S = str(eval(input()))",
"-check1 = 0",
"-for i in range(len(S)):",
"- if i % 2 == 0 and S[i] != \"0\":",
"- # print(i,'yes')",
"- check1 += 1",
"- if i % 2 != 0 and S[i] == \"0\":",
"- # print(i,\"no\")",
"- check1 += 1",
"-# print(check1)",
"... | false | 0.09282 | 0.077826 | 1.192662 | [
"s435414507",
"s866062471"
] |
u059940903 | p03854 | python | s995714003 | s178840185 | 186 | 171 | 40,432 | 39,920 | Accepted | Accepted | 8.06 | S = input()[::-1]
day_dream_word = ["dreamer", "dream", "eraser", "erase"]
day_dream_word = list([s[::-1] for s in day_dream_word])
T = ""
Tindex = 0
res = False
partial_res = True
while not res and partial_res:
partial_res = False
for add_word in day_dream_word:
nextTindex = Tindex + len(add_word)
... | S = eval(input())
day_dream_word = ["eraser", "erase", "dreamer", "dream"]
for replace_word in day_dream_word:
S = S.replace(replace_word, "")
if S == "":
print('YES')
else:
print('NO') | 25 | 9 | 565 | 194 | S = input()[::-1]
day_dream_word = ["dreamer", "dream", "eraser", "erase"]
day_dream_word = list([s[::-1] for s in day_dream_word])
T = ""
Tindex = 0
res = False
partial_res = True
while not res and partial_res:
partial_res = False
for add_word in day_dream_word:
nextTindex = Tindex + len(add_word)
... | S = eval(input())
day_dream_word = ["eraser", "erase", "dreamer", "dream"]
for replace_word in day_dream_word:
S = S.replace(replace_word, "")
if S == "":
print("YES")
else:
print("NO")
| false | 64 | [
"-S = input()[::-1]",
"-day_dream_word = [\"dreamer\", \"dream\", \"eraser\", \"erase\"]",
"-day_dream_word = list([s[::-1] for s in day_dream_word])",
"-T = \"\"",
"-Tindex = 0",
"-res = False",
"-partial_res = True",
"-while not res and partial_res:",
"- partial_res = False",
"- for add_wo... | false | 0.043598 | 0.043827 | 0.994777 | [
"s995714003",
"s178840185"
] |
u994988729 | p03112 | python | s726622482 | s866350256 | 956 | 772 | 21,780 | 17,808 | Accepted | Accepted | 19.25 | import sys
import bisect
input = sys.stdin.readline
A, B, Q = map(int, input().split())
tera = [int(input()) for _ in range(A)]
sha = [int(input()) for _ in range(B)]
query = [int(input()) for _ in range(Q)]
res = []
for x in query:
tl = bisect.bisect_left(tera, x)
tr = bisect.bisect_right(tera, x... | import sys
import bisect
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
bl = bisect.bisect_left
A, B, Q = list(map(int, input().split()))
inf = 10**18
S = [-inf]+[int(eval(input())) for _ in range(A)]+[inf]
T = [-inf]+[int(eval(input())) for _ in range(B)]+[inf]
def path(x):
sl = S... | 43 | 33 | 1,049 | 883 | import sys
import bisect
input = sys.stdin.readline
A, B, Q = map(int, input().split())
tera = [int(input()) for _ in range(A)]
sha = [int(input()) for _ in range(B)]
query = [int(input()) for _ in range(Q)]
res = []
for x in query:
tl = bisect.bisect_left(tera, x)
tr = bisect.bisect_right(tera, x)
sl = bi... | import sys
import bisect
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
bl = bisect.bisect_left
A, B, Q = list(map(int, input().split()))
inf = 10**18
S = [-inf] + [int(eval(input())) for _ in range(A)] + [inf]
T = [-inf] + [int(eval(input())) for _ in range(B)] + [inf]
def path(x):
sl = S[bl(S, ... | false | 23.255814 | [
"-input = sys.stdin.readline",
"-A, B, Q = map(int, input().split())",
"-tera = [int(input()) for _ in range(A)]",
"-sha = [int(input()) for _ in range(B)]",
"-query = [int(input()) for _ in range(Q)]",
"-res = []",
"-for x in query:",
"- tl = bisect.bisect_left(tera, x)",
"- tr = bisect.bisec... | false | 0.092938 | 0.047305 | 1.964675 | [
"s726622482",
"s866350256"
] |
u113971909 | p02780 | python | s010842550 | s296417708 | 188 | 160 | 24,548 | 24,404 | Accepted | Accepted | 14.89 | N,K=list(map(int,input().split()))
p=list(map(int,input().split()))
p = [0]+p
for i in range(1,N+1):
p[i]=p[i-1]+p[i]
ret = 0
for i in range(1,N-K+2):
ret = max(p[i+K-1]-p[i-1],ret)
ret = (ret+K)/2
print(ret) | #!/usr/bin python3
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
Et = [0]*(N+1)
for i in range(N):
Et[i+1] = Et[i] + (1+P[i])/2
ret = 0
for i in range(N-K+1):
re... | 10 | 19 | 215 | 399 | N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
p = [0] + p
for i in range(1, N + 1):
p[i] = p[i - 1] + p[i]
ret = 0
for i in range(1, N - K + 2):
ret = max(p[i + K - 1] - p[i - 1], ret)
ret = (ret + K) / 2
print(ret)
| #!/usr/bin python3
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
def main():
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
Et = [0] * (N + 1)
for i in range(N):
Et[i + 1] = Et[i] + (1 + P[i]) / 2
ret = 0
for i in range(N - K + 1):
r... | false | 47.368421 | [
"-N, K = list(map(int, input().split()))",
"-p = list(map(int, input().split()))",
"-p = [0] + p",
"-for i in range(1, N + 1):",
"- p[i] = p[i - 1] + p[i]",
"-ret = 0",
"-for i in range(1, N - K + 2):",
"- ret = max(p[i + K - 1] - p[i - 1], ret)",
"-ret = (ret + K) / 2",
"-print(ret)",
"+#... | false | 0.067951 | 0.077666 | 0.87492 | [
"s010842550",
"s296417708"
] |
u196579381 | p03073 | python | s517828297 | s257548876 | 175 | 144 | 40,560 | 3,316 | Accepted | Accepted | 17.71 | s = eval(input())
s1 = '01' * (10 ** 5 // 2)
s1 = s1[:len(s)]
count = [0, 0]
for i in range(len(s)):
if s[i] != s1[i]:
count[0] += 1
else:
count[1] += 1
print((min(count)))
| S = eval(input())
s = ''
s2 = ''
for i in range(len(S)):
s += str(i % 2)
s2 += str((i+1) % 2)
c = 0
c2 = 0
for i in range(len(S)):
if S[i] != s[i]:
c += 1
if S[i] != s2[i]:
c2 += 1
print((min(c, c2)))
| 12 | 14 | 202 | 238 | s = eval(input())
s1 = "01" * (10**5 // 2)
s1 = s1[: len(s)]
count = [0, 0]
for i in range(len(s)):
if s[i] != s1[i]:
count[0] += 1
else:
count[1] += 1
print((min(count)))
| S = eval(input())
s = ""
s2 = ""
for i in range(len(S)):
s += str(i % 2)
s2 += str((i + 1) % 2)
c = 0
c2 = 0
for i in range(len(S)):
if S[i] != s[i]:
c += 1
if S[i] != s2[i]:
c2 += 1
print((min(c, c2)))
| false | 14.285714 | [
"-s = eval(input())",
"-s1 = \"01\" * (10**5 // 2)",
"-s1 = s1[: len(s)]",
"-count = [0, 0]",
"-for i in range(len(s)):",
"- if s[i] != s1[i]:",
"- count[0] += 1",
"- else:",
"- count[1] += 1",
"-print((min(count)))",
"+S = eval(input())",
"+s = \"\"",
"+s2 = \"\"",
"+f... | false | 0.047811 | 0.110214 | 0.433803 | [
"s517828297",
"s257548876"
] |
u510829608 | p02268 | python | s333362891 | s601750474 | 420 | 70 | 18,352 | 24,384 | Accepted | Accepted | 83.33 | import math as ma
def bs(num, li):
low, high = 0, len(li)
if num >= li[low] and num <= li[high-1]:
while(low <= high):
center = ma.floor((low + high)/2 )
if li[center] < num:
low = center + 1
elif li[center] > num:
high = cen... | n = int(eval(input()))
S = set(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
sum = 0
for i in T:
if i in S:
sum +=1
print(sum) | 28 | 12 | 622 | 188 | import math as ma
def bs(num, li):
low, high = 0, len(li)
if num >= li[low] and num <= li[high - 1]:
while low <= high:
center = ma.floor((low + high) / 2)
if li[center] < num:
low = center + 1
elif li[center] > num:
high = center - 1... | n = int(eval(input()))
S = set(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
sum = 0
for i in T:
if i in S:
sum += 1
print(sum)
| false | 57.142857 | [
"-import math as ma",
"-",
"-",
"-def bs(num, li):",
"- low, high = 0, len(li)",
"- if num >= li[low] and num <= li[high - 1]:",
"- while low <= high:",
"- center = ma.floor((low + high) / 2)",
"- if li[center] < num:",
"- low = center + 1",
"- ... | false | 0.04199 | 0.035214 | 1.19242 | [
"s333362891",
"s601750474"
] |
u102461423 | p03008 | python | s817182763 | s221075477 | 1,944 | 993 | 230,808 | 228,508 | Accepted | Accepted | 48.92 | # 新ステージでは、一度全部どんぐりに直してから換金を始めるとしてよい
def F(N, A, B):
# N個のどんぐりを、Aで換金してからBに持っていく
# Bでどんぐりに直す
dp = [0] * (N+1)
for n in range(N+1):
x = n
for j in range(3):
if n >= A[j]:
y = dp[n-A[j]] + B[j]
if x < y:
x = y
dp[n] = x
return dp[N]
N = int(eval(input(... | import sys
input = sys.stdin.readline
def F(N,A,B):
# n 個のどんぐりを持っている
# a個がbの価値に変換できる
AB = [(x,y) for x,y in zip(A,B) if x < y]
dp = [0] * (N+1)
for n in range(N+1):
x = n
for a,b in AB:
if n >= a:
y = dp[n-a] + b
if x < y:
... | 22 | 24 | 438 | 521 | # 新ステージでは、一度全部どんぐりに直してから換金を始めるとしてよい
def F(N, A, B):
# N個のどんぐりを、Aで換金してからBに持っていく
# Bでどんぐりに直す
dp = [0] * (N + 1)
for n in range(N + 1):
x = n
for j in range(3):
if n >= A[j]:
y = dp[n - A[j]] + B[j]
if x < y:
x = y
dp[n... | import sys
input = sys.stdin.readline
def F(N, A, B):
# n 個のどんぐりを持っている
# a個がbの価値に変換できる
AB = [(x, y) for x, y in zip(A, B) if x < y]
dp = [0] * (N + 1)
for n in range(N + 1):
x = n
for a, b in AB:
if n >= a:
y = dp[n - a] + b
if x < y:
... | false | 8.333333 | [
"-# 新ステージでは、一度全部どんぐりに直してから換金を始めるとしてよい",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"- # N個のどんぐりを、Aで換金してからBに持っていく",
"- # Bでどんぐりに直す",
"+ # n 個のどんぐりを持っている",
"+ # a個がbの価値に変換できる",
"+ AB = [(x, y) for x, y in zip(A, B) if x < y]",
"- for j in range(3):",
"- ... | false | 0.091359 | 0.036797 | 2.482785 | [
"s817182763",
"s221075477"
] |
u279493135 | p02934 | python | s912755427 | s949853758 | 57 | 37 | 5,788 | 5,144 | Accepted | Accepted | 35.09 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digi... | 24 | 25 | 690 | 705 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
fro... | false | 4 | [
"-from itertools import permutations, combinations, product, accumulate",
"+from itertools import permutations, combinations, product",
"+from bisect import bisect",
"-ans = 0",
"-for i in A:",
"- ans += 1 / i",
"-print((1 / ans))",
"+tmp = 0",
"+for a in A:",
"+ tmp += 1 / a",
"+print((1 ... | false | 0.073422 | 0.043514 | 1.687316 | [
"s912755427",
"s949853758"
] |
u716530146 | p03000 | python | s690477067 | s988654727 | 170 | 55 | 38,384 | 3,932 | Accepted | Accepted | 67.65 | #!/usr/bin/env python3
import sys, math
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans=count=0
n,k=list(map(int,input().split()))
l=list(map(int,input().split()))
for li in l:
count+=li
if count<=k:
ans+=1
print((a... | #!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0
n,x=list(map(int,input().split()))
L=list(map(int,input().split()))
for i in range(n):
count+... | 15 | 14 | 318 | 367 | #!/usr/bin/env python3
import sys, math
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
sys.setrecursionlimit(10**8)
inf = float("inf")
ans = count = 0
n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
for li in l:
count += li
if count <= k:
ans += 1
print(... | #!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
sys.setrecursionlimit(10**8)
inf = float("inf")
ans = count = 0
n, x = list(map(int, input().split()))
L = list(map(int, input().split()))
for i in range(n):
count += ... | false | 6.666667 | [
"-import sys, math",
"+import sys, math, itertools, heapq, collections, bisect",
"-n, k = list(map(int, input().split()))",
"-l = list(map(int, input().split()))",
"-for li in l:",
"- count += li",
"- if count <= k:",
"+n, x = list(map(int, input().split()))",
"+L = list(map(int, input().split... | false | 0.034283 | 0.056042 | 0.61174 | [
"s690477067",
"s988654727"
] |
u416011173 | p03295 | python | s731496255 | s248787540 | 287 | 253 | 24,640 | 24,788 | Accepted | Accepted | 11.85 | # -*- coding: utf-8 -*-
# 標準入力を取得
N, M = list(map(int, input().split()))
requests = []
for i in range(M):
a_i, b_i = list(map(int, input().split()))
requests.append((a_i, b_i))
# 求解処理
requests = sorted(requests, key=lambda x: x[1])
bridge = 0
ans = 0
for i in range(M):
a_i, b_i = requests[i]
... | # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
N, M = list(map(int, input().split()))
requests = []
for i in range(M):
a_i, b_i = list(map(int, input().split()))
requests.append((a_i, b_i))
return N, M... | 20 | 47 | 407 | 938 | # -*- coding: utf-8 -*-
# 標準入力を取得
N, M = list(map(int, input().split()))
requests = []
for i in range(M):
a_i, b_i = list(map(int, input().split()))
requests.append((a_i, b_i))
# 求解処理
requests = sorted(requests, key=lambda x: x[1])
bridge = 0
ans = 0
for i in range(M):
a_i, b_i = requests[i]
if a_i > br... | # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
N, M = list(map(int, input().split()))
requests = []
for i in range(M):
a_i, b_i = list(map(int, input().split()))
requests.append((a_i, b_i))
return N, M, requests
def m... | false | 57.446809 | [
"-# 標準入力を取得",
"-N, M = list(map(int, input().split()))",
"-requests = []",
"-for i in range(M):",
"- a_i, b_i = list(map(int, input().split()))",
"- requests.append((a_i, b_i))",
"-# 求解処理",
"-requests = sorted(requests, key=lambda x: x[1])",
"-bridge = 0",
"-ans = 0",
"-for i in range(M):"... | false | 0.044645 | 0.038893 | 1.147895 | [
"s731496255",
"s248787540"
] |
u535803878 | p03312 | python | s332985392 | s101794936 | 676 | 442 | 86,592 | 94,912 | Accepted | Accepted | 34.62 | # ARC100D
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
# import numpy as np
import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
# a = np.array(list(map(int, input().split())))
ca = [None] * n #ca[i] = a0~aiの和
s = 0
for i,num in e... | # ARC100D
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
n = int(eval(input()))
a = list(map(int, input().split()))
ca = [None] * n #ca[i] = a0~aiの和
s = 0
for i,num in enumerate(a):
s += a[i]
ca[i] = s
diff = [None] * n
s = 0
t = 1
v1 = ... | 40 | 63 | 1,006 | 1,525 | # ARC100D
import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
# import numpy as np
import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
# a = np.array(list(map(int, input().split())))
ca = [None] * n # ca[i] = a0~aiの和
s = 0
for i, num in enumerate(a):
... | # ARC100D
import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
n = int(eval(input()))
a = list(map(int, input().split()))
ca = [None] * n # ca[i] = a0~aiの和
s = 0
for i, num in enumerate(a):
s += a[i]
ca[i] = s
diff = [None] * n
s = 0
t = 1
v1 = 0 # a[:s]
v2 = a[0] ... | false | 36.507937 | [
"-# import numpy as np",
"-import bisect",
"-",
"-# a = np.array(list(map(int, input().split())))",
"-# ca = a.cumsum()",
"-def sub(l, start, end, init):",
"- if len(l) == 0:",
"- return 0, 0",
"- elif end - start == 1:",
"- return 0, l[start] - init",
"- target = (init + ... | false | 0.038201 | 0.060597 | 0.630407 | [
"s332985392",
"s101794936"
] |
u970308980 | p02713 | python | s800783285 | s908096596 | 1,929 | 1,234 | 9,468 | 9,388 | Accepted | Accepted | 36.03 | import heapq
from collections import defaultdict, deque
from math import ceil, factorial, gcd
import sys
sys.setrecursionlimit(10 ** 7)
INF = float("inf")
MOD = 10 ** 9 + 7
si = lambda: input().strip()
ii = lambda: int(eval(input()))
mii = lambda: list(map(int, input().split()))
lmii = lambda: list(map(in... | import heapq
from collections import defaultdict, deque
from math import ceil, factorial, gcd
import sys
import bisect
sys.setrecursionlimit(10 ** 7)
INF = float("inf")
MOD = 10 ** 9 + 7
si = lambda: input().strip()
ii = lambda: int(eval(input()))
mii = lambda: list(map(int, input().split()))
lmii = la... | 27 | 29 | 546 | 576 | import heapq
from collections import defaultdict, deque
from math import ceil, factorial, gcd
import sys
sys.setrecursionlimit(10**7)
INF = float("inf")
MOD = 10**9 + 7
si = lambda: input().strip()
ii = lambda: int(eval(input()))
mii = lambda: list(map(int, input().split()))
lmii = lambda: list(map(int, input().split(... | import heapq
from collections import defaultdict, deque
from math import ceil, factorial, gcd
import sys
import bisect
sys.setrecursionlimit(10**7)
INF = float("inf")
MOD = 10**9 + 7
si = lambda: input().strip()
ii = lambda: int(eval(input()))
mii = lambda: list(map(int, input().split()))
lmii = lambda: list(map(int, ... | false | 6.896552 | [
"+import bisect",
"+ g = gcd(i, j)",
"- ans += gcd(gcd(i, j), k)",
"+ ans += gcd(g, k)"
] | false | 0.164245 | 0.086053 | 1.908657 | [
"s800783285",
"s908096596"
] |
u644907318 | p02762 | python | s681057695 | s948205560 | 875 | 637 | 129,752 | 124,856 | Accepted | Accepted | 27.2 | def find(i):
x = i
while x!=G[x][0]:
x = G[x][0]
return x
def union(i,j):
ai = find(i)
ni = G[ai][1]
aj = find(j)
nj = G[aj][1]
if ai!=aj:
if ni>=nj:
G[aj][0] = ai
if G[aj][1]==G[ai][1]:
G[ai][1] += 1
G[ai... | from collections import deque
N,M,K = list(map(int,input().split()))
G = {i:[] for i in range(1,N+1)}
for _ in range(M):
a,b = list(map(int,input().split()))
G[a].append(b)
G[b].append(a)
col = [-1 for _ in range(N+1)]
cnt = 0
for i in range(1,N+1):
if col[i]<0:
col[i] = cnt
... | 44 | 40 | 969 | 922 | def find(i):
x = i
while x != G[x][0]:
x = G[x][0]
return x
def union(i, j):
ai = find(i)
ni = G[ai][1]
aj = find(j)
nj = G[aj][1]
if ai != aj:
if ni >= nj:
G[aj][0] = ai
if G[aj][1] == G[ai][1]:
G[ai][1] += 1
G[ai][2]... | from collections import deque
N, M, K = list(map(int, input().split()))
G = {i: [] for i in range(1, N + 1)}
for _ in range(M):
a, b = list(map(int, input().split()))
G[a].append(b)
G[b].append(a)
col = [-1 for _ in range(N + 1)]
cnt = 0
for i in range(1, N + 1):
if col[i] < 0:
col[i] = cnt
... | false | 9.090909 | [
"-def find(i):",
"- x = i",
"- while x != G[x][0]:",
"- x = G[x][0]",
"- return x",
"-",
"-",
"-def union(i, j):",
"- ai = find(i)",
"- ni = G[ai][1]",
"- aj = find(j)",
"- nj = G[aj][1]",
"- if ai != aj:",
"- if ni >= nj:",
"- G[aj][0] = ... | false | 0.040369 | 0.037038 | 1.089945 | [
"s681057695",
"s948205560"
] |
u997648604 | p02862 | python | s602934351 | s617551074 | 1,413 | 122 | 15,220 | 88,932 | Accepted | Accepted | 91.37 | import itertools
import math
import numpy as np
import fractions
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
import bisect
import sys
sys.setrecursionlimit(10**9)
def main():
X, Y = list(map(int,input().split()))
p ... | import sys
sys.setrecursionlimit(10**9)
def mi(): return list(map(int,input().split()))
def ii(): return int(eval(input()))
def isp(): return input().split()
def deb(text): print(("-------\n{}\n-------".format(text)))
INF=10**20
class Counting():
def __init__(self,maxim,mod):
maxim += 1
... | 38 | 57 | 749 | 1,276 | import itertools
import math
import numpy as np
import fractions
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
import bisect
import sys
sys.setrecursionlimit(10**9)
def main():
X, Y = list(map(int, input().split()))
p = 10**9 + 7... | import sys
sys.setrecursionlimit(10**9)
def mi():
return list(map(int, input().split()))
def ii():
return int(eval(input()))
def isp():
return input().split()
def deb(text):
print(("-------\n{}\n-------".format(text)))
INF = 10**20
class Counting:
def __init__(self, maxim, mod):
... | false | 33.333333 | [
"-import itertools",
"-import math",
"-import numpy as np",
"-import fractions",
"-from collections import deque",
"-from itertools import combinations",
"-from functools import reduce",
"-from functools import lru_cache",
"-import bisect",
"+def mi():",
"+ return list(map(int, input().split(... | false | 0.299512 | 1.192871 | 0.251085 | [
"s602934351",
"s617551074"
] |
u893063840 | p02722 | python | s087029018 | s311678162 | 445 | 209 | 3,064 | 3,188 | Accepted | Accepted | 53.03 | from math import sqrt
def f(x):
ret = []
for i in range(1, int(sqrt(x)) + 1):
if x % i == 0:
ret.append(i)
ret.append(x // i)
return ret
n = int(eval(input()))
ans = 1
for k in range(2, int(sqrt(n)) + 1):
r = n
while r % k == 0:
r //= ... | from math import sqrt
def divisors(x):
for i in range(1, int(sqrt(x)) + 1):
if x % i == 0:
yield i
if x // i != i:
yield x // i
n = int(eval(input()))
ans = 0
for e in divisors(n):
if e == 1:
continue
r = n
while r % e == 0... | 30 | 28 | 445 | 428 | from math import sqrt
def f(x):
ret = []
for i in range(1, int(sqrt(x)) + 1):
if x % i == 0:
ret.append(i)
ret.append(x // i)
return ret
n = int(eval(input()))
ans = 1
for k in range(2, int(sqrt(n)) + 1):
r = n
while r % k == 0:
r //= k
if r % k == 1:
... | from math import sqrt
def divisors(x):
for i in range(1, int(sqrt(x)) + 1):
if x % i == 0:
yield i
if x // i != i:
yield x // i
n = int(eval(input()))
ans = 0
for e in divisors(n):
if e == 1:
continue
r = n
while r % e == 0:
r //= e
... | false | 6.666667 | [
"-def f(x):",
"- ret = []",
"+def divisors(x):",
"- ret.append(i)",
"- ret.append(x // i)",
"- return ret",
"+ yield i",
"+ if x // i != i:",
"+ yield x // i",
"-ans = 1",
"-for k in range(2, int(sqrt(n)) + 1):",
"+ans = 0",
"+... | false | 0.105088 | 0.078523 | 1.338315 | [
"s087029018",
"s311678162"
] |
u017810624 | p02715 | python | s330902397 | s331835809 | 116 | 96 | 93,024 | 73,884 | Accepted | Accepted | 17.24 | def cmb(n,r,mod):
if r<0 or r>n:
return 0
r=min(r,n-r)
return g1[n]*g2[r]*g2[n-r]%mod
n,k=list(map(int,input().split()))
mod=10**9+7
g1=[1,1]
g2=[1,1]
inverse=[0,1]
for i in range(2,n+1):
g1.append((g1[-1]*i)%mod)
inverse.append((-inverse[mod%i]*(mod//i))%mod)
g2.append((g2[-1]*inver... | n,k=list(map(int,input().split()))
mod=10**9+7
L=[]
ans=0
for i in range(1,k+1):
L.append(pow(k//i,n,mod))
for i in range(k,0,-1):
x=L[i-1]
for j in range(1,k//i):
x-=L[i*(j+1)-1]
x+=mod
x%=mod
L[i-1]=x
ans+=x*i
ans%=mod
print(ans) | 32 | 16 | 551 | 264 | def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
n, k = list(map(int, input().split()))
mod = 10**9 + 7
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, n + 1):
g1.append((g1[-1] * i) % mod)
inverse.append((-inverse[mod % i]... | n, k = list(map(int, input().split()))
mod = 10**9 + 7
L = []
ans = 0
for i in range(1, k + 1):
L.append(pow(k // i, n, mod))
for i in range(k, 0, -1):
x = L[i - 1]
for j in range(1, k // i):
x -= L[i * (j + 1) - 1]
x += mod
x %= mod
L[i - 1] = x
ans += x * i
ans %= mod
p... | false | 50 | [
"-def cmb(n, r, mod):",
"- if r < 0 or r > n:",
"- return 0",
"- r = min(r, n - r)",
"- return g1[n] * g2[r] * g2[n - r] % mod",
"-",
"-",
"-g1 = [1, 1]",
"-g2 = [1, 1]",
"-inverse = [0, 1]",
"-for i in range(2, n + 1):",
"- g1.append((g1[-1] * i) % mod)",
"- inverse.ap... | false | 0.172762 | 0.148442 | 1.163834 | [
"s330902397",
"s331835809"
] |
u029000441 | p02953 | python | s816898860 | s559153444 | 95 | 84 | 14,636 | 21,052 | Accepted | Accepted | 11.58 | import sys
input = sys.stdin.readline
import math
import collections
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
n=I()
Hs=(LI())
if n==1:
print("Yes")
sys.exit()
for i in range(1,n):
#print(Hs[-i])
i... | #float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import h... | 22 | 36 | 450 | 1,036 | import sys
input = sys.stdin.readline
import math
import collections
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
n = I()
Hs = LI()
if n == 1:
print("Yes")
sys.exit()
for i in range(1, n):
# print(Hs... | # float型を許すな
# numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heapq import heapif... | false | 38.888889 | [
"+# float型を許すな",
"+# numpyはpythonで",
"-import math",
"-import collections",
"+sys.setrecursionlimit(10**7)",
"+from collections import Counter, deque",
"+from collections import defaultdict",
"+from itertools import combinations, permutations, accumulate, groupby, product",
"+from bisect import bise... | false | 0.037161 | 0.038055 | 0.976498 | [
"s816898860",
"s559153444"
] |
u100858029 | p02642 | python | s577586628 | s608651543 | 197 | 174 | 134,872 | 130,344 | Accepted | Accepted | 11.68 | from collections import Counter
n = int(eval(input()))
a = sorted([int(x) for x in input().split()])
freq = Counter(a)
A = max(a)
good = [True]*(A+1)
ans = 0
for x in freq:
for k in range(2*x,A+1,x):
good[k] = False
if good[x] and freq[x]==1:
ans += 1
print(ans) | N = int(eval(input()))
lineup = sorted([int(x) for x in input().split()])
duplicate={}
for i in lineup:
if i in duplicate:
duplicate[i]+=1
else:
duplicate[i]=1
b=max(lineup)+1
sieve=[1]*(b)
counter=0
for i in range(N):
if sieve[lineup[i]]:
if duplicate[lineup[i]]==1:
... | 13 | 19 | 274 | 432 | from collections import Counter
n = int(eval(input()))
a = sorted([int(x) for x in input().split()])
freq = Counter(a)
A = max(a)
good = [True] * (A + 1)
ans = 0
for x in freq:
for k in range(2 * x, A + 1, x):
good[k] = False
if good[x] and freq[x] == 1:
ans += 1
print(ans)
| N = int(eval(input()))
lineup = sorted([int(x) for x in input().split()])
duplicate = {}
for i in lineup:
if i in duplicate:
duplicate[i] += 1
else:
duplicate[i] = 1
b = max(lineup) + 1
sieve = [1] * (b)
counter = 0
for i in range(N):
if sieve[lineup[i]]:
if duplicate[lineup[i]] == 1... | false | 31.578947 | [
"-from collections import Counter",
"-",
"-n = int(eval(input()))",
"-a = sorted([int(x) for x in input().split()])",
"-freq = Counter(a)",
"-A = max(a)",
"-good = [True] * (A + 1)",
"-ans = 0",
"-for x in freq:",
"- for k in range(2 * x, A + 1, x):",
"- good[k] = False",
"- if go... | false | 0.131582 | 0.068042 | 1.933851 | [
"s577586628",
"s608651543"
] |
u912237403 | p00098 | python | s968983173 | s737127734 | 390 | 270 | 4,492 | 4,496 | Accepted | Accepted | 30.77 | m=-1e9
n=int(input())
N=list(range(n))
B=[[0]*(n+1) for _ in range(n+1)]
for _ in N:
A=list(map(int,input().split()))
for j in N:
s=0
b=B[j]
for k in N[j:]:
s+=A[k]
b[k]=max(b[k],0)+s
m=max(b[k],m)
print(m) | def f(m,b):
s=0
for k in N[j:]:
s+=A[k]
b[k]=max(b[k],0)+s
m=max(b[k],m)
return m,b
m=-1e9
n=int(input())
N=list(range(n))
B=[[0]*(n+1) for _ in range(n+1)]
for _ in N:
A=list(map(int,input().split()))
for j in N: m,B[j]=f(m,B[j])
print(m) | 14 | 16 | 248 | 272 | m = -1e9
n = int(input())
N = list(range(n))
B = [[0] * (n + 1) for _ in range(n + 1)]
for _ in N:
A = list(map(int, input().split()))
for j in N:
s = 0
b = B[j]
for k in N[j:]:
s += A[k]
b[k] = max(b[k], 0) + s
m = max(b[k], m)
print(m)
| def f(m, b):
s = 0
for k in N[j:]:
s += A[k]
b[k] = max(b[k], 0) + s
m = max(b[k], m)
return m, b
m = -1e9
n = int(input())
N = list(range(n))
B = [[0] * (n + 1) for _ in range(n + 1)]
for _ in N:
A = list(map(int, input().split()))
for j in N:
m, B[j] = f(m, B[j])
... | false | 12.5 | [
"+def f(m, b):",
"+ s = 0",
"+ for k in N[j:]:",
"+ s += A[k]",
"+ b[k] = max(b[k], 0) + s",
"+ m = max(b[k], m)",
"+ return m, b",
"+",
"+",
"- s = 0",
"- b = B[j]",
"- for k in N[j:]:",
"- s += A[k]",
"- b[k] = max(... | false | 0.037325 | 0.037794 | 0.987591 | [
"s968983173",
"s737127734"
] |
u957470671 | p02315 | python | s611470450 | s313849464 | 920 | 540 | 25,500 | 5,920 | Accepted | Accepted | 41.3 | N, W = [int(x) for x in input().split()]
items = []
for i in range(N):
items.append(tuple(int(x) for x in input().split()))
DP = [[0] * (W+1) for _ in range(N+1)]
# DP[i+1][j] = max(DP[i][j], v + DP[i][j-w])
for i in range(N):
for j in range(W+1):
v, w = items[i]
if w <= j:
... | # 0-1 Knapsack Problem
N, W = [int(x) for x in input().split()]
items = []
for i in range(N):
items.append(tuple(int(x) for x in input().split()))
DP = [0] * (W+1)
for i in range(N):
v, w = items[i]
for j in range(W, w-1, -1):
DP[j] = max(DP[j], v + DP[j-w])
print((DP[-1])) | 17 | 13 | 438 | 306 | N, W = [int(x) for x in input().split()]
items = []
for i in range(N):
items.append(tuple(int(x) for x in input().split()))
DP = [[0] * (W + 1) for _ in range(N + 1)]
# DP[i+1][j] = max(DP[i][j], v + DP[i][j-w])
for i in range(N):
for j in range(W + 1):
v, w = items[i]
if w <= j:
DP[... | # 0-1 Knapsack Problem
N, W = [int(x) for x in input().split()]
items = []
for i in range(N):
items.append(tuple(int(x) for x in input().split()))
DP = [0] * (W + 1)
for i in range(N):
v, w = items[i]
for j in range(W, w - 1, -1):
DP[j] = max(DP[j], v + DP[j - w])
print((DP[-1]))
| false | 23.529412 | [
"+# 0-1 Knapsack Problem",
"-DP = [[0] * (W + 1) for _ in range(N + 1)]",
"-# DP[i+1][j] = max(DP[i][j], v + DP[i][j-w])",
"+DP = [0] * (W + 1)",
"- for j in range(W + 1):",
"- v, w = items[i]",
"- if w <= j:",
"- DP[i + 1][j] = max(DP[i][j], v + DP[i][j - w])",
"- ... | false | 0.047643 | 0.048599 | 0.980315 | [
"s611470450",
"s313849464"
] |
u644907318 | p03481 | python | s179057279 | s829947364 | 173 | 65 | 38,256 | 61,888 | Accepted | Accepted | 62.43 | X,Y = list(map(int,input().split()))
k = 0
while X<=Y:
k += 1
X = X*2
print(k) | X,Y = list(map(int,input().split()))
k = 0
while X*2**k<=Y:
k += 1
print(k) | 6 | 5 | 85 | 77 | X, Y = list(map(int, input().split()))
k = 0
while X <= Y:
k += 1
X = X * 2
print(k)
| X, Y = list(map(int, input().split()))
k = 0
while X * 2**k <= Y:
k += 1
print(k)
| false | 16.666667 | [
"-while X <= Y:",
"+while X * 2**k <= Y:",
"- X = X * 2"
] | false | 0.039872 | 0.114032 | 0.349657 | [
"s179057279",
"s829947364"
] |
u203843959 | p02642 | python | s076921658 | s640282851 | 201 | 126 | 155,452 | 106,356 | Accepted | Accepted | 37.31 | from collections import defaultdict
import sys
N=int(eval(input()))
alist=list(map(int,input().split()))
adic=defaultdict(int)
for a in alist:
adic[a]+=1
noset=set()
aset=set()
max_a=0
for a,v in list(adic.items()):
aset.add(a)
max_a=max(max_a,a)
if v>=2:
noset.add(a)
if not aset:
... | N=int(eval(input()))
alist=list(map(int,input().split()))
max_a=max(alist)
exclude_set=set()
tlist=[False]*(max_a+1)
for a in alist:
if tlist[a]:
exclude_set.add(a)
else:
tlist[a]=True
#print(tlist)
for i in range(1,max_a//2+1):
if not tlist[i]:
continue
else:
for j in range(2... | 41 | 27 | 678 | 492 | from collections import defaultdict
import sys
N = int(eval(input()))
alist = list(map(int, input().split()))
adic = defaultdict(int)
for a in alist:
adic[a] += 1
noset = set()
aset = set()
max_a = 0
for a, v in list(adic.items()):
aset.add(a)
max_a = max(max_a, a)
if v >= 2:
noset.add(a)
if no... | N = int(eval(input()))
alist = list(map(int, input().split()))
max_a = max(alist)
exclude_set = set()
tlist = [False] * (max_a + 1)
for a in alist:
if tlist[a]:
exclude_set.add(a)
else:
tlist[a] = True
# print(tlist)
for i in range(1, max_a // 2 + 1):
if not tlist[i]:
continue
el... | false | 34.146341 | [
"-from collections import defaultdict",
"-import sys",
"-",
"-adic = defaultdict(int)",
"+max_a = max(alist)",
"+exclude_set = set()",
"+tlist = [False] * (max_a + 1)",
"- adic[a] += 1",
"-noset = set()",
"-aset = set()",
"-max_a = 0",
"-for a, v in list(adic.items()):",
"- aset.add(a)... | false | 0.038323 | 0.063611 | 0.602469 | [
"s076921658",
"s640282851"
] |
u326609687 | p03014 | python | s478774860 | s368701883 | 535 | 442 | 207,800 | 113,988 | Accepted | Accepted | 17.38 | import numpy as np
import sys
def get_data(stream):
buf = b''
b = stream.buffer.read(1)
while b != b'\n':
buf += b
b = stream.buffer.read(1)
H, W = list(map(int, buf.split()))
c = stream.buffer.read(H * (W + 1))
arr = np.array(c.split())
arr = np.frombuffer(arr... | import numpy as np
import sys
def main():
stream = sys.stdin
buf = stream.buffer.readline()
H, W = list(map(int, buf.split()))
buf = stream.buffer.read(H * (W + 1))
arr = np.frombuffer(buf, dtype='B').reshape((H, W + 1))[:, : -1]
a = (arr == ord('.'))
L = np.empty((H, W), dtype=... | 42 | 32 | 1,056 | 865 | import numpy as np
import sys
def get_data(stream):
buf = b""
b = stream.buffer.read(1)
while b != b"\n":
buf += b
b = stream.buffer.read(1)
H, W = list(map(int, buf.split()))
c = stream.buffer.read(H * (W + 1))
arr = np.array(c.split())
arr = np.frombuffer(arr, dtype="S1")... | import numpy as np
import sys
def main():
stream = sys.stdin
buf = stream.buffer.readline()
H, W = list(map(int, buf.split()))
buf = stream.buffer.read(H * (W + 1))
arr = np.frombuffer(buf, dtype="B").reshape((H, W + 1))[:, :-1]
a = arr == ord(".")
L = np.empty((H, W), dtype="i4")
R = ... | false | 23.809524 | [
"-def get_data(stream):",
"- buf = b\"\"",
"- b = stream.buffer.read(1)",
"- while b != b\"\\n\":",
"- buf += b",
"- b = stream.buffer.read(1)",
"+def main():",
"+ stream = sys.stdin",
"+ buf = stream.buffer.readline()",
"- c = stream.buffer.read(H * (W + 1))",
"-... | false | 0.29501 | 0.317575 | 0.928947 | [
"s478774860",
"s368701883"
] |
u347640436 | p03354 | python | s963344133 | s124518551 | 563 | 373 | 14,008 | 20,320 | Accepted | Accepted | 33.75 | # Union Find 木
from sys import setrecursionlimit
def find(parent, i):
t = parent[i]
if t < 0:
return i
t = find(parent, t)
parent[i] = t
return t
def unite(parent, i, j):
i = find(parent, i)
j = find(parent, j)
if i == j:
return
parent[j] += pare... | # Union Find 木
from sys import setrecursionlimit
def find(parent, i):
t = parent[i]
if t < 0:
return i
t = find(parent, t)
parent[i] = t
return t
def unite(parent, i, j):
i = find(parent, i)
j = find(parent, j)
if i == j:
return
parent[j] += pare... | 38 | 38 | 685 | 685 | # Union Find 木
from sys import setrecursionlimit
def find(parent, i):
t = parent[i]
if t < 0:
return i
t = find(parent, t)
parent[i] = t
return t
def unite(parent, i, j):
i = find(parent, i)
j = find(parent, j)
if i == j:
return
parent[j] += parent[i]
parent[i... | # Union Find 木
from sys import setrecursionlimit
def find(parent, i):
t = parent[i]
if t < 0:
return i
t = find(parent, t)
parent[i] = t
return t
def unite(parent, i, j):
i = find(parent, i)
j = find(parent, j)
if i == j:
return
parent[j] += parent[i]
parent[i... | false | 0 | [
"-setrecursionlimit(10**5)",
"+setrecursionlimit(10**6)"
] | false | 0.035934 | 0.070471 | 0.509912 | [
"s963344133",
"s124518551"
] |
u860002137 | p03048 | python | s702865205 | s635397780 | 1,904 | 1,516 | 3,064 | 2,940 | Accepted | Accepted | 20.38 | R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N//R+1):
for g in range((N-r*R)//G+1):
tmp = (N-r*R-g*G)/B
if tmp.is_integer():
ans += 1
print(ans) | R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N // R + 1):
for g in range((N - r * R) // G + 1):
if (N - r * R - g * G) % B==0:
ans += 1
print(ans) | 10 | 9 | 204 | 197 | R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N // R + 1):
for g in range((N - r * R) // G + 1):
tmp = (N - r * R - g * G) / B
if tmp.is_integer():
ans += 1
print(ans)
| R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N // R + 1):
for g in range((N - r * R) // G + 1):
if (N - r * R - g * G) % B == 0:
ans += 1
print(ans)
| false | 10 | [
"- tmp = (N - r * R - g * G) / B",
"- if tmp.is_integer():",
"+ if (N - r * R - g * G) % B == 0:"
] | false | 0.066929 | 0.211834 | 0.315952 | [
"s702865205",
"s635397780"
] |
u540799318 | p02972 | python | s830658180 | s746753932 | 1,599 | 375 | 8,784 | 63,592 | Accepted | Accepted | 76.55 | n= int(input())
A = list(map(int, input().split()))
B = [0]*(n+1)
B_sum = [0]*(n+1)
count = 0
for i in range(1,n+1):
j = 1
while (n-i+1)*j <= n:
B_sum[n-i+1] += B[(n-i+1)*j]
j += 1
if B_sum[n-i+1] % 2 != A[n-i]:
B[n-i+1] = 1
count += 1
print(count)
for i in ... | import sys
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST()... | 26 | 28 | 408 | 682 | n = int(input())
A = list(map(int, input().split()))
B = [0] * (n + 1)
B_sum = [0] * (n + 1)
count = 0
for i in range(1, n + 1):
j = 1
while (n - i + 1) * j <= n:
B_sum[n - i + 1] += B[(n - i + 1) * j]
j += 1
if B_sum[n - i + 1] % 2 != A[n - i]:
B[n - i + 1] = 1
count += 1
pr... | import sys
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10**5 + 10)
def input():
return sys.stdin.readline().strip()
def INT():
return int(input())
def MAP():
return map(int, input().split())
d... | false | 7.142857 | [
"-n = int(input())",
"-A = list(map(int, input().split()))",
"-B = [0] * (n + 1)",
"-B_sum = [0] * (n + 1)",
"-count = 0",
"-for i in range(1, n + 1):",
"- j = 1",
"- while (n - i + 1) * j <= n:",
"- B_sum[n - i + 1] += B[(n - i + 1) * j]",
"+import sys",
"+from collections import C... | false | 0.040532 | 0.033776 | 1.200013 | [
"s830658180",
"s746753932"
] |
u284854859 | p03857 | python | s520507514 | s530127196 | 1,112 | 837 | 42,044 | 42,124 | Accepted | Accepted | 24.73 | #Union Find
#木の根を求める
def find(x,par):
if par[x] == x:
return x
else:
return find(par[x],par)
#xとyの属する集合の併合
def unite(x,y,par,rank):
x = find(x,par)
y = find(y,par)
if x != y:
#xとyの属している集合が異なる時
if rank[x] < rank[y]:
par[x] = y
... | #Union Find
import sys
#木の根を求める
def find(x,par):
if par[x] == x:
return x
else:
return find(par[x],par)
#xとyの属する集合の併合
def unite(x,y,par,rank):
x = find(x,par)
y = find(y,par)
if x != y:
#xとyの属している集合が異なる時
if rank[x] < rank[y]:
par[x] ... | 62 | 64 | 1,144 | 1,188 | # Union Find
# 木の根を求める
def find(x, par):
if par[x] == x:
return x
else:
return find(par[x], par)
# xとyの属する集合の併合
def unite(x, y, par, rank):
x = find(x, par)
y = find(y, par)
if x != y:
# xとyの属している集合が異なる時
if rank[x] < rank[y]:
par[x] = y
else:
... | # Union Find
import sys
# 木の根を求める
def find(x, par):
if par[x] == x:
return x
else:
return find(par[x], par)
# xとyの属する集合の併合
def unite(x, y, par, rank):
x = find(x, par)
y = find(y, par)
if x != y:
# xとyの属している集合が異なる時
if rank[x] < rank[y]:
par[x] = y
... | false | 3.125 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.044272 | 0.04511 | 0.981428 | [
"s520507514",
"s530127196"
] |
u901447859 | p03773 | python | s368596056 | s398745710 | 27 | 17 | 3,064 | 2,940 | Accepted | Accepted | 37.04 | arr=list(map(int,input().split()))
print((sum(arr)%24)) | print((sum(map(int,input().split()))%24)) | 2 | 1 | 48 | 39 | arr = list(map(int, input().split()))
print((sum(arr) % 24))
| print((sum(map(int, input().split())) % 24))
| false | 50 | [
"-arr = list(map(int, input().split()))",
"-print((sum(arr) % 24))",
"+print((sum(map(int, input().split())) % 24))"
] | false | 0.190192 | 0.042734 | 4.450633 | [
"s368596056",
"s398745710"
] |
u187193817 | p02694 | python | s338005202 | s259183381 | 23 | 21 | 9,164 | 9,112 | Accepted | Accepted | 8.7 | x = int(eval(input()))
depo = 100
year = 0
while(True):
if(depo >= x):
break
depo += int(depo * 0.01)
year += 1
print(year) | x = int(eval(input()))
depo = 100
year = 0
while depo < x:
depo += int(depo * 0.01)
year += 1
print(year) | 9 | 7 | 145 | 121 | x = int(eval(input()))
depo = 100
year = 0
while True:
if depo >= x:
break
depo += int(depo * 0.01)
year += 1
print(year)
| x = int(eval(input()))
depo = 100
year = 0
while depo < x:
depo += int(depo * 0.01)
year += 1
print(year)
| false | 22.222222 | [
"-while True:",
"- if depo >= x:",
"- break",
"+while depo < x:"
] | false | 0.168708 | 0.113478 | 1.48671 | [
"s338005202",
"s259183381"
] |
u600402037 | p03088 | python | s053881680 | s773845132 | 287 | 122 | 48,476 | 3,896 | Accepted | Accepted | 57.49 | N, MOD = int(eval(input())), 10 ** 9 + 7
memo = [{} for _ in range(101)]
def ok(last4):
for i in range(4):
t = list(last4)
if i >= 1:
t[i-1], t[i] = t[i], t[i-1]
if ''.join(t).find('AGC') != -1:
return False
return True
def dfs(cur, last3):
if l... | N = int(eval(input()))
MOD = 10 ** 9 + 7
memo = [{} for _ in range(N)]
def ok(last4):
if last4.find('AGC') != -1:
return False
for i in range(3):
t = list(last4)
t[i], t[i+1] = t[i+1], t[i]
if ''.join(t).find('AGC') != -1:
return False
return True
... | 26 | 29 | 593 | 624 | N, MOD = int(eval(input())), 10**9 + 7
memo = [{} for _ in range(101)]
def ok(last4):
for i in range(4):
t = list(last4)
if i >= 1:
t[i - 1], t[i] = t[i], t[i - 1]
if "".join(t).find("AGC") != -1:
return False
return True
def dfs(cur, last3):
if last3 in m... | N = int(eval(input()))
MOD = 10**9 + 7
memo = [{} for _ in range(N)]
def ok(last4):
if last4.find("AGC") != -1:
return False
for i in range(3):
t = list(last4)
t[i], t[i + 1] = t[i + 1], t[i]
if "".join(t).find("AGC") != -1:
return False
return True
def dfs(i,... | false | 10.344828 | [
"-N, MOD = int(eval(input())), 10**9 + 7",
"-memo = [{} for _ in range(101)]",
"+N = int(eval(input()))",
"+MOD = 10**9 + 7",
"+memo = [{} for _ in range(N)]",
"- for i in range(4):",
"+ if last4.find(\"AGC\") != -1:",
"+ return False",
"+ for i in range(3):",
"- if i >= 1:"... | false | 0.135388 | 0.089858 | 1.506689 | [
"s053881680",
"s773845132"
] |
u046187684 | p02571 | python | s646060696 | s729877762 | 50 | 46 | 8,972 | 9,056 | Accepted | Accepted | 8 | def solve(string):
s, t = list(map(list, string.split()))
ans = len(t)
for i in range(len(s)-len(t)+1):
c = 0
for j, _ in enumerate(t):
c += 1 if s[i + j] != t[j] else 0
ans = min(ans, c)
return str(ans)
pass
if __name__ == '__main__':
import ... | def solve(string):
s, t = list(map(list, string.split()))
ans = min(
sum(1 if s[i + j] != t[j] else 0
for j, _ in enumerate(t))
for i in range(len(s) - len(t) + 1))
return str(ans)
pass
if __name__ == '__main__':
import sys
print((solve(sys.stdin.read(... | 16 | 14 | 362 | 325 | def solve(string):
s, t = list(map(list, string.split()))
ans = len(t)
for i in range(len(s) - len(t) + 1):
c = 0
for j, _ in enumerate(t):
c += 1 if s[i + j] != t[j] else 0
ans = min(ans, c)
return str(ans)
pass
if __name__ == "__main__":
import sys
pr... | def solve(string):
s, t = list(map(list, string.split()))
ans = min(
sum(1 if s[i + j] != t[j] else 0 for j, _ in enumerate(t))
for i in range(len(s) - len(t) + 1)
)
return str(ans)
pass
if __name__ == "__main__":
import sys
print((solve(sys.stdin.read().strip())))
| false | 12.5 | [
"- ans = len(t)",
"- for i in range(len(s) - len(t) + 1):",
"- c = 0",
"- for j, _ in enumerate(t):",
"- c += 1 if s[i + j] != t[j] else 0",
"- ans = min(ans, c)",
"+ ans = min(",
"+ sum(1 if s[i + j] != t[j] else 0 for j, _ in enumerate(t))",
"+ ... | false | 0.069955 | 0.043061 | 1.624567 | [
"s646060696",
"s729877762"
] |
u677121387 | p03379 | python | s924381482 | s784250957 | 772 | 308 | 51,392 | 25,620 | Accepted | Accepted | 60.1 | n = int(eval(input()))
x = [[i,int(item)] for i,item in enumerate(input().split())]
x.sort(key= lambda x:x[1])
for i in range(n):
ans = x[n//2][1] if i < n//2 else x[n//2-1][1]
x[i].append(ans)
x.sort(key= lambda x:x[0])
for i in range(n):
print((x[i][2])) | n = int(eval(input()))
x = [int(i) for i in input().split()]
nx = sorted(x)
a = nx[n//2]
b = nx[n//2-1]
for i in range(n):
ans = a if x[i] < a else b
print(ans)
| 13 | 11 | 276 | 180 | n = int(eval(input()))
x = [[i, int(item)] for i, item in enumerate(input().split())]
x.sort(key=lambda x: x[1])
for i in range(n):
ans = x[n // 2][1] if i < n // 2 else x[n // 2 - 1][1]
x[i].append(ans)
x.sort(key=lambda x: x[0])
for i in range(n):
print((x[i][2]))
| n = int(eval(input()))
x = [int(i) for i in input().split()]
nx = sorted(x)
a = nx[n // 2]
b = nx[n // 2 - 1]
for i in range(n):
ans = a if x[i] < a else b
print(ans)
| false | 15.384615 | [
"-x = [[i, int(item)] for i, item in enumerate(input().split())]",
"-x.sort(key=lambda x: x[1])",
"+x = [int(i) for i in input().split()]",
"+nx = sorted(x)",
"+a = nx[n // 2]",
"+b = nx[n // 2 - 1]",
"- ans = x[n // 2][1] if i < n // 2 else x[n // 2 - 1][1]",
"- x[i].append(ans)",
"-x.sort(ke... | false | 0.042425 | 0.042318 | 1.002523 | [
"s924381482",
"s784250957"
] |
u078042885 | p00042 | python | s171017437 | s763289547 | 550 | 370 | 7,612 | 7,652 | Accepted | Accepted | 32.73 | c=1
while 1:
W=int(eval(input()))
if W==0:break
n=int(eval(input()))
dp=[0]*(W+1)
for i in range(n):
v,w = list(map(int, input().split(',')))
for j in range(W,w-1,-1):
dp[j]=max(dp[j-w]+v,dp[j])
for i in range(W+1):
if dp[W]==dp[i]:break
print(... | c=1
while 1:
W=int(eval(input()))
if W==0:break
dp=[0]*(W+1)
for i in range(int(eval(input()))):
v,w=list(map(int, input().split(',')))
for j in range(W,w-1,-1):
if dp[j]<dp[j-w]+v:dp[j]=dp[j-w]+v
for i in range(W+1):
if dp[W]==dp[i]:break
print(('C... | 14 | 13 | 343 | 340 | c = 1
while 1:
W = int(eval(input()))
if W == 0:
break
n = int(eval(input()))
dp = [0] * (W + 1)
for i in range(n):
v, w = list(map(int, input().split(",")))
for j in range(W, w - 1, -1):
dp[j] = max(dp[j - w] + v, dp[j])
for i in range(W + 1):
if dp[W... | c = 1
while 1:
W = int(eval(input()))
if W == 0:
break
dp = [0] * (W + 1)
for i in range(int(eval(input()))):
v, w = list(map(int, input().split(",")))
for j in range(W, w - 1, -1):
if dp[j] < dp[j - w] + v:
dp[j] = dp[j - w] + v
for i in range(W +... | false | 7.142857 | [
"- n = int(eval(input()))",
"- for i in range(n):",
"+ for i in range(int(eval(input()))):",
"- dp[j] = max(dp[j - w] + v, dp[j])",
"+ if dp[j] < dp[j - w] + v:",
"+ dp[j] = dp[j - w] + v"
] | false | 0.045178 | 0.045528 | 0.99232 | [
"s171017437",
"s763289547"
] |
u006883624 | p02768 | python | s924290668 | s268594922 | 150 | 114 | 3,572 | 3,572 | Accepted | Accepted | 24 | # from math import sqrt
# from heapq import heappush, heappop
# from collections import deque
from operator import mul
from functools import reduce
# a, b = [int(v) for v in input().split()]
def main():
def modcmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
... | # from math import sqrt
# from heapq import heappush, heappop
# from collections import deque
from operator import mul
from functools import reduce
# a, b = [int(v) for v in input().split()]
def main():
def modcmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
... | 37 | 38 | 919 | 949 | # from math import sqrt
# from heapq import heappush, heappop
# from collections import deque
from operator import mul
from functools import reduce
# a, b = [int(v) for v in input().split()]
def main():
def modcmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
over = ... | # from math import sqrt
# from heapq import heappush, heappop
# from collections import deque
from operator import mul
from functools import reduce
# a, b = [int(v) for v in input().split()]
def main():
def modcmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
over = ... | false | 2.631579 | [
"- for i in range(r):",
"- over = over * (n - i) % mod",
"- under = under * (i + 1) % mod",
"+ for i in range(n, n - r, -1):",
"+ over = over * i % mod",
"+ for i in range(1, r + 1):",
"+ under = under * i % mod"
] | false | 0.078581 | 0.070499 | 1.11465 | [
"s924290668",
"s268594922"
] |
u241159583 | p03659 | python | s073755200 | s101537651 | 209 | 165 | 24,832 | 30,708 | Accepted | Accepted | 21.05 | n = int(eval(input()))
a = list(map(int, input().split()))
N = [0] * (n+1)
for i in range(1, n+1):
N[i] += N[i-1] + a[i-1]
Max = N[-1]
ans = float("INF")
for i in range(1, n):
if abs(N[i] - (Max-N[i])) < ans:
ans = abs(N[i] - (Max-N[i]))
print(ans) | n = int(eval(input()))
A = list(map(int, input().split()))
r = sum(A)-A[0]
l = A[0]
ans = abs(r-l)
for i in range(1,len(A)-1):
r -= A[i]
l += A[i]
ans = min(ans, abs(l-r))
print(ans) | 12 | 10 | 271 | 197 | n = int(eval(input()))
a = list(map(int, input().split()))
N = [0] * (n + 1)
for i in range(1, n + 1):
N[i] += N[i - 1] + a[i - 1]
Max = N[-1]
ans = float("INF")
for i in range(1, n):
if abs(N[i] - (Max - N[i])) < ans:
ans = abs(N[i] - (Max - N[i]))
print(ans)
| n = int(eval(input()))
A = list(map(int, input().split()))
r = sum(A) - A[0]
l = A[0]
ans = abs(r - l)
for i in range(1, len(A) - 1):
r -= A[i]
l += A[i]
ans = min(ans, abs(l - r))
print(ans)
| false | 16.666667 | [
"-a = list(map(int, input().split()))",
"-N = [0] * (n + 1)",
"-for i in range(1, n + 1):",
"- N[i] += N[i - 1] + a[i - 1]",
"-Max = N[-1]",
"-ans = float(\"INF\")",
"-for i in range(1, n):",
"- if abs(N[i] - (Max - N[i])) < ans:",
"- ans = abs(N[i] - (Max - N[i]))",
"+A = list(map(in... | false | 0.0077 | 0.041955 | 0.183525 | [
"s073755200",
"s101537651"
] |
u609061751 | p03038 | python | s012995444 | s599320643 | 454 | 419 | 82,584 | 36,804 | Accepted | Accepted | 7.71 | import sys
input = sys.stdin.readline
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
BC = [[int(x) for x in input().split()] for _ in range(M)]
BC = sorted(BC, reverse = True, key = lambda x:x[1])
N2 = N
D = []
for i in BC:
temp = min(N2,i[0])
D += [i[1]] * temp
N2... | import sys
input = lambda : sys.stdin.readline().rstrip()
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
bc = []
for _ in range(m):
bc.append(list(map(int, input().split())))
bc = sorted(bc, reverse=True, key=lambda x: x[1])
cnt = n
for b, c in bc:
if cnt <= b:
f... | 17 | 22 | 405 | 506 | import sys
input = sys.stdin.readline
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
BC = [[int(x) for x in input().split()] for _ in range(M)]
BC = sorted(BC, reverse=True, key=lambda x: x[1])
N2 = N
D = []
for i in BC:
temp = min(N2, i[0])
D += [i[1]] * temp
N2 -= temp
... | import sys
input = lambda: sys.stdin.readline().rstrip()
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
bc = []
for _ in range(m):
bc.append(list(map(int, input().split())))
bc = sorted(bc, reverse=True, key=lambda x: x[1])
cnt = n
for b, c in bc:
if cnt <= b:
for i in range... | false | 22.727273 | [
"-input = sys.stdin.readline",
"-N, M = [int(x) for x in input().split()]",
"-A = [int(x) for x in input().split()]",
"-BC = [[int(x) for x in input().split()] for _ in range(M)]",
"-BC = sorted(BC, reverse=True, key=lambda x: x[1])",
"-N2 = N",
"-D = []",
"-for i in BC:",
"- temp = min(N2, i[0])... | false | 0.036113 | 0.069141 | 0.522309 | [
"s012995444",
"s599320643"
] |
u022407960 | p02243 | python | s995037853 | s488115292 | 900 | 690 | 62,916 | 62,852 | Accepted | Accepted | 23.33 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5
0 3 2 3 3 1 1 2
1 2 0 2 3 4
2 3 0 3 3 1 4 1
3 4 2 1 0 1 1 4 4 3
4 2 2 1 3 3
output:
0 0
1 2
2 2
3 1
4 3
"""
import sys
import heapq as hp
WHITE, GRAY, BLACK = 0, 1, 2
D_MAX = int(5e10 + 1)
def generate_adj_matrix(v_info):
f... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5
0 3 2 3 3 1 1 2
1 2 0 2 3 4
2 3 0 3 3 1 4 1
3 4 2 1 0 1 1 4 4 3
4 2 2 1 3 3
output:
0 0
1 2
2 2
3 1
4 3
"""
import sys
import heapq as hp
WHITE, GRAY, BLACK = 0, 1, 2
D_MAX = int(5e10 + 1)
def generate_adj_table(v_table):
f... | 80 | 81 | 2,329 | 2,239 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5
0 3 2 3 3 1 1 2
1 2 0 2 3 4
2 3 0 3 3 1 4 1
3 4 2 1 0 1 1 4 4 3
4 2 2 1 3 3
output:
0 0
1 2
2 2
3 1
4 3
"""
import sys
import heapq as hp
WHITE, GRAY, BLACK = 0, 1, 2
D_MAX = int(5e10 + 1)
def generate_adj_matrix(v_info):
for each in v_info:
v_in... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5
0 3 2 3 3 1 1 2
1 2 0 2 3 4
2 3 0 3 3 1 4 1
3 4 2 1 0 1 1 4 4 3
4 2 2 1 3 3
output:
0 0
1 2
2 2
3 1
4 3
"""
import sys
import heapq as hp
WHITE, GRAY, BLACK = 0, 1, 2
D_MAX = int(5e10 + 1)
def generate_adj_table(v_table):
for each in v_table:
v_i... | false | 1.234568 | [
"-def generate_adj_matrix(v_info):",
"- for each in v_info:",
"+def generate_adj_table(v_table):",
"+ for each in v_table:",
"- init_adj_matrix[v_index][pair[0]] = pair[1]",
"- return init_adj_matrix",
"+ init_adj_table[v_index][pair[0]] = pair[1]",
"+ return init_adj... | false | 0.037611 | 0.043551 | 0.863609 | [
"s995037853",
"s488115292"
] |
u380524497 | p04045 | python | s708702555 | s383290511 | 320 | 84 | 69,420 | 3,060 | Accepted | Accepted | 73.75 | n, k = list(map(int, input().split()))
D = set(input().split())
use = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
use -= D
use = list(use)
l = len(str(n))
ans = use.copy()
prev = use.copy()
digit = 0
while digit <= l:
temp = []
for x in prev:
for v in use:
temp.append(x... | n, k = list(map(int, input().split()))
D = set(input().split())
use = set(map(str, list(range(10))))
use -= D
for num in range(n, 100*n):
if use >= set(list(str(num))):
print(num)
exit() | 26 | 9 | 480 | 203 | n, k = list(map(int, input().split()))
D = set(input().split())
use = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
use -= D
use = list(use)
l = len(str(n))
ans = use.copy()
prev = use.copy()
digit = 0
while digit <= l:
temp = []
for x in prev:
for v in use:
temp.append(x + v)
ans +... | n, k = list(map(int, input().split()))
D = set(input().split())
use = set(map(str, list(range(10))))
use -= D
for num in range(n, 100 * n):
if use >= set(list(str(num))):
print(num)
exit()
| false | 65.384615 | [
"-use = {\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"}",
"+use = set(map(str, list(range(10))))",
"-use = list(use)",
"-l = len(str(n))",
"-ans = use.copy()",
"-prev = use.copy()",
"-digit = 0",
"-while digit <= l:",
"- temp = []",
"- for x in prev:",
"- for ... | false | 0.084174 | 0.041595 | 2.02366 | [
"s708702555",
"s383290511"
] |
u510829608 | p02264 | python | s998371376 | s354406610 | 840 | 330 | 19,688 | 16,132 | Accepted | Accepted | 60.71 | n, q = list(map(int, input().split()))
process = [input().split() for _ in range(n)]
#print(process)
time = 0
while process:
p = process.pop(0)
if int(p[1]) <= q:
time += int(p[1])
print((p[0], time))
else:
time += q
process.append([p[0], int(p[1])-q]) | from collections import deque
n, q = list(map(int, input().split()))
dq = deque()
for _ in range(n):
name, time = input().split()
dq.append([name, int(time)])
cnt = 0
while dq:
qt = dq.popleft()
if qt[1] <= q:
cnt += qt[1]
print((qt[0], cnt))
else:
cnt +=... | 12 | 20 | 299 | 357 | n, q = list(map(int, input().split()))
process = [input().split() for _ in range(n)]
# print(process)
time = 0
while process:
p = process.pop(0)
if int(p[1]) <= q:
time += int(p[1])
print((p[0], time))
else:
time += q
process.append([p[0], int(p[1]) - q])
| from collections import deque
n, q = list(map(int, input().split()))
dq = deque()
for _ in range(n):
name, time = input().split()
dq.append([name, int(time)])
cnt = 0
while dq:
qt = dq.popleft()
if qt[1] <= q:
cnt += qt[1]
print((qt[0], cnt))
else:
cnt += q
qt[1] -= ... | false | 40 | [
"+from collections import deque",
"+",
"-process = [input().split() for _ in range(n)]",
"-# print(process)",
"-time = 0",
"-while process:",
"- p = process.pop(0)",
"- if int(p[1]) <= q:",
"- time += int(p[1])",
"- print((p[0], time))",
"+dq = deque()",
"+for _ in range(n)... | false | 0.035328 | 0.036378 | 0.971131 | [
"s998371376",
"s354406610"
] |
u527993431 | p02724 | python | s067755585 | s848557423 | 21 | 17 | 2,940 | 2,940 | Accepted | Accepted | 19.05 | N=int(eval(input()))
ans=0
ans+=1000*(N//500)
ans+=((N%500)//5)*5
print(ans) | N=int(eval(input()))
print(((N//500)*1000+((N%500)//5)*5)) | 5 | 2 | 74 | 51 | N = int(eval(input()))
ans = 0
ans += 1000 * (N // 500)
ans += ((N % 500) // 5) * 5
print(ans)
| N = int(eval(input()))
print(((N // 500) * 1000 + ((N % 500) // 5) * 5))
| false | 60 | [
"-ans = 0",
"-ans += 1000 * (N // 500)",
"-ans += ((N % 500) // 5) * 5",
"-print(ans)",
"+print(((N // 500) * 1000 + ((N % 500) // 5) * 5))"
] | false | 0.042061 | 0.045353 | 0.927405 | [
"s067755585",
"s848557423"
] |
u623687794 | p02659 | python | s711956757 | s601795073 | 58 | 21 | 61,836 | 9,164 | Accepted | Accepted | 63.79 | a,b=list(map(float,input().split()))
a=int(a)
b*=10**15
b=int(b)
print(((a*b)//10**15))
| a,b=input().split()
a=int(a)
b=b.replace('.','')
b=int(b)
print(((a*b)//100))
| 5 | 5 | 84 | 80 | a, b = list(map(float, input().split()))
a = int(a)
b *= 10**15
b = int(b)
print(((a * b) // 10**15))
| a, b = input().split()
a = int(a)
b = b.replace(".", "")
b = int(b)
print(((a * b) // 100))
| false | 0 | [
"-a, b = list(map(float, input().split()))",
"+a, b = input().split()",
"-b *= 10**15",
"+b = b.replace(\".\", \"\")",
"-print(((a * b) // 10**15))",
"+print(((a * b) // 100))"
] | false | 0.0546 | 0.077402 | 0.705405 | [
"s711956757",
"s601795073"
] |
u268516119 | p02996 | python | s768923319 | s550254613 | 1,017 | 770 | 74,200 | 31,828 | Accepted | Accepted | 24.29 | N=int(eval(input()))
AB = [[int(i) for i in input().split()] for j in range(N)]
ABDeadStart = [[A,B,B-A] for A,B in AB]#所要時間、初めてないと駄目な時間
MaxShoyou = sum([a for a,b,kaisi in ABDeadStart])
ABDeadStart.sort(key = lambda x:x[2]-MaxShoyou+x[0])
curtime = 0
NO =0
for a,b,ds in ABDeadStart:
if curtime <= ds:
... | N=int(eval(input()))
AB = [tuple(map(int,input().split())) for i in range(N)]
AB.sort(key = lambda x:x[1])
curtime = 0
clear = True
for a,b in AB:
curtime += a
if curtime > b:
clear = False
break
if clear:print("Yes")
else:print("No") | 15 | 12 | 413 | 263 | N = int(eval(input()))
AB = [[int(i) for i in input().split()] for j in range(N)]
ABDeadStart = [[A, B, B - A] for A, B in AB] # 所要時間、初めてないと駄目な時間
MaxShoyou = sum([a for a, b, kaisi in ABDeadStart])
ABDeadStart.sort(key=lambda x: x[2] - MaxShoyou + x[0])
curtime = 0
NO = 0
for a, b, ds in ABDeadStart:
if curtime <=... | N = int(eval(input()))
AB = [tuple(map(int, input().split())) for i in range(N)]
AB.sort(key=lambda x: x[1])
curtime = 0
clear = True
for a, b in AB:
curtime += a
if curtime > b:
clear = False
break
if clear:
print("Yes")
else:
print("No")
| false | 20 | [
"-AB = [[int(i) for i in input().split()] for j in range(N)]",
"-ABDeadStart = [[A, B, B - A] for A, B in AB] # 所要時間、初めてないと駄目な時間",
"-MaxShoyou = sum([a for a, b, kaisi in ABDeadStart])",
"-ABDeadStart.sort(key=lambda x: x[2] - MaxShoyou + x[0])",
"+AB = [tuple(map(int, input().split())) for i in range(N)]"... | false | 0.036502 | 0.04045 | 0.902396 | [
"s768923319",
"s550254613"
] |
u268793453 | p03428 | python | s476668734 | s531113998 | 259 | 219 | 14,236 | 13,320 | Accepted | Accepted | 15.44 | from numpy import argmax
import numpy as np
from collections import defaultdict
cross = np.cross
n = int(eval(input()))
H = [np.array([int(j) for j in input().split()]) for i in range(n)]
if n == 1:
print((1))
exit()
# else n == 2:
# print(0.5)
# print(0.5)
# exit()
convex = [mi... | import numpy as np
from collections import defaultdict
def cross(a, b):
return a[0]*b[1]-a[1]*b[0]
n = int(eval(input()))
H = [np.array([int(j) for j in input().split()]) for i in range(n)]
convex = [min(H, key=lambda x:x[1])]
for i in range(n):
a = H[0] if (H[0] != convex[-1]).any() else H[-1]
... | 42 | 34 | 1,019 | 919 | from numpy import argmax
import numpy as np
from collections import defaultdict
cross = np.cross
n = int(eval(input()))
H = [np.array([int(j) for j in input().split()]) for i in range(n)]
if n == 1:
print((1))
exit()
# else n == 2:
# print(0.5)
# print(0.5)
# exit()
convex = [min(H, key=lambda x: x... | import numpy as np
from collections import defaultdict
def cross(a, b):
return a[0] * b[1] - a[1] * b[0]
n = int(eval(input()))
H = [np.array([int(j) for j in input().split()]) for i in range(n)]
convex = [min(H, key=lambda x: x[1])]
for i in range(n):
a = H[0] if (H[0] != convex[-1]).any() else H[-1]
f... | false | 19.047619 | [
"-from numpy import argmax",
"-cross = np.cross",
"+",
"+def cross(a, b):",
"+ return a[0] * b[1] - a[1] * b[0]",
"+",
"+",
"-if n == 1:",
"- print((1))",
"- exit()",
"-# else n == 2:",
"-# print(0.5)",
"-# print(0.5)",
"-# exit()"
] | false | 0.305412 | 0.725359 | 0.421049 | [
"s476668734",
"s531113998"
] |
u416011173 | p02556 | python | s874573867 | s093705048 | 579 | 499 | 24,852 | 24,880 | Accepted | Accepted | 13.82 | # -*- coding: utf-8 -*-
# モジュールのインポート
import sys
# 標準入力を取得
N = int(eval(input()))
x, y = [], []
for i in range(N):
x_i, y_i = list(map(int, input().split()))
x.append(x_i)
y.append(y_i)
# 求解処理
max_z = -sys.maxsize
min_z = sys.maxsize
max_w = -sys.maxsize
min_w = sys.maxsize
for x_i, y_i i... | # -*- coding: utf-8 -*-
# モジュールのインポート
import sys
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
N = int(eval(input()))
x, y = [], []
for i in range(N):
x_i, y_i = list(map(int, input().split()))
x.append(x_i)
y.append(y... | 28 | 55 | 548 | 1,072 | # -*- coding: utf-8 -*-
# モジュールのインポート
import sys
# 標準入力を取得
N = int(eval(input()))
x, y = [], []
for i in range(N):
x_i, y_i = list(map(int, input().split()))
x.append(x_i)
y.append(y_i)
# 求解処理
max_z = -sys.maxsize
min_z = sys.maxsize
max_w = -sys.maxsize
min_w = sys.maxsize
for x_i, y_i in zip(x, y):
z... | # -*- coding: utf-8 -*-
# モジュールのインポート
import sys
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
N = int(eval(input()))
x, y = [], []
for i in range(N):
x_i, y_i = list(map(int, input().split()))
x.append(x_i)
y.append(y_i)
return N, ... | false | 49.090909 | [
"-# 標準入力を取得",
"-N = int(eval(input()))",
"-x, y = [], []",
"-for i in range(N):",
"- x_i, y_i = list(map(int, input().split()))",
"- x.append(x_i)",
"- y.append(y_i)",
"-# 求解処理",
"-max_z = -sys.maxsize",
"-min_z = sys.maxsize",
"-max_w = -sys.maxsize",
"-min_w = sys.maxsize",
"-for ... | false | 0.077527 | 0.036594 | 2.118588 | [
"s874573867",
"s093705048"
] |
u761320129 | p03112 | python | s083422766 | s815087729 | 1,111 | 786 | 30,396 | 30,412 | Accepted | Accepted | 29.25 | from bisect import bisect
A,B,Q = map(int,input().split())
S = [int(input()) for i in range(A)]
T = [int(input()) for i in range(B)]
qs = [int(input()) for i in range(Q)]
st = []
for s in S:
ti = bisect(T,s)
if ti == 0:
st.append(abs(s-T[0]))
elif ti == B:
st.append(abs(s-T[-1])... | import sys
input = sys.stdin.readline
from bisect import bisect
A,B,Q = map(int,input().split())
S = [int(input()) for i in range(A)]
T = [int(input()) for i in range(B)]
X = [int(input()) for i in range(Q)]
INF = float('inf')
st = []
for s in S:
i = bisect(T,s)
x0,x1 = -INF,INF
if i > 0: x0... | 49 | 40 | 1,125 | 886 | from bisect import bisect
A, B, Q = map(int, input().split())
S = [int(input()) for i in range(A)]
T = [int(input()) for i in range(B)]
qs = [int(input()) for i in range(Q)]
st = []
for s in S:
ti = bisect(T, s)
if ti == 0:
st.append(abs(s - T[0]))
elif ti == B:
st.append(abs(s - T[-1]))
... | import sys
input = sys.stdin.readline
from bisect import bisect
A, B, Q = map(int, input().split())
S = [int(input()) for i in range(A)]
T = [int(input()) for i in range(B)]
X = [int(input()) for i in range(Q)]
INF = float("inf")
st = []
for s in S:
i = bisect(T, s)
x0, x1 = -INF, INF
if i > 0:
x0... | false | 18.367347 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-qs = [int(input()) for i in range(Q)]",
"+X = [int(input()) for i in range(Q)]",
"+INF = float(\"inf\")",
"- ti = bisect(T, s)",
"- if ti == 0:",
"- st.append(abs(s - T[0]))",
"- elif ti == B:",
"- st.append(abs(s - T[-1... | false | 0.058082 | 0.056528 | 1.027502 | [
"s083422766",
"s815087729"
] |
u063091489 | p00884 | python | s807680755 | s495435617 | 110 | 100 | 6,776 | 6,780 | Accepted | Accepted | 9.09 | while True:
N = int(eval(input()))
if N == 0:
break
first_group_menbers = set(input()[:-1].split(":")[1].split(","))
d = {}
for i in range(N-1):
group, members = input()[:-1].split(":")
d[group] = set(members.split(","))
for i in range(N):
... | while True:
N = int(eval(input()))
if N == 0:
break
first_group_menbers = set(input()[:-1].split(":")[1].split(","))
d = {}
for i in range(N-1):
group, members = input()[:-1].split(":")
d[group] = set(members.split(","))
for i in range(N-1):
... | 20 | 19 | 577 | 573 | while True:
N = int(eval(input()))
if N == 0:
break
first_group_menbers = set(input()[:-1].split(":")[1].split(","))
d = {}
for i in range(N - 1):
group, members = input()[:-1].split(":")
d[group] = set(members.split(","))
for i in range(N):
for group, members in ... | while True:
N = int(eval(input()))
if N == 0:
break
first_group_menbers = set(input()[:-1].split(":")[1].split(","))
d = {}
for i in range(N - 1):
group, members = input()[:-1].split(":")
d[group] = set(members.split(","))
for i in range(N - 1):
for group, members... | false | 5 | [
"- for i in range(N):",
"+ for i in range(N - 1):"
] | false | 0.047222 | 0.09726 | 0.485522 | [
"s807680755",
"s495435617"
] |
u932465688 | p03111 | python | s909423697 | s149354750 | 857 | 606 | 3,192 | 3,064 | Accepted | Accepted | 29.29 | N,A,B,C = list(map(int,input().split()))
L = []
for i in range(N):
L.append(int(eval(input())))
MP = float('inf')
n = 4
def Base_10_to_n(X,n):
if (int(X/n)):
return Base_10_to_n(int(X/n),n)+str(X%n)
return str(X%n)
for X in range(4**N):
STR = Base_10_to_n(X,n).zfill(N)
nU = []
uA = []
... | N,A,B,C = list(map(int,input().split()))
L = []
for i in range(N):
L.append(int(eval(input())))
def Base_10_to_n(X,n):
if (int(X/n)):
return Base_10_to_n(int(X/n),n)+str(X%n)
return str(X%n)
n = 4
ans = float('inf')
for X in range(n**N):
STR = Base_10_to_n(X,n).zfill(N)
cur = 0
TAKEA = 0
... | 32 | 32 | 740 | 710 | N, A, B, C = list(map(int, input().split()))
L = []
for i in range(N):
L.append(int(eval(input())))
MP = float("inf")
n = 4
def Base_10_to_n(X, n):
if int(X / n):
return Base_10_to_n(int(X / n), n) + str(X % n)
return str(X % n)
for X in range(4**N):
STR = Base_10_to_n(X, n).zfill(N)
nU ... | N, A, B, C = list(map(int, input().split()))
L = []
for i in range(N):
L.append(int(eval(input())))
def Base_10_to_n(X, n):
if int(X / n):
return Base_10_to_n(int(X / n), n) + str(X % n)
return str(X % n)
n = 4
ans = float("inf")
for X in range(n**N):
STR = Base_10_to_n(X, n).zfill(N)
cu... | false | 0 | [
"-MP = float(\"inf\")",
"-n = 4",
"-for X in range(4**N):",
"+n = 4",
"+ans = float(\"inf\")",
"+for X in range(n**N):",
"- nU = []",
"- uA = []",
"- uB = []",
"- uC = []",
"- SUBMP = 0",
"- for l in range(N):",
"- if STR[l] == \"0\":",
"- nU.append(L[l]... | false | 0.711303 | 0.45276 | 1.571038 | [
"s909423697",
"s149354750"
] |
u078816252 | p03160 | python | s883026604 | s005289873 | 198 | 126 | 13,928 | 13,928 | Accepted | Accepted | 36.36 | N = int(eval(input()))
h = list(map(int,input().split()))
dp = [float('inf') for i in range(N)]
dp[0] = 0
for i in range(N-1):
dp[i+1] = min(dp[i+1],dp[i] + abs(h[i+1]-h[i]))
if i < N-2:
dp[i+2] = min(dp[i+2],dp[i] + abs(h[i+2]-h[i]))
print((dp[N-1]))
| N = int(eval(input()))
A = list(map(int,input().split()))
ans = [float('inf')]*N
ans[0] = 0
ans[1] = abs(A[0]-A[1])
for i in range(2,N):
ans[i] = min(ans[i-1]+abs(A[i]-A[i-1]), ans[i-2]+abs(A[i]-A[i-2]))
print((ans[N-1])) | 10 | 8 | 263 | 222 | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf") for i in range(N)]
dp[0] = 0
for i in range(N - 1):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
if i < N - 2:
dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
print((dp[N - 1]))
| N = int(eval(input()))
A = list(map(int, input().split()))
ans = [float("inf")] * N
ans[0] = 0
ans[1] = abs(A[0] - A[1])
for i in range(2, N):
ans[i] = min(ans[i - 1] + abs(A[i] - A[i - 1]), ans[i - 2] + abs(A[i] - A[i - 2]))
print((ans[N - 1]))
| false | 20 | [
"-h = list(map(int, input().split()))",
"-dp = [float(\"inf\") for i in range(N)]",
"-dp[0] = 0",
"-for i in range(N - 1):",
"- dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))",
"- if i < N - 2:",
"- dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))",
"-print((dp[N - 1]))"... | false | 0.038384 | 0.037619 | 1.020341 | [
"s883026604",
"s005289873"
] |
u977389981 | p03208 | python | s484584885 | s277778962 | 262 | 239 | 7,436 | 11,288 | Accepted | Accepted | 8.78 | n, k = list(map(int, input().split()))
H = [int(eval(input())) for i in range(n)]
H.sort(reverse=True)
ans = 10 ** 9
for i in range(n-k+1):
h = H[i] - H[i+k-1]
ans = min(ans, h)
print(ans) | n, k = list(map(int, input().split()))
A = [int(eval(input())) for i in range(n)]
A.sort(reverse=True)
B = []
for i in range(n-k+1):
diff = A[i] - A[i+k-1]
B.append(diff)
print((min(B))) | 10 | 10 | 199 | 195 | n, k = list(map(int, input().split()))
H = [int(eval(input())) for i in range(n)]
H.sort(reverse=True)
ans = 10**9
for i in range(n - k + 1):
h = H[i] - H[i + k - 1]
ans = min(ans, h)
print(ans)
| n, k = list(map(int, input().split()))
A = [int(eval(input())) for i in range(n)]
A.sort(reverse=True)
B = []
for i in range(n - k + 1):
diff = A[i] - A[i + k - 1]
B.append(diff)
print((min(B)))
| false | 0 | [
"-H = [int(eval(input())) for i in range(n)]",
"-H.sort(reverse=True)",
"-ans = 10**9",
"+A = [int(eval(input())) for i in range(n)]",
"+A.sort(reverse=True)",
"+B = []",
"- h = H[i] - H[i + k - 1]",
"- ans = min(ans, h)",
"-print(ans)",
"+ diff = A[i] - A[i + k - 1]",
"+ B.append(di... | false | 0.040753 | 0.041224 | 0.988582 | [
"s484584885",
"s277778962"
] |
u654470292 | p02848 | python | s984106470 | s884947707 | 200 | 87 | 41,580 | 71,368 | Accepted | Accepted | 56.5 | import sys
def input():
return sys.stdin.readline()[:-1]
n=int(eval(input()))
s=eval(input())
ans=""
for i in range(len(s)):
tmp=n
if ord(s[i])+n>ord("Z"):
tmp=ord(s[i])+n-ord("Z")
ans+=chr(tmp+ord("A")-1)
continue
ans+=chr(ord(s[i])+tmp)
print(ans) | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
def celi(a,b):
return -(-a//b)
sys.... | 15 | 22 | 292 | 587 | import sys
def input():
return sys.stdin.readline()[:-1]
n = int(eval(input()))
s = eval(input())
ans = ""
for i in range(len(s)):
tmp = n
if ord(s[i]) + n > ord("Z"):
tmp = ord(s[i]) + n - ord("Z")
ans += chr(tmp + ord("A") - 1)
continue
ans += chr(ord(s[i]) + tmp)
print(ans... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
def celi(a, b):
return -(-a // b)
s... | false | 31.818182 | [
"-import sys",
"+import bisect, copy, heapq, math, sys",
"+from collections import *",
"+from functools import lru_cache",
"+from itertools import accumulate, combinations, permutations, product",
"+def ruiseki(lst):",
"+ return [0] + list(accumulate(lst))",
"+",
"+",
"+def celi(a, b):",
"+ ... | false | 0.063014 | 0.039017 | 1.61504 | [
"s984106470",
"s884947707"
] |
u773265208 | p02755 | python | s774717125 | s536771541 | 204 | 18 | 38,512 | 2,940 | Accepted | Accepted | 91.18 | import math
import sys
a,b = list(map(int,input().split()))
A = math.floor(a / 0.08)
B = math.floor(b / 0.10)
for i in range(1,1251):
if math.floor(i * 0.08) == a and math.floor(i * 0.10) == b:
print(i)
sys.exit()
print('-1')
| import math
import sys
a,b = list(map(int,input().split()))
for i in range(1,1251):
tax_a = math.floor(i * 0.08)
tax_b = math.floor(i * 0.1)
if tax_a == a and tax_b == b:
print(i)
sys.exit()
print((-1))
| 13 | 12 | 255 | 215 | import math
import sys
a, b = list(map(int, input().split()))
A = math.floor(a / 0.08)
B = math.floor(b / 0.10)
for i in range(1, 1251):
if math.floor(i * 0.08) == a and math.floor(i * 0.10) == b:
print(i)
sys.exit()
print("-1")
| import math
import sys
a, b = list(map(int, input().split()))
for i in range(1, 1251):
tax_a = math.floor(i * 0.08)
tax_b = math.floor(i * 0.1)
if tax_a == a and tax_b == b:
print(i)
sys.exit()
print((-1))
| false | 7.692308 | [
"-A = math.floor(a / 0.08)",
"-B = math.floor(b / 0.10)",
"- if math.floor(i * 0.08) == a and math.floor(i * 0.10) == b:",
"+ tax_a = math.floor(i * 0.08)",
"+ tax_b = math.floor(i * 0.1)",
"+ if tax_a == a and tax_b == b:",
"-print(\"-1\")",
"+print((-1))"
] | false | 0.047235 | 0.04344 | 1.087378 | [
"s774717125",
"s536771541"
] |
u546285759 | p00628 | python | s565915635 | s133972749 | 30 | 20 | 7,412 | 7,500 | Accepted | Accepted | 33.33 | while True:
number = input().split(' ')
if number == ['END', 'OF', 'INPUT']: break
ans = []
for num in number:
ans = ans + ['0'] if num == '' else ans + [str(len(num))]
print((''.join(ans))) | while True:
i = eval(input())
if i == "END OF INPUT":
break
print(("".join(map(str, [0 if x == '' else len(x) for x in i.split(' ')])))) | 7 | 5 | 222 | 152 | while True:
number = input().split(" ")
if number == ["END", "OF", "INPUT"]:
break
ans = []
for num in number:
ans = ans + ["0"] if num == "" else ans + [str(len(num))]
print(("".join(ans)))
| while True:
i = eval(input())
if i == "END OF INPUT":
break
print(("".join(map(str, [0 if x == "" else len(x) for x in i.split(" ")]))))
| false | 28.571429 | [
"- number = input().split(\" \")",
"- if number == [\"END\", \"OF\", \"INPUT\"]:",
"+ i = eval(input())",
"+ if i == \"END OF INPUT\":",
"- ans = []",
"- for num in number:",
"- ans = ans + [\"0\"] if num == \"\" else ans + [str(len(num))]",
"- print((\"\".join(ans)))",
"... | false | 0.051467 | 0.046968 | 1.095784 | [
"s565915635",
"s133972749"
] |
u017810624 | p02734 | python | s205141242 | s973220173 | 881 | 742 | 246,452 | 44,720 | Accepted | Accepted | 15.78 | n,s=list(map(int,input().split()))
a=list(map(int,input().split()))
mod=998244353
dp0=[[0]*(s+1) for i in range(n+1)]
dp1=[[0]*(s+1) for i in range(n+1)]
dp2=[[0]*(s+1) for i in range(n+1)]
dp0[0][0]=1
for i in range(n):
for j in range(s+1):
if j>=a[i]:
dp1[i+1][j]=(dp0[i][j-a[i]]+dp1[i][j-a[i]]+d... | n,s=list(map(int,input().split()))
a=list(map(int,input().split()))
mod=998244353
dp00=[0]*(s+1)
dp01=[0]*(s+1)
dp10=[0]*(s+1)
dp11=[0]*(s+1)
dp20=[0]*(s+1)
dp21=[0]*(s+1)
dp00[0]=1
for i in range(n):
for j in range(s+1):
if i%2==0:
if j>=a[i]:
dp11[j]=(dp00[j-a[i]]+dp10[j-a[i]]+dp00[j... | 17 | 32 | 584 | 880 | n, s = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 998244353
dp0 = [[0] * (s + 1) for i in range(n + 1)]
dp1 = [[0] * (s + 1) for i in range(n + 1)]
dp2 = [[0] * (s + 1) for i in range(n + 1)]
dp0[0][0] = 1
for i in range(n):
for j in range(s + 1):
if j >= a[i]:
dp1... | n, s = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 998244353
dp00 = [0] * (s + 1)
dp01 = [0] * (s + 1)
dp10 = [0] * (s + 1)
dp11 = [0] * (s + 1)
dp20 = [0] * (s + 1)
dp21 = [0] * (s + 1)
dp00[0] = 1
for i in range(n):
for j in range(s + 1):
if i % 2 == 0:
if j >= a[... | false | 46.875 | [
"-dp0 = [[0] * (s + 1) for i in range(n + 1)]",
"-dp1 = [[0] * (s + 1) for i in range(n + 1)]",
"-dp2 = [[0] * (s + 1) for i in range(n + 1)]",
"-dp0[0][0] = 1",
"+dp00 = [0] * (s + 1)",
"+dp01 = [0] * (s + 1)",
"+dp10 = [0] * (s + 1)",
"+dp11 = [0] * (s + 1)",
"+dp20 = [0] * (s + 1)",
"+dp21 = [0... | false | 0.03757 | 0.035947 | 1.045145 | [
"s205141242",
"s973220173"
] |
u941407962 | p02890 | python | s014487782 | s279314651 | 776 | 576 | 118,328 | 118,456 | Accepted | Accepted | 25.77 | I = int(eval(input()))
from collections import Counter
from itertools import accumulate
As = list(map(int, input().split()))
xs = sorted([x for x in list(Counter(As).values())]) + [10**18]
Xs = accumulate(xs)
def bsearch(target, min_i, max_i, func):
# func(index) <= target < func(index+1) となるindexを返す
... | I = int(eval(input()))
from collections import Counter
from itertools import accumulate
As = list(map(int, input().split()))
xs = sorted([x for x in list(Counter(As).values())]) + [10**18]
Xs = accumulate(xs)
N = len(xs) - 1
rs = [0]*I
mny = N+1
for l, (x, X) in enumerate(zip(xs[1:], Xs)):
l += 2
y... | 36 | 20 | 1,028 | 502 | I = int(eval(input()))
from collections import Counter
from itertools import accumulate
As = list(map(int, input().split()))
xs = sorted([x for x in list(Counter(As).values())]) + [10**18]
Xs = accumulate(xs)
def bsearch(target, min_i, max_i, func):
# func(index) <= target < func(index+1) となるindexを返す
if func... | I = int(eval(input()))
from collections import Counter
from itertools import accumulate
As = list(map(int, input().split()))
xs = sorted([x for x in list(Counter(As).values())]) + [10**18]
Xs = accumulate(xs)
N = len(xs) - 1
rs = [0] * I
mny = N + 1
for l, (x, X) in enumerate(zip(xs[1:], Xs)):
l += 2
y = X // ... | false | 44.444444 | [
"-",
"-",
"-def bsearch(target, min_i, max_i, func):",
"- # func(index) <= target < func(index+1) となるindexを返す",
"- if func(max_i) <= target:",
"- return max_i",
"- if target < func(min_i):",
"- return min_i - 1",
"- index = (max_i + min_i) // 2",
"- while True:",
"- ... | false | 0.041408 | 0.036051 | 1.148577 | [
"s014487782",
"s279314651"
] |
u266014018 | p02689 | python | s452283184 | s815361858 | 357 | 198 | 19,940 | 19,920 | Accepted | Accepted | 44.54 | n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
ma = [0]*(n)
for i in range(m):
a,b = [int(x)-1 for x in input().split()]
ma[a] = max(ma[a], h[b])
ma[b] = max(h[a], ma[b])
ans = 0
for i in range(n):
if h[i]>ma[i]:
ans+=1
print(ans)
| def main():
import sys
def input(): return sys.stdin.readline().rstrip()
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
height = [0]*n
for i in range(m):
a, b = [int(x)-1 for x in input().split()]
height[a] = max(height[a], h[b])
heigh... | 12 | 19 | 277 | 503 | n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ma = [0] * (n)
for i in range(m):
a, b = [int(x) - 1 for x in input().split()]
ma[a] = max(ma[a], h[b])
ma[b] = max(h[a], ma[b])
ans = 0
for i in range(n):
if h[i] > ma[i]:
ans += 1
print(ans)
| def main():
import sys
def input():
return sys.stdin.readline().rstrip()
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
height = [0] * n
for i in range(m):
a, b = [int(x) - 1 for x in input().split()]
height[a] = max(height[a], h[b])
... | false | 36.842105 | [
"-n, m = list(map(int, input().split()))",
"-h = list(map(int, input().split()))",
"-ma = [0] * (n)",
"-for i in range(m):",
"- a, b = [int(x) - 1 for x in input().split()]",
"- ma[a] = max(ma[a], h[b])",
"- ma[b] = max(h[a], ma[b])",
"-ans = 0",
"-for i in range(n):",
"- if h[i] > ma[... | false | 0.046297 | 0.08564 | 0.540601 | [
"s452283184",
"s815361858"
] |
u063052907 | p03986 | python | s093255133 | s261028893 | 49 | 41 | 3,500 | 3,500 | Accepted | Accepted | 16.33 | # coding: utf-8
n_S, n_T = 0, 0
for c in eval(input()):
if c == "S":
n_S += 1
else:
if n_S:
n_S -= 1
else:
n_T += 1
print((n_S + n_T)) | X = eval(input())
cnt_S, cnt_T = 0, 0
for c in X:
if c == "S":
cnt_S += 1
else:
if cnt_S:
cnt_S -= 1
else:
cnt_T += 1
print((cnt_S + cnt_T)) | 12 | 12 | 194 | 200 | # coding: utf-8
n_S, n_T = 0, 0
for c in eval(input()):
if c == "S":
n_S += 1
else:
if n_S:
n_S -= 1
else:
n_T += 1
print((n_S + n_T))
| X = eval(input())
cnt_S, cnt_T = 0, 0
for c in X:
if c == "S":
cnt_S += 1
else:
if cnt_S:
cnt_S -= 1
else:
cnt_T += 1
print((cnt_S + cnt_T))
| false | 0 | [
"-# coding: utf-8",
"-n_S, n_T = 0, 0",
"-for c in eval(input()):",
"+X = eval(input())",
"+cnt_S, cnt_T = 0, 0",
"+for c in X:",
"- n_S += 1",
"+ cnt_S += 1",
"- if n_S:",
"- n_S -= 1",
"+ if cnt_S:",
"+ cnt_S -= 1",
"- n_T += 1",... | false | 0.036518 | 0.047977 | 0.761159 | [
"s093255133",
"s261028893"
] |
u212328220 | p03627 | python | s458777625 | s464306737 | 217 | 112 | 21,412 | 22,324 | Accepted | Accepted | 48.39 | from collections import defaultdict
N = int(eval(input()))
al = list(map(int,input().split()))
edge_dic = defaultdict(int)
for n in range(N):
edge_dic[al[n]] += 1
dic = sorted(list(edge_dic.items()), reverse=True)
yoko = 0
tate = 0
for v in dic:
if yoko == 0:
if v[1] >= 2:
... | from collections import Counter
N = int(eval(input()))
al = list(map(int, input().split()))
C_al = Counter(al)
al.sort(reverse=True)
tate = 0
yoko = 0
lst = list(C_al.keys())
lst.sort(reverse=True)
for edge in lst:
if C_al[edge] >= 2:
if tate == 0:
tate = edge
... | 25 | 30 | 499 | 592 | from collections import defaultdict
N = int(eval(input()))
al = list(map(int, input().split()))
edge_dic = defaultdict(int)
for n in range(N):
edge_dic[al[n]] += 1
dic = sorted(list(edge_dic.items()), reverse=True)
yoko = 0
tate = 0
for v in dic:
if yoko == 0:
if v[1] >= 2:
yoko = v[0]
... | from collections import Counter
N = int(eval(input()))
al = list(map(int, input().split()))
C_al = Counter(al)
al.sort(reverse=True)
tate = 0
yoko = 0
lst = list(C_al.keys())
lst.sort(reverse=True)
for edge in lst:
if C_al[edge] >= 2:
if tate == 0:
tate = edge
if C_al[edge] >= 4 and... | false | 16.666667 | [
"-from collections import defaultdict",
"+from collections import Counter",
"-edge_dic = defaultdict(int)",
"-for n in range(N):",
"- edge_dic[al[n]] += 1",
"-dic = sorted(list(edge_dic.items()), reverse=True)",
"+C_al = Counter(al)",
"+al.sort(reverse=True)",
"+tate = 0",
"-tate = 0",
"-for ... | false | 0.086359 | 0.083594 | 1.033077 | [
"s458777625",
"s464306737"
] |
u271934630 | p03575 | python | s158206044 | s580045816 | 230 | 212 | 42,716 | 42,608 | Accepted | Accepted | 7.83 | class UnionFind:
def __init__(self, size):
self.table = [-1 for _ in range(size)]
def find(self, x):
while self.table[x] >= 0:
x = self.table[x]
return x
def union(self, x, y):
s1 = self.find(x)
s2 = self.find(y)
if s1 != s2:
... | class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n+1)]
self.rank = [0] * (n+1)
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
return self.par[x]
def union(self, ... | 41 | 40 | 1,010 | 954 | class UnionFind:
def __init__(self, size):
self.table = [-1 for _ in range(size)]
def find(self, x):
while self.table[x] >= 0:
x = self.table[x]
return x
def union(self, x, y):
s1 = self.find(x)
s2 = self.find(y)
if s1 != s2:
if self.... | class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n + 1)]
self.rank = [0] * (n + 1)
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
return self.par[x]
def union(self, x, y):
... | false | 2.439024 | [
"- def __init__(self, size):",
"- self.table = [-1 for _ in range(size)]",
"+ def __init__(self, n):",
"+ self.par = [i for i in range(n + 1)]",
"+ self.rank = [0] * (n + 1)",
"- while self.table[x] >= 0:",
"- x = self.table[x]",
"- return x",
"+ ... | false | 0.040215 | 0.039658 | 1.014037 | [
"s158206044",
"s580045816"
] |
u535803878 | p03806 | python | s742269711 | s437672711 | 680 | 420 | 227,104 | 188,620 | Accepted | Accepted | 38.24 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n, ma, mb = list(map(int, input().split()))
abc = [None]*n
for i in range(n):
a,b,c = tuple(map(int, input().split()))
abc[i] = (a*mb - b*ma, c)
abc.sort()
d... | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n, ma, mb = list(map(int, input().split()))
abc = [None]*n
for i in range(n):
a,b,c = tuple(map(int, input().split()))
abc[i] = (a*mb - b*ma, c)
abc.sort()
d... | 56 | 48 | 1,280 | 1,136 | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
n, ma, mb = list(map(int, input().split()))
abc = [None] * n
for i in range(n):
a, b, c = tuple(map(int, input().split()))
abc[i] = (a * mb - b * ma, c)
abc.sort()
def... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
n, ma, mb = list(map(int, input().split()))
abc = [None] * n
for i in range(n):
a, b, c = tuple(map(int, input().split()))
abc[i] = (a * mb - b * ma, c)
abc.sort()
def... | false | 14.285714 | [
"- for b in range(1, 1 << n2):",
"- v11, v12 = 0, 0",
"- v21, v22 = 0, 0",
"- for i in range(n2):",
"- if b & 1 << i:",
"- item = l[n1 + i]",
"- v21 += item[0]",
"- v22 += item[1]",
"- if b < (1 << n1) and... | false | 0.095955 | 0.038601 | 2.485815 | [
"s742269711",
"s437672711"
] |
u309141201 | p02720 | python | s373374699 | s085218451 | 1,272 | 265 | 16,672 | 16,272 | Accepted | Accepted | 79.17 | from queue import Queue
k = int(eval(input()))
q = Queue()
Lunlun = []
for i in range(1, 10):
q.put(i)
while True:
if len(Lunlun) >= 10**5:
break
now = q.get()
Lunlun.append(now)
for i in range(-1, 2):
if (now % 10) + i < 0 or 9 < (now % 10) + i:
continue
... | import collections
# from queue import Queue
k = int(eval(input()))
q = collections.deque()
Lunlun = []
for i in range(1, 10):
q.append(i)
while True:
if len(Lunlun) >= 10**5:
break
now = q.popleft()
Lunlun.append(now)
for i in range(-1, 2):
if (now % 10) + i < 0 or 9 < ... | 17 | 18 | 372 | 417 | from queue import Queue
k = int(eval(input()))
q = Queue()
Lunlun = []
for i in range(1, 10):
q.put(i)
while True:
if len(Lunlun) >= 10**5:
break
now = q.get()
Lunlun.append(now)
for i in range(-1, 2):
if (now % 10) + i < 0 or 9 < (now % 10) + i:
continue
q.put(n... | import collections
# from queue import Queue
k = int(eval(input()))
q = collections.deque()
Lunlun = []
for i in range(1, 10):
q.append(i)
while True:
if len(Lunlun) >= 10**5:
break
now = q.popleft()
Lunlun.append(now)
for i in range(-1, 2):
if (now % 10) + i < 0 or 9 < (now % 10) +... | false | 5.555556 | [
"-from queue import Queue",
"+import collections",
"+# from queue import Queue",
"-q = Queue()",
"+q = collections.deque()",
"- q.put(i)",
"+ q.append(i)",
"- now = q.get()",
"+ now = q.popleft()",
"- q.put(now * 10 + (now % 10) + i)",
"+ q.append(now * 10 + (now % 10) ... | false | 1.147833 | 0.267956 | 4.283669 | [
"s373374699",
"s085218451"
] |
u350248178 | p02726 | python | s581700235 | s457806646 | 1,509 | 1,315 | 34,676 | 3,188 | Accepted | Accepted | 12.86 | n,x,y=[int(j) for j in input().split()]
l=[[0]*n for i in range(n)]
ans=[0]*n
x-=1
y-=1
s=y-x-1
for i in range(n):
for j in range(n):
if i<j:
ans[min(j-i,abs(i-x)+abs(j-y)+1,)]+=1
print(('\n'.join(map(str,ans[1:]))))
| n,x,y=[int(j) for j in input().split()]
ans=[0]*n
for i in range(1,1+n):
for j in range(i+1,1+n):
t=min(j-i,abs(x-i)+abs(y-j)+1)
ans[t]+=1
print(('\n'.join(map(str,ans[1:])))) | 15 | 7 | 257 | 199 | n, x, y = [int(j) for j in input().split()]
l = [[0] * n for i in range(n)]
ans = [0] * n
x -= 1
y -= 1
s = y - x - 1
for i in range(n):
for j in range(n):
if i < j:
ans[
min(
j - i,
abs(i - x) + abs(j - y) + 1,
)
... | n, x, y = [int(j) for j in input().split()]
ans = [0] * n
for i in range(1, 1 + n):
for j in range(i + 1, 1 + n):
t = min(j - i, abs(x - i) + abs(y - j) + 1)
ans[t] += 1
print(("\n".join(map(str, ans[1:]))))
| false | 53.333333 | [
"-l = [[0] * n for i in range(n)]",
"-x -= 1",
"-y -= 1",
"-s = y - x - 1",
"-for i in range(n):",
"- for j in range(n):",
"- if i < j:",
"- ans[",
"- min(",
"- j - i,",
"- abs(i - x) + abs(j - y) + 1,",
"- ... | false | 0.046148 | 0.03676 | 1.255408 | [
"s581700235",
"s457806646"
] |
u325282913 | p02972 | python | s608032295 | s916171785 | 1,319 | 159 | 12,440 | 98,072 | Accepted | Accepted | 87.95 | N = int(input())
arr = list(map(int, input().split()))
ans_list = [0] * (N)
ans = []
for i in range(N):
summ = 0
j = N - i
while j < N:
j = j + N - i
if j - 1 < N:
summ += ans_list[j-1]
if (summ % 2) != arr[N - i - 1]:
ans_list[N - i - 1] = 1
ans.... | N = int(eval(input()))
arr = list(map(int, input().split()))
ans = [0]*N
for i in range(N):
target = N-1-i
tmp = 0
for k in range(target,N,target+1):
tmp += ans[k]
if tmp % 2 == arr[target]:
ans[target] = 0
else:
ans[target] = 1
ans2 = []
for i in range(N):
... | 27 | 18 | 495 | 387 | N = int(input())
arr = list(map(int, input().split()))
ans_list = [0] * (N)
ans = []
for i in range(N):
summ = 0
j = N - i
while j < N:
j = j + N - i
if j - 1 < N:
summ += ans_list[j - 1]
if (summ % 2) != arr[N - i - 1]:
ans_list[N - i - 1] = 1
ans.append(N - ... | N = int(eval(input()))
arr = list(map(int, input().split()))
ans = [0] * N
for i in range(N):
target = N - 1 - i
tmp = 0
for k in range(target, N, target + 1):
tmp += ans[k]
if tmp % 2 == arr[target]:
ans[target] = 0
else:
ans[target] = 1
ans2 = []
for i in range(N):
if a... | false | 33.333333 | [
"-N = int(input())",
"+N = int(eval(input()))",
"-ans_list = [0] * (N)",
"-ans = []",
"+ans = [0] * N",
"- summ = 0",
"- j = N - i",
"- while j < N:",
"- j = j + N - i",
"- if j - 1 < N:",
"- summ += ans_list[j - 1]",
"- if (summ % 2) != arr[N - i - 1]:",
... | false | 0.039076 | 0.054355 | 0.718908 | [
"s608032295",
"s916171785"
] |
u462329577 | p02844 | python | s297629086 | s811148887 | 502 | 390 | 41,180 | 40,940 | Accepted | Accepted | 22.31 | #!/usr/bin/env pytho3
n = int(eval(input()))
s = eval(input())
# D - Lucky PIN
# N桁の数字から3桁だけを残して、左から読む時何種類できるか?
# 存在しうる数字は10**3なのでそれぞれの文字に対してO(n)ならいける
# 左から順番に目的の数字が出てくるまで操作すれば良い
ans = 0
for i in range(0,1000):
number = str(i).zfill(3)
digit = 0
for j in s:
if number[digit] == j:
... | n = int(eval(input()))
s = eval(input())
#先頭から見て行って、000~999を含むかを確かめる
# strに直して、あったら次の文字にいく
ans = 0
for i in range(1000):
num = str(i).zfill(3)
pos = 0
for j in range(n):
if num[pos] == s[j]:
pos += 1
if pos == 3:
ans += 1
break
print(ans) | 41 | 15 | 1,172 | 279 | #!/usr/bin/env pytho3
n = int(eval(input()))
s = eval(input())
# D - Lucky PIN
# N桁の数字から3桁だけを残して、左から読む時何種類できるか?
# 存在しうる数字は10**3なのでそれぞれの文字に対してO(n)ならいける
# 左から順番に目的の数字が出てくるまで操作すれば良い
ans = 0
for i in range(0, 1000):
number = str(i).zfill(3)
digit = 0
for j in s:
if number[digit] == j:
digit ... | n = int(eval(input()))
s = eval(input())
# 先頭から見て行って、000~999を含むかを確かめる
# strに直して、あったら次の文字にいく
ans = 0
for i in range(1000):
num = str(i).zfill(3)
pos = 0
for j in range(n):
if num[pos] == s[j]:
pos += 1
if pos == 3:
ans += 1
break
print(ans)
| false | 63.414634 | [
"-#!/usr/bin/env pytho3",
"-# D - Lucky PIN",
"-# N桁の数字から3桁だけを残して、左から読む時何種類できるか?",
"-# 存在しうる数字は10**3なのでそれぞれの文字に対してO(n)ならいける",
"-# 左から順番に目的の数字が出てくるまで操作すれば良い",
"+# 先頭から見て行って、000~999を含むかを確かめる",
"+# strに直して、あったら次の文字にいく",
"-for i in range(0, 1000):",
"- number = str(i).zfill(3)",
"- digit = 0",
... | false | 0.067065 | 0.035137 | 1.908704 | [
"s297629086",
"s811148887"
] |
u022407960 | p02239 | python | s075644408 | s039131846 | 50 | 30 | 8,028 | 8,048 | Accepted | Accepted | 40 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
4
1 2 2 4
2 1 4
3 0
4 1 3
output:
1 0
2 1
3 2
4 1
"""
import sys
from collections import deque
UNVISITED, VISITED_IN_QUEUE, POPPED_OUT = 0, 1, 2
def generate_adj_matrix(v_info):
for v_detail in v_info:
v_index, adj_num,... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
4
1 2 2 4
2 1 4
3 0
4 1 3
output:
1 0
2 1
3 2
4 1
"""
import sys
from collections import deque
UNVISITED, VISITED_IN_QUEUE, POPPED_OUT = 0, 1, 2
def graph_bfs(v_init):
queue = deque()
status[v_init] = VISITED_IN_QUEUE
... | 64 | 59 | 1,486 | 1,306 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
4
1 2 2 4
2 1 4
3 0
4 1 3
output:
1 0
2 1
3 2
4 1
"""
import sys
from collections import deque
UNVISITED, VISITED_IN_QUEUE, POPPED_OUT = 0, 1, 2
def generate_adj_matrix(v_info):
for v_detail in v_info:
v_index, adj_num, *adj_list = list(map(int, v_... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
4
1 2 2 4
2 1 4
3 0
4 1 3
output:
1 0
2 1
3 2
4 1
"""
import sys
from collections import deque
UNVISITED, VISITED_IN_QUEUE, POPPED_OUT = 0, 1, 2
def graph_bfs(v_init):
queue = deque()
status[v_init] = VISITED_IN_QUEUE
distance[v_init] = 0
queue... | false | 7.8125 | [
"-def generate_adj_matrix(v_info):",
"- for v_detail in v_info:",
"- v_index, adj_num, *adj_list = list(map(int, v_detail))",
"- # assert len(adj_list) == adj_num",
"- init_adj_table[v_index].extend(adj_list)",
"- return init_adj_table",
"-",
"-",
"+ queue = deque()",
... | false | 0.042982 | 0.047868 | 0.897921 | [
"s075644408",
"s039131846"
] |
u936985471 | p02678 | python | s810935745 | s100668648 | 705 | 568 | 54,884 | 41,736 | Accepted | Accepted | 19.43 | # 1からスタートしてBFS、道しるべのない部屋に到達したら、親の番号を道しるべとして設定する
import sys
readline = sys.stdin.readline
N,M = list(map(int,readline().split()))
G = [[] for i in range(N)]
for i in range(M):
a,b = list(map(int,readline().split()))
G[a-1].append(b-1)
G[b-1].append(a-1)
from collections import deque
q = deque([])
... | import sys
readline = sys.stdin.readline
N,M = list(map(int,readline().split()))
G = [[] for i in range(N)]
for i in range(M):
a,b = list(map(int,readline().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
ans = [None] * N
from collections import deque
q = deque([[0,-1]])
while q:
v,paren... | 33 | 24 | 676 | 524 | # 1からスタートしてBFS、道しるべのない部屋に到達したら、親の番号を道しるべとして設定する
import sys
readline = sys.stdin.readline
N, M = list(map(int, readline().split()))
G = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, readline().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
from collections import deque
q = deque([... | import sys
readline = sys.stdin.readline
N, M = list(map(int, readline().split()))
G = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, readline().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
ans = [None] * N
from collections import deque
q = deque([[0, -1]])
while q:
v, paren... | false | 27.272727 | [
"-# 1からスタートしてBFS、道しるべのない部屋に到達したら、親の番号を道しるべとして設定する",
"+ans = [None] * N",
"-q = deque([])",
"-q.append([0, -1])",
"-ans = [-1 for i in range(N)]",
"+q = deque([[0, -1]])",
"- if ans[v] != -1:",
"+ if ans[v] is not None:",
"- ans[v] = parent + 1",
"+ ans[v] = parent",
"- if chil... | false | 0.05569 | 0.067155 | 0.829274 | [
"s810935745",
"s100668648"
] |
u968166680 | p04013 | python | s497834681 | s935026038 | 101 | 74 | 11,484 | 9,260 | Accepted | Accepted | 26.73 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, A, *X = list(map(int, read().split()))
X = [x - A for x in X]
base = 2500
dp = [[0] * 5001 for _ in range(N + 1... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, A, *X = list(map(int, read().split()))
X = [x - A for x in X]
base = 2500
dp = [0] * 5001
dp[base] = 1
... | 32 | 31 | 685 | 567 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, A, *X = list(map(int, read().split()))
X = [x - A for x in X]
base = 2500
dp = [[0] * 5001 for _ in range(N + 1)]
dp[0][base] =... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, A, *X = list(map(int, read().split()))
X = [x - A for x in X]
base = 2500
dp = [0] * 5001
dp[base] = 1
for i in range(N):
... | false | 3.125 | [
"- dp = [[0] * 5001 for _ in range(N + 1)]",
"- dp[0][base] = 1",
"+ dp = [0] * 5001",
"+ dp[base] = 1",
"- for j in range(-2500, 2501):",
"- if -2500 <= j - X[i] <= 2500:",
"- dp[i + 1][j + base] = dp[i][j + base] + dp[i][j - X[i] + base]",
"- e... | false | 0.04 | 0.050688 | 0.789143 | [
"s497834681",
"s935026038"
] |
u145600939 | p02623 | python | s793558788 | s104680100 | 357 | 316 | 47,452 | 47,296 | Accepted | Accepted | 11.48 | import bisect
# 入力
n,m,k = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
# A,Bの累積和を取る
sumA = [0]*(n+1)
sumB = [0]*(m+1)
for i in range(n):
sumA[i+1] = sumA[i] + A[i]
for i in range(m):
sumB[i+1] = sumB[i] + B[i]
ans = 0
# 二分探索
for i,... | # 入力
n,m,k = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
# A,Bの累積和を取る
sumA = [0]*(n+1)
sumB = [0]*(m+1)
for i in range(n):
sumA[i+1] = sumA[i] + A[i]
for i in range(m):
sumB[i+1] = sumB[i] + B[i]
ans = 0
# しゃくとり法
j = m
for i,a in enume... | 24 | 23 | 438 | 437 | import bisect
# 入力
n, m, k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
# A,Bの累積和を取る
sumA = [0] * (n + 1)
sumB = [0] * (m + 1)
for i in range(n):
sumA[i + 1] = sumA[i] + A[i]
for i in range(m):
sumB[i + 1] = sumB[i] + B[i]
ans = 0
# 二分探索
for i, a in... | # 入力
n, m, k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
# A,Bの累積和を取る
sumA = [0] * (n + 1)
sumB = [0] * (m + 1)
for i in range(n):
sumA[i + 1] = sumA[i] + A[i]
for i in range(m):
sumB[i + 1] = sumB[i] + B[i]
ans = 0
# しゃくとり法
j = m
for i, a in enumer... | false | 4.166667 | [
"-import bisect",
"-",
"-# 二分探索",
"+# しゃくとり法",
"+j = m",
"- if a > k:",
"+ while j >= 0 and a + sumB[j] > k:",
"+ j -= 1",
"+ if j < 0:",
"- j = bisect.bisect_right(sumB, k - a)",
"- ans = max(i + j - 1, ans)",
"+ ans = max(ans, i + j)"
] | false | 0.077906 | 0.040682 | 1.915014 | [
"s793558788",
"s104680100"
] |
u297574184 | p03163 | python | s795842390 | s610726416 | 1,475 | 1,348 | 9,588 | 15,080 | Accepted | Accepted | 8.61 | N, capW = list(map(int, input().split()))
items = [tuple(map(int, input().split())) for _ in range(N)]
def knapsack01(items, capW):
dp = [0] * (capW+1)
for wi, vi in items:
for w in reversed(list(range(wi, capW+1))):
v0 = dp[w-wi] + vi
if v0 > dp[w]:
dp[... | N, capW = list(map(int, input().split()))
items = [tuple(map(int, input().split())) for _ in range(N)]
def knapsack01(items, capW):
dp = [0] * (capW+1)
for wi, vi in items:
dp = [v1 if v1 >= v2 else v2 for v1, v2 in zip(dp, [0]*wi + [v+vi for v in dp[:capW-wi+1]])]
return max(dp)
print((k... | 13 | 10 | 370 | 337 | N, capW = list(map(int, input().split()))
items = [tuple(map(int, input().split())) for _ in range(N)]
def knapsack01(items, capW):
dp = [0] * (capW + 1)
for wi, vi in items:
for w in reversed(list(range(wi, capW + 1))):
v0 = dp[w - wi] + vi
if v0 > dp[w]:
dp[w]... | N, capW = list(map(int, input().split()))
items = [tuple(map(int, input().split())) for _ in range(N)]
def knapsack01(items, capW):
dp = [0] * (capW + 1)
for wi, vi in items:
dp = [
v1 if v1 >= v2 else v2
for v1, v2 in zip(dp, [0] * wi + [v + vi for v in dp[: capW - wi + 1]])
... | false | 23.076923 | [
"- for w in reversed(list(range(wi, capW + 1))):",
"- v0 = dp[w - wi] + vi",
"- if v0 > dp[w]:",
"- dp[w] = v0",
"+ dp = [",
"+ v1 if v1 >= v2 else v2",
"+ for v1, v2 in zip(dp, [0] * wi + [v + vi for v in dp[: capW - wi + 1]])",
... | false | 0.040529 | 0.041729 | 0.971256 | [
"s795842390",
"s610726416"
] |
u396495667 | p03943 | python | s777944982 | s556998155 | 171 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.06 | a,b,c = list(map(int, input().split()))
x = a+b
y = b+c
z = c+a
if x ==c or y ==a or z ==b:
print('Yes')
else:
print('No')
| candy= list(map(int, input().split()))
candy.sort()
print(('Yes' if candy[0]+candy[1]==candy[2] else 'No')) | 11 | 3 | 135 | 107 | a, b, c = list(map(int, input().split()))
x = a + b
y = b + c
z = c + a
if x == c or y == a or z == b:
print("Yes")
else:
print("No")
| candy = list(map(int, input().split()))
candy.sort()
print(("Yes" if candy[0] + candy[1] == candy[2] else "No"))
| false | 72.727273 | [
"-a, b, c = list(map(int, input().split()))",
"-x = a + b",
"-y = b + c",
"-z = c + a",
"-if x == c or y == a or z == b:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+candy = list(map(int, input().split()))",
"+candy.sort()",
"+print((\"Yes\" if candy[0] + candy[1] == candy[2] else ... | false | 0.036372 | 0.039882 | 0.911975 | [
"s777944982",
"s556998155"
] |
u998741086 | p02572 | python | s609242981 | s292320438 | 166 | 142 | 31,600 | 31,608 | Accepted | Accepted | 14.46 | #!/usr/bin/env python
n = int(eval(input()))
a = list(map(int, input().split()))
mod = int(1e9)+7
total = sum(a)
ans = 0
for i in range(n):
ans += (a[i]*(total-a[i]))%mod
total -= a[i]
print((ans%mod))
| #!/usr/bin/env python
n = int(eval(input()))
a = list(map(int, input().split()))
mod = int(1e9)+7
s = sum(a)
ans = sub = 0
for i in range(n):
ans += a[i]*s
for i in range(n):
sub += a[i]*a[i]
ans = ((ans-sub)//2)%mod
print(ans)
| 14 | 14 | 220 | 246 | #!/usr/bin/env python
n = int(eval(input()))
a = list(map(int, input().split()))
mod = int(1e9) + 7
total = sum(a)
ans = 0
for i in range(n):
ans += (a[i] * (total - a[i])) % mod
total -= a[i]
print((ans % mod))
| #!/usr/bin/env python
n = int(eval(input()))
a = list(map(int, input().split()))
mod = int(1e9) + 7
s = sum(a)
ans = sub = 0
for i in range(n):
ans += a[i] * s
for i in range(n):
sub += a[i] * a[i]
ans = ((ans - sub) // 2) % mod
print(ans)
| false | 0 | [
"-total = sum(a)",
"-ans = 0",
"+s = sum(a)",
"+ans = sub = 0",
"- ans += (a[i] * (total - a[i])) % mod",
"- total -= a[i]",
"-print((ans % mod))",
"+ ans += a[i] * s",
"+for i in range(n):",
"+ sub += a[i] * a[i]",
"+ans = ((ans - sub) // 2) % mod",
"+print(ans)"
] | false | 0.035368 | 0.047583 | 0.743289 | [
"s609242981",
"s292320438"
] |
u358254559 | p03503 | python | s047011165 | s526027738 | 228 | 202 | 42,604 | 41,708 | Accepted | Accepted | 11.4 | n = int(eval(input()))
f=[]
for i in range(n):
tmp = list(map(int,input().split()))
f.append(tmp)
p=[]
for i in range(n):
tmp = list(map(int,input().split()))
p.append(tmp)
from itertools import *
first=True
ans=-10**12
for tmp in list(product([0,1], repeat=10)):
if first:
fi... | n = int(eval(input()))
f=[]
for i in range(n):
tmp = list(map(int,input().split()))
f.append(tmp)
p=[]
for i in range(n):
tmp = list(map(int,input().split()))
p.append(tmp)
from itertools import *
first=True
ans=-10**12
for tmp in list(product([0,1], repeat=10)):
if first:
fi... | 31 | 26 | 593 | 524 | n = int(eval(input()))
f = []
for i in range(n):
tmp = list(map(int, input().split()))
f.append(tmp)
p = []
for i in range(n):
tmp = list(map(int, input().split()))
p.append(tmp)
from itertools import *
first = True
ans = -(10**12)
for tmp in list(product([0, 1], repeat=10)):
if first:
firs... | n = int(eval(input()))
f = []
for i in range(n):
tmp = list(map(int, input().split()))
f.append(tmp)
p = []
for i in range(n):
tmp = list(map(int, input().split()))
p.append(tmp)
from itertools import *
first = True
ans = -(10**12)
for tmp in list(product([0, 1], repeat=10)):
if first:
firs... | false | 16.129032 | [
"- ona = []",
"- for mise in f:",
"+ sm = 0",
"+ for i in range(n):",
"- cnt += tmp[j] & mise[j]",
"- ona.append(cnt)",
"- sm = 0",
"- for i in range(len(p)):",
"- sm += p[i][ona[i]]",
"+ cnt += tmp[j] & f[i][j]",
"+ sm += p[i][cnt]"
] | false | 0.041514 | 0.042264 | 0.982248 | [
"s047011165",
"s526027738"
] |
u935984175 | p02642 | python | s621682283 | s894630975 | 159 | 108 | 119,824 | 96,704 | Accepted | Accepted | 32.08 | import sys
sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline
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
def solve... | import sys
sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline
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
def solve... | 48 | 42 | 948 | 797 | import sys
sys.setrecursionlimit(10**7)
rl = sys.stdin.readline
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
def solve():
_ = int(rl()... | import sys
sys.setrecursionlimit(10**7)
rl = sys.stdin.readline
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
def solve():
_ = int(rl()... | false | 12.5 | [
"- a_set = set()",
"- memo = set()",
"- for ai in A:",
"- if ai in a_set:",
"- memo.add(ai)",
"- if ai == 1:",
"- print((0))",
"- return",
"- else:",
"- a_set.add(ai)",
"- if 1 in a_set:",
"+ one = A.co... | false | 0.568198 | 0.627834 | 0.905013 | [
"s621682283",
"s894630975"
] |
u575473686 | p03994 | python | s162857128 | s036080529 | 109 | 100 | 3,572 | 3,572 | Accepted | Accepted | 8.26 | def cost_for_next_a(c):
return 123 - ord(c)
s = eval(input())
K = int(eval(input()))
new_s = ""
for i in range(len(s)):
c = s[i]
if i == len(s) - 1:
if cost_for_next_a(c) <= K:
new_s += chr(97 + (K - cost_for_next_a(c)) % 26)
else:
new_s += chr(ord(... | s = eval(input())
K = int(eval(input()))
new_s = ""
# for i in range(len(s)):
# c = s[i]
# if i == len(s) - 1:
# if cost_for_next_a(c) <= K:
# new_s += chr(97 + (K - cost_for_next_a(c)) % 26)
# else:
# new_s += chr(ord(c) + K)
# elif c == 'a':
# ... | 25 | 37 | 495 | 818 | def cost_for_next_a(c):
return 123 - ord(c)
s = eval(input())
K = int(eval(input()))
new_s = ""
for i in range(len(s)):
c = s[i]
if i == len(s) - 1:
if cost_for_next_a(c) <= K:
new_s += chr(97 + (K - cost_for_next_a(c)) % 26)
else:
new_s += chr(ord(c) + K)
elif ... | s = eval(input())
K = int(eval(input()))
new_s = ""
# for i in range(len(s)):
# c = s[i]
# if i == len(s) - 1:
# if cost_for_next_a(c) <= K:
# new_s += chr(97 + (K - cost_for_next_a(c)) % 26)
# else:
# new_s += chr(ord(c) + K)
# elif c == 'a':
# new_s += 'a'
#... | false | 32.432432 | [
"-def cost_for_next_a(c):",
"- return 123 - ord(c)",
"-",
"-",
"+# for i in range(len(s)):",
"+# c = s[i]",
"+# if i == len(s) - 1:",
"+# if cost_for_next_a(c) <= K:",
"+# new_s += chr(97 + (K - cost_for_next_a(c)) % 26)",
"+# else:",
"+# new_s ... | false | 0.093051 | 0.047619 | 1.954082 | [
"s162857128",
"s036080529"
] |
u904989881 | p02257 | python | s250608413 | s886163804 | 360 | 260 | 4,404 | 4,364 | Accepted | Accepted | 27.78 | import math
def prime2(x):
if x == 2: return True
else:
for s in stock:
if x % s == 0: return False
for j in range(3,int(math.sqrt(x))+1,2):
if x % j == 0: return False
else:
stock.append(x)
return True
n = eval(input())
count ... | import math
def prime(x):
if x == 2: return True
elif x % 2 == 0: return False
else:
for j in range(3,int(math.sqrt(x))+1,2):
if x % j == 0: return False
else:
return True
n = eval(input())
count = 0
for i in range(n):
if prime(eval(input())): count +... | 17 | 14 | 401 | 326 | import math
def prime2(x):
if x == 2:
return True
else:
for s in stock:
if x % s == 0:
return False
for j in range(3, int(math.sqrt(x)) + 1, 2):
if x % j == 0:
return False
else:
stock.append(x)
ret... | import math
def prime(x):
if x == 2:
return True
elif x % 2 == 0:
return False
else:
for j in range(3, int(math.sqrt(x)) + 1, 2):
if x % j == 0:
return False
else:
return True
n = eval(input())
count = 0
for i in range(n):
if pr... | false | 17.647059 | [
"-def prime2(x):",
"+def prime(x):",
"+ elif x % 2 == 0:",
"+ return False",
"- for s in stock:",
"- if x % s == 0:",
"- return False",
"- stock.append(x)",
"-stock = [2]",
"- if prime2(eval(input())):",
"+ if prime(eval(input())):"
] | false | 0.134182 | 0.038406 | 3.493814 | [
"s250608413",
"s886163804"
] |
u860657719 | p02642 | python | s962558227 | s096377633 | 158 | 139 | 97,040 | 105,816 | Accepted | Accepted | 12.03 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
furui = [False] * (10**6+1)
ans = 0
for i in range(n):
if i-1 >= 0 and a[i] == a[i-1]:
continue
if furui[a[i]] == False:
if (i + 1 < n and a[i] != a[i + 1]) or i==n-1:
ans += 1
now = a[i]
... | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
#furui = [False] * (10**6+1)
#ans = 0
#for i in range(n):
# if i-1 >= 0 and a[i] == a[i-1]:
# continue
# if furui[a[i]] == False:
# if (i + 1 < n and a[i] != a[i + 1]) or i==n-1:
# ans += 1
# now = a[i]
... | 16 | 31 | 401 | 733 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
furui = [False] * (10**6 + 1)
ans = 0
for i in range(n):
if i - 1 >= 0 and a[i] == a[i - 1]:
continue
if furui[a[i]] == False:
if (i + 1 < n and a[i] != a[i + 1]) or i == n - 1:
ans += 1
now = a[i]
wh... | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
# furui = [False] * (10**6+1)
# ans = 0
# for i in range(n):
# if i-1 >= 0 and a[i] == a[i-1]:
# continue
# if furui[a[i]] == False:
# if (i + 1 < n and a[i] != a[i + 1]) or i==n-1:
# ans += 1
# now = a[i]
# ... | false | 48.387097 | [
"-furui = [False] * (10**6 + 1)",
"+# furui = [False] * (10**6+1)",
"+# ans = 0",
"+# for i in range(n):",
"+# if i-1 >= 0 and a[i] == a[i-1]:",
"+# continue",
"+# if furui[a[i]] == False:",
"+# if (i + 1 < n and a[i] != a[i + 1]) or i==n-1:",
"+# ans += 1",
"+# ... | false | 0.327547 | 0.36094 | 0.907484 | [
"s962558227",
"s096377633"
] |
u497952650 | p03252 | python | s171928599 | s273814129 | 61 | 41 | 3,632 | 4,016 | Accepted | Accepted | 32.79 | S = eval(input())
T = eval(input())
def chr_count(S):
count = [0]*1000
for i in S:
count[ord(i)] += 1
return count
Sc = chr_count(S)
Tc = chr_count(T)
Sc.sort()
Tc.sort()
if Sc == Tc:
print("Yes")
else:
print("No") | from collections import Counter
S = eval(input())
T = eval(input())
s = sorted(list(Counter(S).values()))
t = sorted(list(Counter(T).values()))
if s == t:
print("Yes")
else:
print("No") | 18 | 12 | 250 | 195 | S = eval(input())
T = eval(input())
def chr_count(S):
count = [0] * 1000
for i in S:
count[ord(i)] += 1
return count
Sc = chr_count(S)
Tc = chr_count(T)
Sc.sort()
Tc.sort()
if Sc == Tc:
print("Yes")
else:
print("No")
| from collections import Counter
S = eval(input())
T = eval(input())
s = sorted(list(Counter(S).values()))
t = sorted(list(Counter(T).values()))
if s == t:
print("Yes")
else:
print("No")
| false | 33.333333 | [
"+from collections import Counter",
"+",
"-",
"-",
"-def chr_count(S):",
"- count = [0] * 1000",
"- for i in S:",
"- count[ord(i)] += 1",
"- return count",
"-",
"-",
"-Sc = chr_count(S)",
"-Tc = chr_count(T)",
"-Sc.sort()",
"-Tc.sort()",
"-if Sc == Tc:",
"+s = sorted(... | false | 0.044737 | 0.007829 | 5.713952 | [
"s171928599",
"s273814129"
] |
u912237403 | p00085 | python | s335119232 | s895513350 | 20 | 10 | 4,236 | 4,228 | Accepted | Accepted | 50 | while 1:
n,m = list(map(int,input().split()))
if n==0 & m==0: break
G = list(range(1, n+1))
while n>1:
if m%n == 0: G = G[:n-1]
else: G = G[m % n:] + G[:(m-1) % n]
n-=1
print(G[0]) | while 1:
n,m=list(map(int,input().split()))
if n==0==m:break
G=list(range(1,n+1))
p=0
while n>1:
p=(p+m-1)%n
G.pop(p)
n-=1
print(G[0]) | 9 | 10 | 201 | 158 | while 1:
n, m = list(map(int, input().split()))
if n == 0 & m == 0:
break
G = list(range(1, n + 1))
while n > 1:
if m % n == 0:
G = G[: n - 1]
else:
G = G[m % n :] + G[: (m - 1) % n]
n -= 1
print(G[0])
| while 1:
n, m = list(map(int, input().split()))
if n == 0 == m:
break
G = list(range(1, n + 1))
p = 0
while n > 1:
p = (p + m - 1) % n
G.pop(p)
n -= 1
print(G[0])
| false | 10 | [
"- if n == 0 & m == 0:",
"+ if n == 0 == m:",
"+ p = 0",
"- if m % n == 0:",
"- G = G[: n - 1]",
"- else:",
"- G = G[m % n :] + G[: (m - 1) % n]",
"+ p = (p + m - 1) % n",
"+ G.pop(p)"
] | false | 0.036577 | 0.086239 | 0.424133 | [
"s335119232",
"s895513350"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.