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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u764860452 | p03048 | python | s843584348 | s890432945 | 1,957 | 1,732 | 3,060 | 2,940 | Accepted | Accepted | 11.5 | def solve():
R,G,B,N=list(map(int,input().split()))
ans=0
for i in range(N+1):
for j in range(N+1):
tmp=N-(R*i+G*j)
if tmp>=0 and tmp%B==0:
ans+=1
print(ans)
solve() | def solve():
R,G,B,N=list(map(int,input().split()))
ans=0
for i in range(N+1):
for j in range(N+1):
tmp=N-R*i-G*j
if tmp>=0 and tmp%B==0:
ans+=1
print(ans)
solve() | 11 | 11 | 234 | 232 | def solve():
R, G, B, N = list(map(int, input().split()))
ans = 0
for i in range(N + 1):
for j in range(N + 1):
tmp = N - (R * i + G * j)
if tmp >= 0 and tmp % B == 0:
ans += 1
print(ans)
solve()
| def solve():
R, G, B, N = list(map(int, input().split()))
ans = 0
for i in range(N + 1):
for j in range(N + 1):
tmp = N - R * i - G * j
if tmp >= 0 and tmp % B == 0:
ans += 1
print(ans)
solve()
| false | 0 | [
"- tmp = N - (R * i + G * j)",
"+ tmp = N - R * i - G * j"
] | false | 0.379693 | 0.363875 | 1.043471 | [
"s843584348",
"s890432945"
] |
u623819879 | p03240 | python | s346014755 | s938801266 | 715 | 235 | 3,064 | 44,656 | Accepted | Accepted | 67.13 | n=int(eval(input()))
a=[]
for i in range(n):
x,y,h=list(map(int,input().split()))
a.append([x,y,h])
def hight(inp):
cx,cy,x,y,h=inp
if h==0:
return -1
else:
return abs(x-cx)+abs(y-cy)+h
for cx in range(101):
for cy in range(101):
H=set()
for ... | n=int(eval(input()))
p=[]
for i in range(n):
p.append(tuple(map(int,input().split())))
p.sort(key=lambda x:-x[2])
for j in range(101):
for k in range(101):
H=None
f=1
for x,y,h in p:
if h>0 and H==None:
H=h+abs(x-j)+abs(y-k)
else:
... | 31 | 18 | 705 | 446 | n = int(eval(input()))
a = []
for i in range(n):
x, y, h = list(map(int, input().split()))
a.append([x, y, h])
def hight(inp):
cx, cy, x, y, h = inp
if h == 0:
return -1
else:
return abs(x - cx) + abs(y - cy) + h
for cx in range(101):
for cy in range(101):
H = set()
... | n = int(eval(input()))
p = []
for i in range(n):
p.append(tuple(map(int, input().split())))
p.sort(key=lambda x: -x[2])
for j in range(101):
for k in range(101):
H = None
f = 1
for x, y, h in p:
if h > 0 and H == None:
H = h + abs(x - j) + abs(y - k)
... | false | 41.935484 | [
"-a = []",
"+p = []",
"- x, y, h = list(map(int, input().split()))",
"- a.append([x, y, h])",
"-",
"-",
"-def hight(inp):",
"- cx, cy, x, y, h = inp",
"- if h == 0:",
"- return -1",
"- else:",
"- return abs(x - cx) + abs(y - cy) + h",
"-",
"-",
"-for cx in ra... | false | 0.160626 | 0.107968 | 1.487722 | [
"s346014755",
"s938801266"
] |
u072717685 | p02713 | python | s710433067 | s926357683 | 1,548 | 1,429 | 9,216 | 9,160 | Accepted | Accepted | 7.69 | from math import gcd
def main():
k = int(eval(input()))
r = 0
for ia in range(1, k + 1):
for ib in range(1, k + 1):
for ic in range(1, k + 1):
t1 = gcd(ib, ic)
r += gcd(t1,ia)
print(r)
if __name__ == '__main__':
main() | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import gcd
def main():
k = int(eval(input()))
r = 0
for i1 in range(1, k + 1):
for i2 in range(1, k + 1):
for i3 in range(1, k + 1):
t1 = gcd(i1, i2)
r += gcd(t1, i3)
... | 13 | 16 | 297 | 366 | from math import gcd
def main():
k = int(eval(input()))
r = 0
for ia in range(1, k + 1):
for ib in range(1, k + 1):
for ic in range(1, k + 1):
t1 = gcd(ib, ic)
r += gcd(t1, ia)
print(r)
if __name__ == "__main__":
main()
| import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import gcd
def main():
k = int(eval(input()))
r = 0
for i1 in range(1, k + 1):
for i2 in range(1, k + 1):
for i3 in range(1, k + 1):
t1 = gcd(i1, i2)
r += gcd(t1, i3)
print(r... | false | 18.75 | [
"+import sys",
"+",
"+read = sys.stdin.read",
"+readlines = sys.stdin.readlines",
"- for ia in range(1, k + 1):",
"- for ib in range(1, k + 1):",
"- for ic in range(1, k + 1):",
"- t1 = gcd(ib, ic)",
"- r += gcd(t1, ia)",
"+ for i1 in range(1, ... | false | 0.207426 | 0.080565 | 2.57464 | [
"s710433067",
"s926357683"
] |
u254871849 | p03448 | python | s643394586 | s988670920 | 53 | 28 | 3,060 | 3,064 | Accepted | Accepted | 47.17 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
count = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
total = 500*i + 100*j + 50*k
if total == x:
count += 1
print(count) | # author: kagemeka
# created: 2019-11-06 14:53:37(JST)
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
def main():
a, b, c, x = (int(i) for i in sys.stdin.read().split())
... | 12 | 39 | 245 | 966 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
count = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
total = 500 * i + 100 * j + 50 * k
if total == x:
count += 1
print(count)
| # author: kagemeka
# created: 2019-11-06 14:53:37(JST)
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
def main():
a, b, c, x = (int(i) for i in sys.stdin.read().split())
combinatio... | false | 69.230769 | [
"-a = int(eval(input()))",
"-b = int(eval(input()))",
"-c = int(eval(input()))",
"-x = int(eval(input()))",
"-count = 0",
"-for i in range(a + 1):",
"- for j in range(b + 1):",
"- for k in range(c + 1):",
"- total = 500 * i + 100 * j + 50 * k",
"- if total == x:",
... | false | 0.140287 | 0.050765 | 2.76345 | [
"s643394586",
"s988670920"
] |
u261103969 | p02547 | python | s750523908 | s310825952 | 65 | 33 | 61,860 | 9,124 | Accepted | Accepted | 49.23 | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
N = int(readline())
cur = 0
cnt = 0
for _ in range(N):
x, y = list(map(int, readline().split()))
if x == y:
cur += 1
else:
... | def judge():
cnt = 0 # 今何連続でゾロ目が出ているか記録しておきます
for _ in range(N):
x, y = list(map(int, input().split()))
if x == y:
# ゾロ目ストリークが1増えました
cnt += 1
else:
# ゾロ目ストリークが切れました
cnt = 0
if cnt == 3:
# 3連続になった瞬間、return... | 29 | 25 | 479 | 465 | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
N = int(readline())
cur = 0
cnt = 0
for _ in range(N):
x, y = list(map(int, readline().split()))
if x == y:
cur += 1
else:
cur = 0
... | def judge():
cnt = 0 # 今何連続でゾロ目が出ているか記録しておきます
for _ in range(N):
x, y = list(map(int, input().split()))
if x == y:
# ゾロ目ストリークが1増えました
cnt += 1
else:
# ゾロ目ストリークが切れました
cnt = 0
if cnt == 3:
# 3連続になった瞬間、return True していいです
... | false | 13.793103 | [
"-import sys",
"-",
"-readline = sys.stdin.readline",
"-MOD = 10**9 + 7",
"-INF = float(\"INF\")",
"-sys.setrecursionlimit(10**5)",
"+def judge():",
"+ cnt = 0 # 今何連続でゾロ目が出ているか記録しておきます",
"+ for _ in range(N):",
"+ x, y = list(map(int, input().split()))",
"+ if x == y:",
"+... | false | 0.047273 | 0.043542 | 1.085686 | [
"s750523908",
"s310825952"
] |
u301461168 | p02265 | python | s473278924 | s544912141 | 4,280 | 2,220 | 71,896 | 71,892 | Accepted | Accepted | 48.13 | # coding: utf-8
import sys
from collections import deque
output_str = deque()
data_cnt = int(eval(input()))
for i in range(data_cnt):
in_command = input().rstrip().split(" ")
if in_command[0] == "insert":
output_str.appendleft(in_command[1])
elif in_command[0] == "delete":
... | # coding: utf-8
import sys
from collections import deque
output_str = deque()
data_cnt = int(eval(input()))
for i in range(data_cnt):
in_command = sys.stdin.readline().rstrip().split(" ")
if in_command[0] == "insert":
output_str.appendleft(in_command[1])
elif in_command[0] == "delete... | 23 | 20 | 575 | 582 | # coding: utf-8
import sys
from collections import deque
output_str = deque()
data_cnt = int(eval(input()))
for i in range(data_cnt):
in_command = input().rstrip().split(" ")
if in_command[0] == "insert":
output_str.appendleft(in_command[1])
elif in_command[0] == "delete":
try:
... | # coding: utf-8
import sys
from collections import deque
output_str = deque()
data_cnt = int(eval(input()))
for i in range(data_cnt):
in_command = sys.stdin.readline().rstrip().split(" ")
if in_command[0] == "insert":
output_str.appendleft(in_command[1])
elif in_command[0] == "delete":
if o... | false | 13.043478 | [
"- in_command = input().rstrip().split(\" \")",
"+ in_command = sys.stdin.readline().rstrip().split(\" \")",
"- try:",
"+ if output_str.count(in_command[1]) > 0:",
"- except:",
"- pass"
] | false | 0.046498 | 0.087114 | 0.533764 | [
"s473278924",
"s544912141"
] |
u645250356 | p02714 | python | s560441376 | s901997195 | 393 | 181 | 74,300 | 73,264 | Accepted | Accepted | 53.94 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
... | 44 | 22 | 1,140 | 606 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.read... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.read... | false | 50 | [
"-ss = [0] * n",
"-for i, t in enumerate(s):",
"- if t == \"R\":",
"- ss[i] = 0",
"- elif t == \"G\":",
"- ss[i] = 1",
"- else:",
"- ss[i] = 2",
"-color = [[0] * 3 for _ in range(n)]",
"-color[0][ss[0]] = 1",
"-for i, t in enumerate(ss):",
"- if i == 0:",
"- ... | false | 0.036796 | 0.036515 | 1.00772 | [
"s560441376",
"s901997195"
] |
u826929627 | p02756 | python | s530900870 | s555000850 | 451 | 411 | 8,436 | 8,436 | Accepted | Accepted | 8.87 | from collections import deque
S = eval(input())
Q = int(eval(input()))
S = deque(S)
cnt_reverse = 0
for q in range(Q):
_ = eval(input())
if _[0] == '1':
cnt_reverse += 1
else:
_T, _F, _C = _.split()
## リバース回数が奇数偶数のいずれかをチェック
if _F == '1':
if cnt_reverse % 2 == 0:
S... | from collections import deque
S = eval(input())
Q = int(eval(input()))
S = deque(S)
flg_reverse = False
for q in range(Q):
_ = eval(input())
if _[0] == '1':
flg_reverse = flg_reverse ^ True
else:
_T, _F, _C = _.split()
## リバース回数が奇数偶数のいずれかをチェック
if _F == '1':
if flg_rever... | 32 | 32 | 550 | 556 | from collections import deque
S = eval(input())
Q = int(eval(input()))
S = deque(S)
cnt_reverse = 0
for q in range(Q):
_ = eval(input())
if _[0] == "1":
cnt_reverse += 1
else:
_T, _F, _C = _.split()
## リバース回数が奇数偶数のいずれかをチェック
if _F == "1":
if cnt_reverse % 2 == 0:
... | from collections import deque
S = eval(input())
Q = int(eval(input()))
S = deque(S)
flg_reverse = False
for q in range(Q):
_ = eval(input())
if _[0] == "1":
flg_reverse = flg_reverse ^ True
else:
_T, _F, _C = _.split()
## リバース回数が奇数偶数のいずれかをチェック
if _F == "1":
if fl... | false | 0 | [
"-cnt_reverse = 0",
"+flg_reverse = False",
"- cnt_reverse += 1",
"+ flg_reverse = flg_reverse ^ True",
"- if cnt_reverse % 2 == 0:",
"+ if flg_reverse:",
"+ S.append(_C)",
"+ else:",
"+ S.appendleft(_C)",
"+ else:... | false | 0.040239 | 0.040412 | 0.9957 | [
"s530900870",
"s555000850"
] |
u392319141 | p03078 | python | s350505167 | s324409324 | 780 | 44 | 4,468 | 5,236 | Accepted | Accepted | 94.36 | from heapq import heappop , heappush
X , Y , Z , K = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
# それぞれソート
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
# 処理済みフラグ
confilm = []
q = [(-(A[0] +... | from heapq import heappush, heappop
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
V = set()
que = [(-(A[0] + B[0] + C[0]), 0, 0, 0)]
V.add((... | 39 | 28 | 841 | 712 | from heapq import heappop, heappush
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
# それぞれソート
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
# 処理済みフラグ
confilm = []
q = [(-(A[0] + B[0] + C[0]), 0, 0,... | from heapq import heappush, heappop
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
V = set()
que = [(-(A[0] + B[0] + C[0]), 0, 0, 0)]
V.add((0, 0, 0))
ans =... | false | 28.205128 | [
"-from heapq import heappop, heappush",
"+from heapq import heappush, heappop",
"-X, Y, Z, K = list(map(int, input().split()))",
"+X, Y, Z, K = map(int, input().split())",
"-# それぞれソート",
"-# 処理済みフラグ",
"-confilm = []",
"-q = [(-(A[0] + B[0] + C[0]), 0, 0, 0)]",
"+V = set()",
"+que = [(-(A[0] + B[0] ... | false | 0.035316 | 0.035186 | 1.003711 | [
"s350505167",
"s324409324"
] |
u508486691 | p03634 | python | s682940583 | s780800662 | 897 | 814 | 124,252 | 115,420 | Accepted | Accepted | 9.25 | import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def I(): return int(eval(input()))
def LI(): return list(map(int, input().split()))
def LIR(row,col):
... | import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def I(): return int(eval(input()))
def LI(): return list(map(int, input().split()))
def LIR(row,col):
... | 55 | 55 | 1,209 | 1,233 | import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def I():
return int(eval(input()))
def LI():
return list(map(int, input().split()))
def LIR(row, col):... | import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def I():
return int(eval(input()))
def LI():
return list(map(int, input().split()))
def LIR(row, col):... | false | 0 | [
"-def dijkstra(E, s, n):",
"- d = [float(\"inf\")] * n",
"+def dijkstra(E, s, n, inf=float(\"inf\")):",
"+ d = [inf] * n",
"- for v, weight in list(E[u].items()):",
"- dnew = du + weight",
"+ for v, dist in E[u]:",
"+ dnew = du + dist",
"-E = [dict() for _ i... | false | 0.036582 | 0.036545 | 1.000999 | [
"s682940583",
"s780800662"
] |
u339199690 | p02724 | python | s535315973 | s818273803 | 486 | 29 | 3,060 | 8,960 | Accepted | Accepted | 94.03 | x = int(eval(input()))
count = 0
count_2 = 0
while x > 0:
if (x >= 500):
x -= 500
count += 1
else:
break
while x > 0:
if (x >= 5):
x -= 5
count_2 += 1
else:
break
print((1000 * count + 5 * count_2)) | X = int(eval(input()))
res = X // 500 * 1000
X %= 500
res += X // 5 * 5
print(res)
| 18 | 7 | 273 | 85 | x = int(eval(input()))
count = 0
count_2 = 0
while x > 0:
if x >= 500:
x -= 500
count += 1
else:
break
while x > 0:
if x >= 5:
x -= 5
count_2 += 1
else:
break
print((1000 * count + 5 * count_2))
| X = int(eval(input()))
res = X // 500 * 1000
X %= 500
res += X // 5 * 5
print(res)
| false | 61.111111 | [
"-x = int(eval(input()))",
"-count = 0",
"-count_2 = 0",
"-while x > 0:",
"- if x >= 500:",
"- x -= 500",
"- count += 1",
"- else:",
"- break",
"-while x > 0:",
"- if x >= 5:",
"- x -= 5",
"- count_2 += 1",
"- else:",
"- break",
"-p... | false | 0.415441 | 0.036584 | 11.355767 | [
"s535315973",
"s818273803"
] |
u325282913 | p03162 | python | s322623229 | s471843620 | 675 | 514 | 60,396 | 22,796 | Accepted | Accepted | 23.85 | N = int(eval(input()))
dp = [[0] * 3 for _ in range(N)]
action = list(map(int, input().split()))
dp[0][0] = action[0]
dp[0][1] = action[1]
dp[0][2] = action[2]
for i in range(N-1):
action = list(map(int, input().split()))
dp[i+1][0] = max(dp[i][1]+action[0],dp[i][2]+action[0])
dp[i+1][1] = max(dp[i... | N = int(eval(input()))
dp = [[0] * 3 for _ in range(N)]
dp[0][0], dp[0][1], dp[0][2] = list(map(int, input().split()))
for i in range(1,N):
a, b, c= list(map(int, input().split()))
dp[i][0] = max(dp[i-1][1]+a,dp[i-1][2]+a)
dp[i][1] = max(dp[i-1][0]+b,dp[i-1][2]+b)
dp[i][2] = max(dp[i-1][1]+c,dp[i... | 12 | 9 | 430 | 332 | N = int(eval(input()))
dp = [[0] * 3 for _ in range(N)]
action = list(map(int, input().split()))
dp[0][0] = action[0]
dp[0][1] = action[1]
dp[0][2] = action[2]
for i in range(N - 1):
action = list(map(int, input().split()))
dp[i + 1][0] = max(dp[i][1] + action[0], dp[i][2] + action[0])
dp[i + 1][1] = max(dp... | N = int(eval(input()))
dp = [[0] * 3 for _ in range(N)]
dp[0][0], dp[0][1], dp[0][2] = list(map(int, input().split()))
for i in range(1, N):
a, b, c = list(map(int, input().split()))
dp[i][0] = max(dp[i - 1][1] + a, dp[i - 1][2] + a)
dp[i][1] = max(dp[i - 1][0] + b, dp[i - 1][2] + b)
dp[i][2] = max(dp[i... | false | 25 | [
"-action = list(map(int, input().split()))",
"-dp[0][0] = action[0]",
"-dp[0][1] = action[1]",
"-dp[0][2] = action[2]",
"-for i in range(N - 1):",
"- action = list(map(int, input().split()))",
"- dp[i + 1][0] = max(dp[i][1] + action[0], dp[i][2] + action[0])",
"- dp[i + 1][1] = max(dp[i][0] +... | false | 0.068489 | 0.035747 | 1.915908 | [
"s322623229",
"s471843620"
] |
u186838327 | p03575 | python | s765747555 | s977006641 | 198 | 73 | 40,304 | 62,316 | Accepted | Accepted | 63.13 | n, m = list(map(int, input().split()))
L = [[0, 0] for _ in range(m)]
g = [[] for _ in range(n)]
for j in range(m):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
L[j][0] = a
L[j][1] = b
from collections import deque
ans = 0
for i in range(m):
g = [[] for _ in range(n)]
f... | n, m = list(map(int, input().split()))
g = [[] for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
g[a].append(b)
g[b].append(a)
def lowlink(g, root=0):
n = len(g)
order = [n]*n
low = [n]*n
s = [root]
cnt = 1
par = [-1]*n
... | 35 | 63 | 777 | 1,502 | n, m = list(map(int, input().split()))
L = [[0, 0] for _ in range(m)]
g = [[] for _ in range(n)]
for j in range(m):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
L[j][0] = a
L[j][1] = b
from collections import deque
ans = 0
for i in range(m):
g = [[] for _ in range(n)]
for j in ran... | n, m = list(map(int, input().split()))
g = [[] for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
g[a].append(b)
g[b].append(a)
def lowlink(g, root=0):
n = len(g)
order = [n] * n
low = [n] * n
s = [root]
cnt = 1
par = [-1] * n
s... | false | 44.444444 | [
"-L = [[0, 0] for _ in range(m)]",
"-for j in range(m):",
"+for i in range(m):",
"- L[j][0] = a",
"- L[j][1] = b",
"-from collections import deque",
"+ g[a].append(b)",
"+ g[b].append(a)",
"-ans = 0",
"-for i in range(m):",
"- g = [[] for _ in range(n)]",
"- for j in range(m)... | false | 0.057098 | 0.080498 | 0.709302 | [
"s765747555",
"s977006641"
] |
u642874916 | p02900 | python | s509022256 | s346772997 | 354 | 311 | 67,944 | 67,692 | Accepted | Accepted | 12.15 |
from fractions import gcd
import itertools
import sys
input = sys.stdin.readline
#nの素数判定
def is_prime(n):
if n == 1:
return False
for i in range(2,int(n**0.5)+1):
if n % i == 0:
return False
return True
#nの約数列挙
def divisor(n):
ass = []
for i in ra... |
from fractions import gcd
import itertools
import sys
input = sys.stdin.readline
# nの素数判定
def is_prime(n):
if n == 1:
return False
for i in range(2, int(n**0.5)+1):
if n % i == 0:
return False
return True
# nの約数列挙
def divisor(n):
ass = []
for i in... | 65 | 97 | 1,151 | 1,782 | from fractions import gcd
import itertools
import sys
input = sys.stdin.readline
# nの素数判定
def is_prime(n):
if n == 1:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
# nの約数列挙
def divisor(n):
ass = []
for i in range(1, int(n**0.5... | from fractions import gcd
import itertools
import sys
input = sys.stdin.readline
# nの素数判定
def is_prime(n):
if n == 1:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
# nの約数列挙
def divisor(n):
ass = []
for i in range(1, int(n**0.5... | false | 32.989691 | [
"+# 素因数分解",
"+def factorization(n):",
"+ arr = []",
"+ temp = n",
"+ for i in range(2, int(-(-(n**0.5) // 1)) + 1):",
"+ if temp % i == 0:",
"+ cnt = 0",
"+ while temp % i == 0:",
"+ cnt += 1",
"+ temp //= i",
"+ arr.... | false | 0.05803 | 0.056688 | 1.023668 | [
"s509022256",
"s346772997"
] |
u057964173 | p03380 | python | s262834633 | s259490338 | 252 | 100 | 62,704 | 14,436 | Accepted | Accepted | 60.32 | import sys
def input(): return sys.stdin.readline().strip()
import math
def resolve():
n=int(eval(input()))
l=list(map(int,input().split()))
l.sort(reverse=True)
ans=0
jissitu=0
naka=l[0]//2
for i in range(1,n):
if l[i]>naka and l[0]-i>jissitu:
ans=l[i]
... | import sys
def input(): return sys.stdin.readline().strip()
import math
def resolve():
n=int(eval(input()))
l=list(map(int,input().split()))
l.sort(reverse=True)
a=l[0]
l.pop(0)
bnum=0
bmax=0
for i in l:
bb=min(i,a-i)
if bmax<bb:
bnum=i
... | 19 | 18 | 461 | 355 | import sys
def input():
return sys.stdin.readline().strip()
import math
def resolve():
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort(reverse=True)
ans = 0
jissitu = 0
naka = l[0] // 2
for i in range(1, n):
if l[i] > naka and l[0] - i > jissitu:
... | import sys
def input():
return sys.stdin.readline().strip()
import math
def resolve():
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort(reverse=True)
a = l[0]
l.pop(0)
bnum = 0
bmax = 0
for i in l:
bb = min(i, a - i)
if bmax < bb:
bn... | false | 5.263158 | [
"- ans = 0",
"- jissitu = 0",
"- naka = l[0] // 2",
"- for i in range(1, n):",
"- if l[i] > naka and l[0] - i > jissitu:",
"- ans = l[i]",
"- jissitu = l[0] - l[i]",
"- elif l[i] <= naka and l[i] > jissitu:",
"- ans = l[i]",
"- ... | false | 0.035639 | 0.035422 | 1.006129 | [
"s262834633",
"s259490338"
] |
u879870653 | p03837 | python | s413441865 | s129177983 | 392 | 179 | 26,612 | 14,080 | Accepted | Accepted | 54.34 | from scipy.sparse.csgraph import csgraph_from_dense, dijkstra
n,m = list(map(int,input().split()))
edges = [[int(x) for x in input().split()] for i in range(m)]
graph = [[False]*n for i in range(n)]
for a, b, c in edges :
graph[a-1][b-1] = c
graph = csgraph_from_dense(graph)
dist = dijkstra(graph, direct... | import sys
input = sys.stdin.readline
from scipy.sparse.csgraph import csgraph_from_dense, dijkstra
n,m = list(map(int,input().split()))
A = [0]*m
B = [0]*m
C = [0]*m
for i in range(m) :
a, b, c = list(map(int,input().split()))
A[i] = a-1
B[i] = b-1
C[i] = c
graph = [[0]*n for i in range... | 17 | 29 | 433 | 556 | from scipy.sparse.csgraph import csgraph_from_dense, dijkstra
n, m = list(map(int, input().split()))
edges = [[int(x) for x in input().split()] for i in range(m)]
graph = [[False] * n for i in range(n)]
for a, b, c in edges:
graph[a - 1][b - 1] = c
graph = csgraph_from_dense(graph)
dist = dijkstra(graph, directed=... | import sys
input = sys.stdin.readline
from scipy.sparse.csgraph import csgraph_from_dense, dijkstra
n, m = list(map(int, input().split()))
A = [0] * m
B = [0] * m
C = [0] * m
for i in range(m):
a, b, c = list(map(int, input().split()))
A[i] = a - 1
B[i] = b - 1
C[i] = c
graph = [[0] * n for i in range... | false | 41.37931 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-edges = [[int(x) for x in input().split()] for i in range(m)]",
"-graph = [[False] * n for i in range(n)]",
"-for a, b, c in edges:",
"- graph[a - 1][b - 1] = c",
"+A = [0] * m",
"+B = [0] * m",
"+C = [0] * m",
"+for i in range(m):",
"+ ... | false | 0.836591 | 1.374215 | 0.608777 | [
"s413441865",
"s129177983"
] |
u339199690 | p03546 | python | s180346634 | s662562727 | 47 | 39 | 9,528 | 9,420 | Accepted | Accepted | 17.02 | import sys
H, W = list(map(int, input().split()))
C = [list(map(int, sys.stdin.readline().rsplit())) for _ in range(10)]
A = [list(map(int, sys.stdin.readline().rsplit())) for _ in range(H)]
for k in range(10):
for i in range(10):
for j in range(10):
if C[i][j] > C[i][k] + C[k][j]:
... | import sys
def warshall_floyd():
for k in range(10):
for i in range(10):
for j in range(10):
C[i][j] = min(C[i][j], C[i][k] + C[k][j])
H, W = list(map(int, input().split()))
inf = float("inf")
C = [list(map(int, sys.stdin.readline().rsplit())) for _ in range(10)]
A =... | 18 | 20 | 484 | 511 | import sys
H, W = list(map(int, input().split()))
C = [list(map(int, sys.stdin.readline().rsplit())) for _ in range(10)]
A = [list(map(int, sys.stdin.readline().rsplit())) for _ in range(H)]
for k in range(10):
for i in range(10):
for j in range(10):
if C[i][j] > C[i][k] + C[k][j]:
... | import sys
def warshall_floyd():
for k in range(10):
for i in range(10):
for j in range(10):
C[i][j] = min(C[i][j], C[i][k] + C[k][j])
H, W = list(map(int, input().split()))
inf = float("inf")
C = [list(map(int, sys.stdin.readline().rsplit())) for _ in range(10)]
A = [list(ma... | false | 10 | [
"+",
"+def warshall_floyd():",
"+ for k in range(10):",
"+ for i in range(10):",
"+ for j in range(10):",
"+ C[i][j] = min(C[i][j], C[i][k] + C[k][j])",
"+",
"+",
"+inf = float(\"inf\")",
"-for k in range(10):",
"- for i in range(10):",
"- for j in... | false | 0.074448 | 0.079346 | 0.938275 | [
"s180346634",
"s662562727"
] |
u706330549 | p02687 | python | s316589574 | s220919488 | 23 | 21 | 8,924 | 8,956 | Accepted | Accepted | 8.7 | s = eval(input())
if s == "ABC":
print("ARC")
else:
print("ABC")
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
s = read().rstrip().decode()
if s == "ABC":
print("ARC")
else:
print("ABC")
| 6 | 11 | 73 | 212 | s = eval(input())
if s == "ABC":
print("ARC")
else:
print("ABC")
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
s = read().rstrip().decode()
if s == "ABC":
print("ARC")
else:
print("ABC")
| false | 45.454545 | [
"-s = eval(input())",
"+import sys",
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+s = read().rstrip().decode()"
] | false | 0.080162 | 0.121864 | 0.6578 | [
"s316589574",
"s220919488"
] |
u102461423 | p02989 | python | s323021880 | s994368220 | 79 | 73 | 14,396 | 11,660 | Accepted | Accepted | 7.59 | N = int(eval(input()))
D = [int(x) for x in input().split()]
D.sort()
M = N//2
x,y = D[M-1:M+1]
answer = y - x
print(answer) | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,*D = list(map(int,read().split()))
n = N//2
D.sort()
answer = D[n] - D[n-1]
print(answer) | 9 | 11 | 128 | 213 | N = int(eval(input()))
D = [int(x) for x in input().split()]
D.sort()
M = N // 2
x, y = D[M - 1 : M + 1]
answer = y - x
print(answer)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *D = list(map(int, read().split()))
n = N // 2
D.sort()
answer = D[n] - D[n - 1]
print(answer)
| false | 18.181818 | [
"-N = int(eval(input()))",
"-D = [int(x) for x in input().split()]",
"+import sys",
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+N, *D = list(map(int, read().split()))",
"+n = N // 2",
"-M = N // 2",
"-x, y = D[M - 1 ... | false | 0.051604 | 0.04676 | 1.103602 | [
"s323021880",
"s994368220"
] |
u049420296 | p03637 | python | s001862404 | s010854887 | 72 | 65 | 14,252 | 15,020 | Accepted | Accepted | 9.72 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt2 = 0
cnt4 = 0
for i in range(n):
if a[i] % 2 == 0:
if a[i] % 4 != 0:
cnt2 += 1
else:
cnt4 += 1
if cnt2:
if ((n-cnt2+1)//2) <= cnt4:
print('Yes')
else:
print('No')
else:
... | n = int(eval(input()))
a = list(map(int, input().split()))
cnt2 = cnt4 = 0
for i in a:
if i % 2 == 0:
if i % 4 != 0:
cnt2 += 1
else:
cnt4 += 1
if cnt2:
if ((n-cnt2+1)//2) <= cnt4:
print('Yes')
else:
print('No')
else:
if (n-cnt2)/... | 22 | 21 | 396 | 380 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt2 = 0
cnt4 = 0
for i in range(n):
if a[i] % 2 == 0:
if a[i] % 4 != 0:
cnt2 += 1
else:
cnt4 += 1
if cnt2:
if ((n - cnt2 + 1) // 2) <= cnt4:
print("Yes")
else:
print("No")
else:
if (n - cn... | n = int(eval(input()))
a = list(map(int, input().split()))
cnt2 = cnt4 = 0
for i in a:
if i % 2 == 0:
if i % 4 != 0:
cnt2 += 1
else:
cnt4 += 1
if cnt2:
if ((n - cnt2 + 1) // 2) <= cnt4:
print("Yes")
else:
print("No")
else:
if (n - cnt2) // 2 <= cnt... | false | 4.545455 | [
"-cnt2 = 0",
"-cnt4 = 0",
"-for i in range(n):",
"- if a[i] % 2 == 0:",
"- if a[i] % 4 != 0:",
"+cnt2 = cnt4 = 0",
"+for i in a:",
"+ if i % 2 == 0:",
"+ if i % 4 != 0:"
] | false | 0.044167 | 0.098367 | 0.448998 | [
"s001862404",
"s010854887"
] |
u645250356 | p03043 | python | s398670105 | s579552464 | 78 | 53 | 3,060 | 3,060 | Accepted | Accepted | 32.05 | n,k = list(map(int,input().split()))
ans = 0
def two(x,y):
for i in range(0,10**9):
if x >= y:
return i
x *= 2
for i in range(1,n+1):
tmp = 1/n
pro = two(i,k)
if pro:
tmp *= (1/2)**pro
else:
pass
ans += tmp
print(ans) | n,k = list(map(int,input().split()))
ans = 0
for i in range(1,n+1):
tmp = 1/n
a = 0
while(i<k):
i *= 2
a += 1
ans += (1/n) * ((1/2)**a)
print(ans) | 17 | 10 | 304 | 181 | n, k = list(map(int, input().split()))
ans = 0
def two(x, y):
for i in range(0, 10**9):
if x >= y:
return i
x *= 2
for i in range(1, n + 1):
tmp = 1 / n
pro = two(i, k)
if pro:
tmp *= (1 / 2) ** pro
else:
pass
ans += tmp
print(ans)
| n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
tmp = 1 / n
a = 0
while i < k:
i *= 2
a += 1
ans += (1 / n) * ((1 / 2) ** a)
print(ans)
| false | 41.176471 | [
"-",
"-",
"-def two(x, y):",
"- for i in range(0, 10**9):",
"- if x >= y:",
"- return i",
"- x *= 2",
"-",
"-",
"- pro = two(i, k)",
"- if pro:",
"- tmp *= (1 / 2) ** pro",
"- else:",
"- pass",
"- ans += tmp",
"+ a = 0",
"+ ... | false | 0.071445 | 0.124919 | 0.571932 | [
"s398670105",
"s579552464"
] |
u047796752 | p03158 | python | s763797823 | s649698996 | 1,499 | 1,369 | 84,332 | 83,948 | Accepted | Accepted | 8.67 | import sys
input = sys.stdin.readline
from bisect import *
def judge(x):
a = N-x
b = x-bisect_left(A, X-(A[x]-X))+1
return a<=b
def binary_search():
l, r = bisect_left(A, X), N-1
while l<=r:
m = (l+r)//2
if judge(m):
r = m-1
... | import sys
input = sys.stdin.readline
from bisect import *
def judge(x):
a = N-x
b = x-bisect_left(A, X-(A[x]-X))+1
return a<=b
def binary_search():
l, r = bisect_left(A, X), N-1
while l<=r:
m = (l+r)//2
if judge(m):
r = m-1
... | 51 | 45 | 992 | 890 | import sys
input = sys.stdin.readline
from bisect import *
def judge(x):
a = N - x
b = x - bisect_left(A, X - (A[x] - X)) + 1
return a <= b
def binary_search():
l, r = bisect_left(A, X), N - 1
while l <= r:
m = (l + r) // 2
if judge(m):
r = m - 1
else:
... | import sys
input = sys.stdin.readline
from bisect import *
def judge(x):
a = N - x
b = x - bisect_left(A, X - (A[x] - X)) + 1
return a <= b
def binary_search():
l, r = bisect_left(A, X), N - 1
while l <= r:
m = (l + r) // 2
if judge(m):
r = m - 1
else:
... | false | 11.764706 | [
"-oacc = [0] * (N + 1)",
"- if i % 2 == 0:",
"- eacc[i + 1] = eacc[i] + A[i]",
"- oacc[i + 1] = oacc[i]",
"- else:",
"- eacc[i + 1] = eacc[i]",
"- oacc[i + 1] = oacc[i] + A[i]",
"+ eacc[i + 1] = eacc[i] + (A[i] if i % 2 == 0 else 0)",
"- ans += oacc[N ... | false | 0.048229 | 0.048664 | 0.991064 | [
"s763797823",
"s649698996"
] |
u261646994 | p02953 | python | s724190465 | s975905554 | 211 | 60 | 14,252 | 14,252 | Accepted | Accepted | 71.56 | import sys
input = sys.stdin.readline
N = int(eval(input()))
H = [int(item) for item in input().split()]
cand = []
cand += [H[0], H[0] - 1]
for i in range(1, N):
new_cand = []
for c in cand:
if c <= H[i] - 1:
new_cand += [H[i], H[i] - 1]
elif c == H[i]:
ne... | import sys
input = sys.stdin.readline
N = int(eval(input()))
H = [int(item) for item in input().split()]
c_height = -1
for h in H:
if h - 1 >= c_height:
c_height = h - 1
elif h == c_height:
pass
else:
print("No")
break
else:
print("Yes")
| 21 | 17 | 448 | 298 | import sys
input = sys.stdin.readline
N = int(eval(input()))
H = [int(item) for item in input().split()]
cand = []
cand += [H[0], H[0] - 1]
for i in range(1, N):
new_cand = []
for c in cand:
if c <= H[i] - 1:
new_cand += [H[i], H[i] - 1]
elif c == H[i]:
new_cand += [H[i]... | import sys
input = sys.stdin.readline
N = int(eval(input()))
H = [int(item) for item in input().split()]
c_height = -1
for h in H:
if h - 1 >= c_height:
c_height = h - 1
elif h == c_height:
pass
else:
print("No")
break
else:
print("Yes")
| false | 19.047619 | [
"-cand = []",
"-cand += [H[0], H[0] - 1]",
"-for i in range(1, N):",
"- new_cand = []",
"- for c in cand:",
"- if c <= H[i] - 1:",
"- new_cand += [H[i], H[i] - 1]",
"- elif c == H[i]:",
"- new_cand += [H[i]]",
"- cand = list(set(new_cand))",
"- if ... | false | 0.037423 | 0.037098 | 1.008754 | [
"s724190465",
"s975905554"
] |
u517447467 | p03043 | python | s613430923 | s220945835 | 99 | 53 | 2,940 | 3,060 | Accepted | Accepted | 46.46 | import math
N, K = list(map(int, input().split()))
result = 0
for i in range(1, N+1):
result += (1/N) * 0.5 ** math.ceil(math.log(math.ceil(K/i), 2))
print(result) | import math
N, K = list(map(int, input().split()))
i = 1
result = 0
for i in range(1, N+1):
p = 0
while i * (2 ** p) < K:
p += 1
result += (1 /N) * (0.5 ** p)
print(result) | 6 | 12 | 170 | 195 | import math
N, K = list(map(int, input().split()))
result = 0
for i in range(1, N + 1):
result += (1 / N) * 0.5 ** math.ceil(math.log(math.ceil(K / i), 2))
print(result)
| import math
N, K = list(map(int, input().split()))
i = 1
result = 0
for i in range(1, N + 1):
p = 0
while i * (2**p) < K:
p += 1
result += (1 / N) * (0.5**p)
print(result)
| false | 50 | [
"+i = 1",
"- result += (1 / N) * 0.5 ** math.ceil(math.log(math.ceil(K / i), 2))",
"+ p = 0",
"+ while i * (2**p) < K:",
"+ p += 1",
"+ result += (1 / N) * (0.5**p)"
] | false | 0.114253 | 0.161064 | 0.709362 | [
"s613430923",
"s220945835"
] |
u325704929 | p02883 | python | s324950763 | s001390300 | 570 | 403 | 43,572 | 37,176 | Accepted | Accepted | 29.3 | import numpy as np
def is_ok(mid, k):
s = np.maximum(a - mid // f, 0).sum()
if s <= k:
return True
else:
return False
n, k = list(map(int, input().split()))
a = [int(i) for i in input().split()]
f = [int(i) for i in input().split()]
a.sort()
f.sort(reverse=True)
a = np.array(... | import numpy as np
def is_ok(mid, k):
s = np.maximum(a - mid // f, 0).sum()
if s <= k:
return True
else:
return False
n, k = list(map(int, input().split()))
a = np.array(list(map(int, input().split())))
f = np.array(list(map(int, input().split())))
a = np.sort(a)
f = np.sort(f... | 25 | 23 | 494 | 482 | import numpy as np
def is_ok(mid, k):
s = np.maximum(a - mid // f, 0).sum()
if s <= k:
return True
else:
return False
n, k = list(map(int, input().split()))
a = [int(i) for i in input().split()]
f = [int(i) for i in input().split()]
a.sort()
f.sort(reverse=True)
a = np.array(a)
f = np.ar... | import numpy as np
def is_ok(mid, k):
s = np.maximum(a - mid // f, 0).sum()
if s <= k:
return True
else:
return False
n, k = list(map(int, input().split()))
a = np.array(list(map(int, input().split())))
f = np.array(list(map(int, input().split())))
a = np.sort(a)
f = np.sort(f)[::-1]
l, ... | false | 8 | [
"-a = [int(i) for i in input().split()]",
"-f = [int(i) for i in input().split()]",
"-a.sort()",
"-f.sort(reverse=True)",
"-a = np.array(a)",
"-f = np.array(f)",
"+a = np.array(list(map(int, input().split())))",
"+f = np.array(list(map(int, input().split())))",
"+a = np.sort(a)",
"+f = np.sort(f)[... | false | 0.243782 | 0.694738 | 0.350898 | [
"s324950763",
"s001390300"
] |
u881590806 | p02275 | python | s889630123 | s268911390 | 2,170 | 1,530 | 177,024 | 241,092 | Accepted | Accepted | 29.49 | n = int(input())
S = list(map(int,input().strip().split(' ')))
def counting_sort(S,k):
C = [0]*(k+1)
B = [0]*len(S)
for v in S:
C[v] += 1
for i in range(1,k+1):
C[i] += C[i-1]
for i in range(len(S)):
B[C[S[i]]-1] = S[i]
C[S[i]] -= 1
return B
B = c... | def counting_sort(a,k):
C = []
for i in range(k):
C.append(0)
for ai in a:
C[ai] += 1
s = 0
for i in range(k):
s += C[i]
C[i] = s
b = []
for i in range(len(a)):
b.append(None)
p = 0
for i in range(k):
while p < C[i]:
... | 18 | 24 | 370 | 483 | n = int(input())
S = list(map(int, input().strip().split(" ")))
def counting_sort(S, k):
C = [0] * (k + 1)
B = [0] * len(S)
for v in S:
C[v] += 1
for i in range(1, k + 1):
C[i] += C[i - 1]
for i in range(len(S)):
B[C[S[i]] - 1] = S[i]
C[S[i]] -= 1
return B
B =... | def counting_sort(a, k):
C = []
for i in range(k):
C.append(0)
for ai in a:
C[ai] += 1
s = 0
for i in range(k):
s += C[i]
C[i] = s
b = []
for i in range(len(a)):
b.append(None)
p = 0
for i in range(k):
while p < C[i]:
b[p] =... | false | 25 | [
"-n = int(input())",
"-S = list(map(int, input().strip().split(\" \")))",
"+def counting_sort(a, k):",
"+ C = []",
"+ for i in range(k):",
"+ C.append(0)",
"+ for ai in a:",
"+ C[ai] += 1",
"+ s = 0",
"+ for i in range(k):",
"+ s += C[i]",
"+ C[i] = s... | false | 0.070626 | 0.082514 | 0.855932 | [
"s889630123",
"s268911390"
] |
u935558307 | p03356 | python | s534909413 | s348330343 | 715 | 582 | 105,168 | 72,404 | Accepted | Accepted | 18.6 | import sys
sys.setrecursionlimit(2000000)
input = sys.stdin.readline
class UnionFind():
def __init__(self,n):
self.n=n
self.parents = [i for i in range(n+1)]
self.size = [1]*(n+1)
def find(self,x):
if self.parents[x]==x:
return x
else:
... | import sys
sys.setrecursionlimit(2000000)
input = sys.stdin.readline
class UnionFind():
def __init__(self,n):
self.n=n
self.parents = [i for i in range(n+1)]
self.size = [1]*(n+1)
def find(self,x):
if self.parents[x]==x:
return x
else:
... | 63 | 67 | 1,461 | 1,565 | import sys
sys.setrecursionlimit(2000000)
input = sys.stdin.readline
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [i for i in range(n + 1)]
self.size = [1] * (n + 1)
def find(self, x):
if self.parents[x] == x:
return x
else:
... | import sys
sys.setrecursionlimit(2000000)
input = sys.stdin.readline
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [i for i in range(n + 1)]
self.size = [1] * (n + 1)
def find(self, x):
if self.parents[x] == x:
return x
else:
... | false | 5.970149 | [
"+tree = UnionFind(N)",
"-dic = {}",
"-dic2 = {}",
"-for i in range(1, N + 1):",
"- dic[P[i - 1]] = i",
"- dic2[i] = P[i - 1]",
"-tree = UnionFind(N)",
"-indexGroup = {}",
"+indeces = {}",
"+indeces2 = {}",
"+for i in range(N):",
"+ indeces[P[i]] = i + 1",
"+ indeces2[i + 1] = P[... | false | 0.040421 | 0.039051 | 1.035098 | [
"s534909413",
"s348330343"
] |
u073852194 | p03162 | python | s204629183 | s913558531 | 1,223 | 230 | 47,388 | 85,856 | Accepted | Accepted | 81.19 | n = int(eval(input()))
Act = [list(map(int,input().split())) for i in range(n)]
dp = [[0,0,0] for i in range(n)]
dp[0] = [Act[0][j] for j in range(3)]
for i in range(1,n):
for j in range(3):
s = 0
for k in range(3):
s = max(s,(dp[i-1][k]+Act[i][j])*int(j!=k))
dp[i][j] = s
print((max... | N = int(eval(input()))
dp = [[0, 0, 0] for _ in range(N + 1)]
for i in range(1, N + 1):
a = tuple(map(int, input().split()))
for j in range(3):
dp[i][j] = max(dp[i - 1][j - 1] + a[j], dp[i - 1][j - 2] + a[j])
print((max(dp[N]))) | 14 | 10 | 348 | 248 | n = int(eval(input()))
Act = [list(map(int, input().split())) for i in range(n)]
dp = [[0, 0, 0] for i in range(n)]
dp[0] = [Act[0][j] for j in range(3)]
for i in range(1, n):
for j in range(3):
s = 0
for k in range(3):
s = max(s, (dp[i - 1][k] + Act[i][j]) * int(j != k))
dp[i][j... | N = int(eval(input()))
dp = [[0, 0, 0] for _ in range(N + 1)]
for i in range(1, N + 1):
a = tuple(map(int, input().split()))
for j in range(3):
dp[i][j] = max(dp[i - 1][j - 1] + a[j], dp[i - 1][j - 2] + a[j])
print((max(dp[N])))
| false | 28.571429 | [
"-n = int(eval(input()))",
"-Act = [list(map(int, input().split())) for i in range(n)]",
"-dp = [[0, 0, 0] for i in range(n)]",
"-dp[0] = [Act[0][j] for j in range(3)]",
"-for i in range(1, n):",
"+N = int(eval(input()))",
"+dp = [[0, 0, 0] for _ in range(N + 1)]",
"+for i in range(1, N + 1):",
"+ ... | false | 0.041083 | 0.03846 | 1.06821 | [
"s204629183",
"s913558531"
] |
u737758066 | p02993 | python | s065667681 | s716202394 | 182 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.66 | s = eval(input())
t = s[0]
for i in range(1, len(s)):
if s[i] == t:
print('Bad')
exit()
t = s[i]
print('Good')
| s = eval(input())
t = s[0]
for i in range(1, 4):
if t == s[i]:
print('Bad')
exit(0)
t = s[i]
print('Good') | 9 | 9 | 138 | 133 | s = eval(input())
t = s[0]
for i in range(1, len(s)):
if s[i] == t:
print("Bad")
exit()
t = s[i]
print("Good")
| s = eval(input())
t = s[0]
for i in range(1, 4):
if t == s[i]:
print("Bad")
exit(0)
t = s[i]
print("Good")
| false | 0 | [
"-for i in range(1, len(s)):",
"- if s[i] == t:",
"+for i in range(1, 4):",
"+ if t == s[i]:",
"- exit()",
"+ exit(0)"
] | false | 0.047181 | 0.046787 | 1.008423 | [
"s065667681",
"s716202394"
] |
u248424983 | p02413 | python | s386128404 | s594301347 | 30 | 20 | 8,332 | 8,216 | Accepted | Accepted | 33.33 | r,c = list(map(int,input().split()))
rc = list([int(x) for x in input().split()] for _ in range(r))
[rc[i].append(sum(rc[i])) for i in range(r)]
rc.append([sum(i) for i in zip(*rc)])
for col in rc: print((*col)) | r,c = list(map(int,input().split()))
rc=[]
total=[]
for _ in range(r): rc.append(list(map(int,input().split())))
for i in range(r): rc[i].append(sum(rc[i]))
for i in zip(*rc): total.append(sum(i))
rc.append(total)
for col in rc: print((*col)) | 6 | 8 | 209 | 241 | r, c = list(map(int, input().split()))
rc = list([int(x) for x in input().split()] for _ in range(r))
[rc[i].append(sum(rc[i])) for i in range(r)]
rc.append([sum(i) for i in zip(*rc)])
for col in rc:
print((*col))
| r, c = list(map(int, input().split()))
rc = []
total = []
for _ in range(r):
rc.append(list(map(int, input().split())))
for i in range(r):
rc[i].append(sum(rc[i]))
for i in zip(*rc):
total.append(sum(i))
rc.append(total)
for col in rc:
print((*col))
| false | 25 | [
"-rc = list([int(x) for x in input().split()] for _ in range(r))",
"-[rc[i].append(sum(rc[i])) for i in range(r)]",
"-rc.append([sum(i) for i in zip(*rc)])",
"+rc = []",
"+total = []",
"+for _ in range(r):",
"+ rc.append(list(map(int, input().split())))",
"+for i in range(r):",
"+ rc[i].append... | false | 0.049338 | 0.007993 | 6.172814 | [
"s386128404",
"s594301347"
] |
u867848444 | p03645 | python | s664651112 | s005355102 | 1,081 | 968 | 106,916 | 66,840 | Accepted | Accepted | 10.45 | 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, m = list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(m)]
G = Graph(ab)
for v in G[0]:
if n in... | #グラフの連結成分を調べる
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, m = list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(m)]
G = Graph(ab)
for new_v in G[0]:
if n in G[new_v - 1]:
print... | 18 | 16 | 388 | 363 | 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, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]
G = Graph(ab)
for v in G[0]:
if n in G[... | # グラフの連結成分を調べる
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, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]
G = Graph(ab)
for new_v in G[0]:
if n in G[new_v - 1]:
print("... | false | 11.111111 | [
"-from collections import deque",
"-",
"-for v in G[0]:",
"- if n in G[v - 1]:",
"+for new_v in G[0]:",
"+ if n in G[new_v - 1]:"
] | false | 0.076004 | 0.082513 | 0.921114 | [
"s664651112",
"s005355102"
] |
u981931040 | p03417 | python | s988088515 | s295969576 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | N , M = list(map(int,input().split()))
if N == 1 and M == 1:
print("1")
elif N == 1:
print((M - 2))
elif M == 1:
print((N - 2))
else:
print(((N - 2) * (M - 2))) | N, M = list(map(int, input().split()))
if N == M == 1:
print("1")
elif N == 1:
print((max(0, M - 2)))
elif M == 1:
print((max(0, N - 2)))
else:
print((max(N * M - (N - 1) * 2 - (M - 1) * 2, 0))) | 9 | 9 | 172 | 206 | N, M = list(map(int, input().split()))
if N == 1 and M == 1:
print("1")
elif N == 1:
print((M - 2))
elif M == 1:
print((N - 2))
else:
print(((N - 2) * (M - 2)))
| N, M = list(map(int, input().split()))
if N == M == 1:
print("1")
elif N == 1:
print((max(0, M - 2)))
elif M == 1:
print((max(0, N - 2)))
else:
print((max(N * M - (N - 1) * 2 - (M - 1) * 2, 0)))
| false | 0 | [
"-if N == 1 and M == 1:",
"+if N == M == 1:",
"- print((M - 2))",
"+ print((max(0, M - 2)))",
"- print((N - 2))",
"+ print((max(0, N - 2)))",
"- print(((N - 2) * (M - 2)))",
"+ print((max(N * M - (N - 1) * 2 - (M - 1) * 2, 0)))"
] | false | 0.172097 | 0.044211 | 3.892613 | [
"s988088515",
"s295969576"
] |
u588794534 | p02724 | python | s380823577 | s414342089 | 186 | 165 | 38,256 | 38,384 | Accepted | Accepted | 11.29 | x=int(eval(input()))
result=x//500*1000+x%500//5*5
print(result) | a=int(eval(input()))
cnt=(a//500)*1000
cnt+=((a%500)//5)*5
print(cnt)
| 4 | 6 | 62 | 71 | x = int(eval(input()))
result = x // 500 * 1000 + x % 500 // 5 * 5
print(result)
| a = int(eval(input()))
cnt = (a // 500) * 1000
cnt += ((a % 500) // 5) * 5
print(cnt)
| false | 33.333333 | [
"-x = int(eval(input()))",
"-result = x // 500 * 1000 + x % 500 // 5 * 5",
"-print(result)",
"+a = int(eval(input()))",
"+cnt = (a // 500) * 1000",
"+cnt += ((a % 500) // 5) * 5",
"+print(cnt)"
] | false | 0.041349 | 0.041427 | 0.998102 | [
"s380823577",
"s414342089"
] |
u775421443 | p02588 | python | s791010784 | s561556062 | 351 | 205 | 26,008 | 9,492 | Accepted | Accepted | 41.6 | from collections import defaultdict
def conv(s):
if "." not in s:
s += '.'
s = s.rstrip('0')
t = len(s) - s.find('.') - 1
a = int(s.replace('.', ''))
if a == 0:
return (0, 0)
x, y = -t, -t
while a % 5 == 0:
x += 1
a //= 5
y += len(bin(a&-a))... | import sys
from collections import defaultdict
from math import gcd
def input(): return sys.stdin.readline().strip()
K = 10**9
L = 10**18
D = defaultdict(int)
for _ in range(int(eval(input()))):
D[gcd(round(float(eval(input())) * K), L)] += 1
D = tuple(D.items())
ans = 0
for i, (k1, v1) in enumerat... | 32 | 21 | 697 | 465 | from collections import defaultdict
def conv(s):
if "." not in s:
s += "."
s = s.rstrip("0")
t = len(s) - s.find(".") - 1
a = int(s.replace(".", ""))
if a == 0:
return (0, 0)
x, y = -t, -t
while a % 5 == 0:
x += 1
a //= 5
y += len(bin(a & -a)) - 3
re... | import sys
from collections import defaultdict
from math import gcd
def input():
return sys.stdin.readline().strip()
K = 10**9
L = 10**18
D = defaultdict(int)
for _ in range(int(eval(input()))):
D[gcd(round(float(eval(input())) * K), L)] += 1
D = tuple(D.items())
ans = 0
for i, (k1, v1) in enumerate(D):
... | false | 34.375 | [
"+import sys",
"+from math import gcd",
"-def conv(s):",
"- if \".\" not in s:",
"- s += \".\"",
"- s = s.rstrip(\"0\")",
"- t = len(s) - s.find(\".\") - 1",
"- a = int(s.replace(\".\", \"\"))",
"- if a == 0:",
"- return (0, 0)",
"- x, y = -t, -t",
"- while a... | false | 0.038024 | 0.045547 | 0.834836 | [
"s791010784",
"s561556062"
] |
u318345739 | p02683 | python | s256692190 | s928935675 | 108 | 83 | 73,724 | 74,024 | Accepted | Accepted | 23.15 | from itertools import combinations
def is_achievable(M, X, A):
result = [0] * M
for a_row in A:
for i, a in enumerate(a_row):
result[i] += a
for n in result:
if n < X:
return False
return True
def main():
N, M, X = list(map(int, input().split(... | from itertools import combinations
class Solver:
def __init__(self, N, M, X, C, A):
self.N = N
self.M = M
self.X = X
self.C = C
self.A = A
def is_achievable(self, A):
result = [0] * self.M
for a_row in A:
for i, a in enumerate(a_... | 43 | 53 | 982 | 1,272 | from itertools import combinations
def is_achievable(M, X, A):
result = [0] * M
for a_row in A:
for i, a in enumerate(a_row):
result[i] += a
for n in result:
if n < X:
return False
return True
def main():
N, M, X = list(map(int, input().split()))
C = [... | from itertools import combinations
class Solver:
def __init__(self, N, M, X, C, A):
self.N = N
self.M = M
self.X = X
self.C = C
self.A = A
def is_achievable(self, A):
result = [0] * self.M
for a_row in A:
for i, a in enumerate(a_row):
... | false | 18.867925 | [
"-def is_achievable(M, X, A):",
"- result = [0] * M",
"- for a_row in A:",
"- for i, a in enumerate(a_row):",
"- result[i] += a",
"- for n in result:",
"- if n < X:",
"- return False",
"- return True",
"+class Solver:",
"+ def __init__(self, N, ... | false | 0.0384 | 0.039761 | 0.965766 | [
"s256692190",
"s928935675"
] |
u606045429 | p03274 | python | s692924921 | s796007741 | 93 | 63 | 14,224 | 14,388 | Accepted | Accepted | 32.26 | N, K = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
mi = 1e10
for l in range(N - K + 1):
r = l + K - 1
mi = min(mi, abs(X[l]) + abs(X[r] - X[l]), abs(X[r]) + abs(X[r] - X[l]))
print(mi) | N, K = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
print((min(r - l + min(abs(l), abs(r)) for l, r in zip(X, X[K - 1:]))))
| 8 | 4 | 228 | 153 | N, K = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
mi = 1e10
for l in range(N - K + 1):
r = l + K - 1
mi = min(mi, abs(X[l]) + abs(X[r] - X[l]), abs(X[r]) + abs(X[r] - X[l]))
print(mi)
| N, K = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
print((min(r - l + min(abs(l), abs(r)) for l, r in zip(X, X[K - 1 :]))))
| false | 50 | [
"-mi = 1e10",
"-for l in range(N - K + 1):",
"- r = l + K - 1",
"- mi = min(mi, abs(X[l]) + abs(X[r] - X[l]), abs(X[r]) + abs(X[r] - X[l]))",
"-print(mi)",
"+print((min(r - l + min(abs(l), abs(r)) for l, r in zip(X, X[K - 1 :]))))"
] | false | 0.084706 | 0.085376 | 0.992153 | [
"s692924921",
"s796007741"
] |
u596276291 | p02861 | python | s013559681 | s459917354 | 340 | 217 | 4,456 | 9,952 | Accepted | Accepted | 36.18 | #!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_c... | #!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_c... | 64 | 70 | 1,422 | 1,460 | #!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
im... | #!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
im... | false | 8.571429 | [
"-sys.setrecursionlimit(10000)",
"+sys.setrecursionlimit(500000)",
"+def calc(p, P):",
"+ ans = 0",
"+ for i in range(1, len(p)):",
"+ x1, y1 = P[p[i - 1]]",
"+ x2, y2 = P[p[i]]",
"+ ans += sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)",
"+ return ans",
"+",
"+",
"- re... | false | 0.047762 | 0.0909 | 0.525429 | [
"s013559681",
"s459917354"
] |
u256464928 | p03761 | python | s600656765 | s754337961 | 25 | 18 | 3,828 | 3,064 | Accepted | Accepted | 28 | N = int(input())
S = [input() for _ in range(N)]
import string
letters=string.ascii_lowercase
dic = {}
def alpha(N,dic):
for i in letters:
dic[i] = [0] * N
alpha(N,dic)
for i in range(N):
for j in range(len(S[i])):
dic[S[i][j]][i] += 1
#print(dic)
ans = []
for i in letters:
ans.append(... | N = int(input())
S = [input() for _ in range(N)]
dic = {}
X = sorted(list(set(S[0])))
for i in X:
dic[i] = 51
for i in range(N):
for x in X:
dic[x] = min(dic[x],S[i].count(x))
for i in X:
print(i * dic[i],end="")
| 19 | 11 | 356 | 232 | N = int(input())
S = [input() for _ in range(N)]
import string
letters = string.ascii_lowercase
dic = {}
def alpha(N, dic):
for i in letters:
dic[i] = [0] * N
alpha(N, dic)
for i in range(N):
for j in range(len(S[i])):
dic[S[i][j]][i] += 1
# print(dic)
ans = []
for i in letters:
ans.app... | N = int(input())
S = [input() for _ in range(N)]
dic = {}
X = sorted(list(set(S[0])))
for i in X:
dic[i] = 51
for i in range(N):
for x in X:
dic[x] = min(dic[x], S[i].count(x))
for i in X:
print(i * dic[i], end="")
| false | 42.105263 | [
"-import string",
"-",
"-letters = string.ascii_lowercase",
"-",
"-",
"-def alpha(N, dic):",
"- for i in letters:",
"- dic[i] = [0] * N",
"-",
"-",
"-alpha(N, dic)",
"+X = sorted(list(set(S[0])))",
"+for i in X:",
"+ dic[i] = 51",
"- for j in range(len(S[i])):",
"- ... | false | 0.043027 | 0.036589 | 1.175969 | [
"s600656765",
"s754337961"
] |
u867069435 | p03470 | python | s727883972 | s464940625 | 19 | 17 | 3,316 | 3,064 | Accepted | Accepted | 10.53 | n = int(eval(input()))
k = []
for i in range(n):
k.append(int(eval(input())))
print((len(set(k)))) | n = int(eval(input()))
print((len(set(map(int, [eval(input()) for i in range(n)]))))) | 5 | 2 | 92 | 72 | n = int(eval(input()))
k = []
for i in range(n):
k.append(int(eval(input())))
print((len(set(k))))
| n = int(eval(input()))
print((len(set(map(int, [eval(input()) for i in range(n)])))))
| false | 60 | [
"-k = []",
"-for i in range(n):",
"- k.append(int(eval(input())))",
"-print((len(set(k))))",
"+print((len(set(map(int, [eval(input()) for i in range(n)])))))"
] | false | 0.042118 | 0.039892 | 1.0558 | [
"s727883972",
"s464940625"
] |
u910830417 | p02995 | python | s821542877 | s902413280 | 54 | 38 | 5,816 | 5,048 | Accepted | Accepted | 29.63 | import fractions
a, b, c, d = list(map(int, input().split()))
def wareruzu(x):
if b < x:
return 0
if b == x:
return 1
start_a = a if a % x == 0 else a - (a % x) + x
end_b = b - (b % x) # bより小さい最大の値。
m = end_b - start_a
if m < 0:
return 0
return int(m //... | import fractions
a, b, c, d = list(map(int, input().split()))
def wareruzu(x):
if b < x:
return 0
if b == x:
return 1
start_a = a if a % x == 0 else a - (a % x) + x
end_b = b - (b % x) # bより小さい最大の値。
m = end_b - start_a
return m // x + 1
all_n = b - a + 1
print((... | 17 | 15 | 425 | 387 | import fractions
a, b, c, d = list(map(int, input().split()))
def wareruzu(x):
if b < x:
return 0
if b == x:
return 1
start_a = a if a % x == 0 else a - (a % x) + x
end_b = b - (b % x) # bより小さい最大の値。
m = end_b - start_a
if m < 0:
return 0
return int(m // x) + 1
a... | import fractions
a, b, c, d = list(map(int, input().split()))
def wareruzu(x):
if b < x:
return 0
if b == x:
return 1
start_a = a if a % x == 0 else a - (a % x) + x
end_b = b - (b % x) # bより小さい最大の値。
m = end_b - start_a
return m // x + 1
all_n = b - a + 1
print((all_n - ware... | false | 11.764706 | [
"- if m < 0:",
"- return 0",
"- return int(m // x) + 1",
"+ return m // x + 1"
] | false | 0.0526 | 0.05602 | 0.93895 | [
"s821542877",
"s902413280"
] |
u405256066 | p03194 | python | s191701473 | s293901064 | 290 | 206 | 40,300 | 40,300 | Accepted | Accepted | 28.97 | import math
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(list(range(round(math.pow(P,(1/N)))+1))):
tmp=math.pow(i,N)
if P==1:
ans=1
break
if N==1:
ans=P
break
if P%tmp==0:
ans=i
break
print(a... | import math
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
po=math.pow(P,(1/N))
for i in reversed(list(range(int(round(po,0))+1))):
tmp=math.pow(i,N)
if P==1:
ans=1
break
if N==1:
ans=P
break
if P%tmp==0:
ans=i
... | 15 | 16 | 317 | 331 | import math
from sys import stdin
N, P = [int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(list(range(round(math.pow(P, (1 / N))) + 1))):
tmp = math.pow(i, N)
if P == 1:
ans = 1
break
if N == 1:
ans = P
break
if P % tmp == 0:
ans = i
b... | import math
from sys import stdin
N, P = [int(x) for x in stdin.readline().rstrip().split()]
po = math.pow(P, (1 / N))
for i in reversed(list(range(int(round(po, 0)) + 1))):
tmp = math.pow(i, N)
if P == 1:
ans = 1
break
if N == 1:
ans = P
break
if P % tmp == 0:
a... | false | 6.25 | [
"-for i in reversed(list(range(round(math.pow(P, (1 / N))) + 1))):",
"+po = math.pow(P, (1 / N))",
"+for i in reversed(list(range(int(round(po, 0)) + 1))):"
] | false | 0.035864 | 0.038034 | 0.942932 | [
"s191701473",
"s293901064"
] |
u077291787 | p03262 | python | s940256091 | s429895127 | 71 | 52 | 14,224 | 14,052 | Accepted | Accepted | 26.76 | # ABC109C - Skip
def gcd(a, b):
while a:
a, b = b % a, a
return b
n, x = list(map(int, input().rstrip().split()))
lst = list(map(int, input().rstrip().split()))
d = abs(x - lst[0])
for i in range(n):
dif = abs(x - lst[i])
if dif % d == 0:
continue
d = gcd(d, d... | # ABC109C - Skip
def gcd(a: int, b: int) -> int:
while a:
a, b = b % a, a
return b
def main():
N, X, *A = list(map(int, open(0).read().split()))
ans = abs(X - A[0])
for i in A:
dif = abs(X - i)
if dif % ans:
ans = gcd(ans, dif)
print(ans)
... | 16 | 19 | 333 | 352 | # ABC109C - Skip
def gcd(a, b):
while a:
a, b = b % a, a
return b
n, x = list(map(int, input().rstrip().split()))
lst = list(map(int, input().rstrip().split()))
d = abs(x - lst[0])
for i in range(n):
dif = abs(x - lst[i])
if dif % d == 0:
continue
d = gcd(d, dif)
print(d)
| # ABC109C - Skip
def gcd(a: int, b: int) -> int:
while a:
a, b = b % a, a
return b
def main():
N, X, *A = list(map(int, open(0).read().split()))
ans = abs(X - A[0])
for i in A:
dif = abs(X - i)
if dif % ans:
ans = gcd(ans, dif)
print(ans)
if __name__ == "_... | false | 15.789474 | [
"-def gcd(a, b):",
"+def gcd(a: int, b: int) -> int:",
"-n, x = list(map(int, input().rstrip().split()))",
"-lst = list(map(int, input().rstrip().split()))",
"-d = abs(x - lst[0])",
"-for i in range(n):",
"- dif = abs(x - lst[i])",
"- if dif % d == 0:",
"- continue",
"- d = gcd(d, ... | false | 0.079923 | 0.077781 | 1.027541 | [
"s940256091",
"s429895127"
] |
u018679195 | p03860 | python | s251711238 | s894088350 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | ls=input().split()
Ls=[]
def fun():
print('111')
print('222')
print('333')
print('ii')
for i in ls:
Ls.append(i[0])
print((''.join(Ls))) | def suma(a,b):
return a+b
def multi(a,b):
return a*b
def division(a,b):
if a>0:
division=a/b
else:
division="No se puede dividir"
return division
s=eval(input())
letra=s[8]
print(("A{}C".format(letra))) | 10 | 13 | 168 | 224 | ls = input().split()
Ls = []
def fun():
print("111")
print("222")
print("333")
print("ii")
for i in ls:
Ls.append(i[0])
print(("".join(Ls)))
| def suma(a, b):
return a + b
def multi(a, b):
return a * b
def division(a, b):
if a > 0:
division = a / b
else:
division = "No se puede dividir"
return division
s = eval(input())
letra = s[8]
print(("A{}C".format(letra)))
| false | 23.076923 | [
"-ls = input().split()",
"-Ls = []",
"+def suma(a, b):",
"+ return a + b",
"-def fun():",
"- print(\"111\")",
"- print(\"222\")",
"- print(\"333\")",
"- print(\"ii\")",
"+def multi(a, b):",
"+ return a * b",
"-for i in ls:",
"- Ls.append(i[0])",
"-print((\"\".join(Ls))... | false | 0.039399 | 0.038349 | 1.027367 | [
"s251711238",
"s894088350"
] |
u391589398 | p02585 | python | s431747932 | s175641683 | 981 | 636 | 298,592 | 79,916 | Accepted | Accepted | 35.17 | n, k = list(map(int, input().split()))
P = tuple([int(x)-1 for x in input().split()])
C = tuple(map(int, input().split()))
CC = [[] for _ in range(n)]
for idx, p in enumerate(P):
CC[idx].append(C[p])
pp = P[p]
for _ in range(n):
CC[idx].append(C[pp])
pp = P[pp]
if pp == p:
... | n, k = list(map(int, input().split()))
P = tuple([int(x)-1 for x in input().split()])
C = tuple(map(int, input().split()))
from collections import deque
ans = -2*10**9
for idx, root in enumerate(P):
scores = [C[root]]
p = P[root]
while True:
scores.append(scores[-1] + C[p])
p = P[p... | 31 | 27 | 847 | 744 | n, k = list(map(int, input().split()))
P = tuple([int(x) - 1 for x in input().split()])
C = tuple(map(int, input().split()))
CC = [[] for _ in range(n)]
for idx, p in enumerate(P):
CC[idx].append(C[p])
pp = P[p]
for _ in range(n):
CC[idx].append(C[pp])
pp = P[pp]
if pp == p:
... | n, k = list(map(int, input().split()))
P = tuple([int(x) - 1 for x in input().split()])
C = tuple(map(int, input().split()))
from collections import deque
ans = -2 * 10**9
for idx, root in enumerate(P):
scores = [C[root]]
p = P[root]
while True:
scores.append(scores[-1] + C[p])
p = P[p]
... | false | 12.903226 | [
"-CC = [[] for _ in range(n)]",
"-for idx, p in enumerate(P):",
"- CC[idx].append(C[p])",
"- pp = P[p]",
"- for _ in range(n):",
"- CC[idx].append(C[pp])",
"- pp = P[pp]",
"- if pp == p:",
"+from collections import deque",
"+",
"+ans = -2 * 10**9",
"+for idx, root... | false | 0.045005 | 0.045364 | 0.992078 | [
"s431747932",
"s175641683"
] |
u520276780 | p03031 | python | s691545676 | s419517031 | 202 | 46 | 40,816 | 3,064 | Accepted | Accepted | 77.23 | """
n,m<=10
"""
n,m = list(map(int, input().split( )))
s = []
for i in range(m):
sij = list(map(int, input().split( )))
s.append(sij[1:])
p = list(map(int, input().split( )))
ans = 0
for i in range(2**n):
flag = True
for k in range(m):
tst = 0
for sm in s[k]:
... | n,m = list(map(int, input().split( )))
sw = [0 for _ in range(m)]#でんきゅがつながってるスイッチ
for i in range(m):
s = list(map(int, input().split( )))
s = [si-1 for si in s[1:]]
bt = 0
for sj in s:#電球
bt += 1<<sj
sw[i] = bt
p = list(map(int, input().split( )))
#スイッチ
bit = 1<<n
ans = 0... | 28 | 27 | 457 | 580 | """
n,m<=10
"""
n, m = list(map(int, input().split()))
s = []
for i in range(m):
sij = list(map(int, input().split()))
s.append(sij[1:])
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
flag = True
for k in range(m):
tst = 0
for sm in s[k]:
tst ^= i >> (sm - ... | n, m = list(map(int, input().split()))
sw = [0 for _ in range(m)] # でんきゅがつながってるスイッチ
for i in range(m):
s = list(map(int, input().split()))
s = [si - 1 for si in s[1:]]
bt = 0
for sj in s: # 電球
bt += 1 << sj
sw[i] = bt
p = list(map(int, input().split()))
# スイッチ
bit = 1 << n
ans = 0
for i in... | false | 3.571429 | [
"-\"\"\"",
"-n,m<=10",
"-\"\"\"",
"-s = []",
"+sw = [0 for _ in range(m)] # でんきゅがつながってるスイッチ",
"- sij = list(map(int, input().split()))",
"- s.append(sij[1:])",
"+ s = list(map(int, input().split()))",
"+ s = [si - 1 for si in s[1:]]",
"+ bt = 0",
"+ for sj in s: # 電球",
"+ ... | false | 0.057273 | 0.060535 | 0.946106 | [
"s691545676",
"s419517031"
] |
u046158516 | p03999 | python | s593776868 | s391975212 | 178 | 91 | 38,256 | 73,936 | Accepted | Accepted | 48.88 | def convert(s):
# initialization of string to ""
new = ""
# traverse in the string
for x in s:
new += x
# return string
return new
n=eval(input())
ans=0
for i in range(len(n)):
for j in range(len(n)-i):
if j==len(n)-i-1:
ans+=int(n[i])*(2**... | def base10toN(num, base):
converted_string, modstring = "", ""
currentnum = num
if not num:
return '0'
while currentnum:
mod = currentnum % base
currentnum = currentnum // base
converted_string = chr(48 + mod + 7*(mod > 10)) + converted_string
return converte... | 20 | 31 | 406 | 712 | def convert(s):
# initialization of string to ""
new = ""
# traverse in the string
for x in s:
new += x
# return string
return new
n = eval(input())
ans = 0
for i in range(len(n)):
for j in range(len(n) - i):
if j == len(n) - i - 1:
ans += int(n[i]) * (2 ** (len... | def base10toN(num, base):
converted_string, modstring = "", ""
currentnum = num
if not num:
return "0"
while currentnum:
mod = currentnum % base
currentnum = currentnum // base
converted_string = chr(48 + mod + 7 * (mod > 10)) + converted_string
return converted_strin... | false | 35.483871 | [
"-def convert(s):",
"- # initialization of string to \"\"",
"- new = \"\"",
"- # traverse in the string",
"- for x in s:",
"- new += x",
"- # return string",
"- return new",
"+def base10toN(num, base):",
"+ converted_string, modstring = \"\", \"\"",
"+ currentnum =... | false | 0.037983 | 0.066768 | 0.568883 | [
"s593776868",
"s391975212"
] |
u223663729 | p02787 | python | s515969223 | s291068316 | 340 | 120 | 42,220 | 71,800 | Accepted | Accepted | 64.71 | # AtCoder Beginner Contest 153
# E - Crested Ibis vs Monster
# https://atcoder.jp/contests/abc153/tasks/abc153_e
H, N, *A = list(map(int, open(0).read().split()))
*A, = list(zip(*[iter(A)]*2))
INF = 1 << 30
dp = [INF]*(H+1)
dp[0] = 0
for i, (a, b) in enumerate(A):
for h in range(H+1):
mh = min(H... | import sys
input = sys.stdin.buffer.readline
H, N = list(map(int, input().split()))
A = [tuple(map(int, line.split())) for line in sys.stdin.buffer.readlines()]
INF = 1 << 30
dp = [INF]*(H+1)
dp[H] = 0
for i in range(N):
a, b = A[i]
for h in range(H, -1, -1):
x = h-a if h-a > 0 else 0
... | 14 | 14 | 370 | 378 | # AtCoder Beginner Contest 153
# E - Crested Ibis vs Monster
# https://atcoder.jp/contests/abc153/tasks/abc153_e
H, N, *A = list(map(int, open(0).read().split()))
(*A,) = list(zip(*[iter(A)] * 2))
INF = 1 << 30
dp = [INF] * (H + 1)
dp[0] = 0
for i, (a, b) in enumerate(A):
for h in range(H + 1):
mh = min(H, ... | import sys
input = sys.stdin.buffer.readline
H, N = list(map(int, input().split()))
A = [tuple(map(int, line.split())) for line in sys.stdin.buffer.readlines()]
INF = 1 << 30
dp = [INF] * (H + 1)
dp[H] = 0
for i in range(N):
a, b = A[i]
for h in range(H, -1, -1):
x = h - a if h - a > 0 else 0
i... | false | 0 | [
"-# AtCoder Beginner Contest 153",
"-# E - Crested Ibis vs Monster",
"-# https://atcoder.jp/contests/abc153/tasks/abc153_e",
"-H, N, *A = list(map(int, open(0).read().split()))",
"-(*A,) = list(zip(*[iter(A)] * 2))",
"+import sys",
"+",
"+input = sys.stdin.buffer.readline",
"+H, N = list(map(int, in... | false | 0.174622 | 0.088813 | 1.96617 | [
"s515969223",
"s291068316"
] |
u403301154 | p03073 | python | s146485295 | s104978216 | 83 | 51 | 3,188 | 3,188 | Accepted | Accepted | 38.55 | s = eval(input())
ans1 = 0
ans2 = 0
for i in range(len(s)):
if i%2==0 and s[i]=="0":
ans1 += 1
if i%2==1 and s[i]=="1":
ans1 += 1
if i%2==0 and s[i]=="1":
ans2 += 1
if i%2==1 and s[i]=="0":
ans2 += 1
print((min(ans1, ans2))) | s = eval(input())
ans1, ans2 = 0, 0
for i, e in enumerate(s):
if i%2:
if e=="0":
ans1 += 1
if e=="1":
ans2 += 1
else:
if e=="1":
ans1 += 1
if e=="0":
ans2 += 1
print((min(ans1, ans2))) | 16 | 14 | 258 | 233 | s = eval(input())
ans1 = 0
ans2 = 0
for i in range(len(s)):
if i % 2 == 0 and s[i] == "0":
ans1 += 1
if i % 2 == 1 and s[i] == "1":
ans1 += 1
if i % 2 == 0 and s[i] == "1":
ans2 += 1
if i % 2 == 1 and s[i] == "0":
ans2 += 1
print((min(ans1, ans2)))
| s = eval(input())
ans1, ans2 = 0, 0
for i, e in enumerate(s):
if i % 2:
if e == "0":
ans1 += 1
if e == "1":
ans2 += 1
else:
if e == "1":
ans1 += 1
if e == "0":
ans2 += 1
print((min(ans1, ans2)))
| false | 12.5 | [
"-ans1 = 0",
"-ans2 = 0",
"-for i in range(len(s)):",
"- if i % 2 == 0 and s[i] == \"0\":",
"- ans1 += 1",
"- if i % 2 == 1 and s[i] == \"1\":",
"- ans1 += 1",
"- if i % 2 == 0 and s[i] == \"1\":",
"- ans2 += 1",
"- if i % 2 == 1 and s[i] == \"0\":",
"- an... | false | 0.036925 | 0.081043 | 0.455621 | [
"s146485295",
"s104978216"
] |
u537976628 | p03624 | python | s340623729 | s448600708 | 45 | 24 | 9,148 | 9,068 | Accepted | Accepted | 46.67 | s = eval(input())
bkt = [0 for _ in range(26)]
for i in range(len(s)):
bkt[ord(s[i])-97] = 1
print(('None' if sum(bkt) == 26 else chr(bkt.index(0) + 97))) | S = set(eval(input()))
for i in range(97, 123):
c = chr(i)
if c not in S:
print(c)
exit()
print('None') | 5 | 7 | 154 | 127 | s = eval(input())
bkt = [0 for _ in range(26)]
for i in range(len(s)):
bkt[ord(s[i]) - 97] = 1
print(("None" if sum(bkt) == 26 else chr(bkt.index(0) + 97)))
| S = set(eval(input()))
for i in range(97, 123):
c = chr(i)
if c not in S:
print(c)
exit()
print("None")
| false | 28.571429 | [
"-s = eval(input())",
"-bkt = [0 for _ in range(26)]",
"-for i in range(len(s)):",
"- bkt[ord(s[i]) - 97] = 1",
"-print((\"None\" if sum(bkt) == 26 else chr(bkt.index(0) + 97)))",
"+S = set(eval(input()))",
"+for i in range(97, 123):",
"+ c = chr(i)",
"+ if c not in S:",
"+ print(c... | false | 0.038634 | 0.039519 | 0.977597 | [
"s340623729",
"s448600708"
] |
u969190727 | p02794 | python | s086710241 | s524545335 | 565 | 447 | 42,732 | 49,384 | Accepted | Accepted | 20.88 | import sys
input=sys.stdin.readline
n=int(eval(input()))
Edge=[[] for i in range(n)]
for i in range(n-1):
a,b=list(map(int,input().split()))
Edge[a-1].append((b-1,i))
Edge[b-1].append((a-1,i))
m=int(eval(input()))
M=[]
for i in range(m):
M.append(tuple(map(int,input().split())))
inf=float("inf")
... | import sys
input=sys.stdin.readline
n=int(eval(input()))
Edge=[[] for i in range(n)]
for i in range(n-1):
a,b=list(map(int,input().split()))
Edge[a-1].append((b-1,i))
Edge[b-1].append((a-1,i))
m=int(eval(input()))
M=[]
for i in range(m):
M.append(tuple(map(int,input().split())))
inf=float("inf")
... | 50 | 48 | 1,165 | 1,132 | import sys
input = sys.stdin.readline
n = int(eval(input()))
Edge = [[] for i in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
Edge[a - 1].append((b - 1, i))
Edge[b - 1].append((a - 1, i))
m = int(eval(input()))
M = []
for i in range(m):
M.append(tuple(map(int, input().split()... | import sys
input = sys.stdin.readline
n = int(eval(input()))
Edge = [[] for i in range(n)]
for i in range(n - 1):
a, b = list(map(int, input().split()))
Edge[a - 1].append((b - 1, i))
Edge[b - 1].append((a - 1, i))
m = int(eval(input()))
M = []
for i in range(m):
M.append(tuple(map(int, input().split()... | false | 4 | [
"+Cond = [0] * (2**m)",
"- condition = 0",
"- for j in range(m):",
"- if i & (1 << j): # j番目の条件を満たす",
"- condition = condition | passing[j]",
"- cond_ct = popcount(condition) # iが表すMの部分集合の条件をすべて満たす場合にすべて白になる辺集合の要素数",
"+ Cond[i] = Cond[i ^ (i & (-i))] | passing[len(bin(i &... | false | 0.075824 | 0.042162 | 1.798399 | [
"s086710241",
"s524545335"
] |
u059210959 | p03378 | python | s497813587 | s969607043 | 163 | 40 | 13,420 | 10,648 | Accepted | Accepted | 75.46 | # encoding:utf-8
import copy
import numpy as np
import random
n,m,x = list(map(int,input().split()))
a = [int(i) for i in input().split()]
#migi
cost_r = 0
for i in range(x,n):
if i in a:
cost_r += 1
cost_l = 0
for i in range(x):
if i in a:
cost_l += 1
print((min(cos... | #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.de... | 23 | 35 | 326 | 638 | # encoding:utf-8
import copy
import numpy as np
import random
n, m, x = list(map(int, input().split()))
a = [int(i) for i in input().split()]
# migi
cost_r = 0
for i in range(x, n):
if i in a:
cost_r += 1
cost_l = 0
for i in range(x):
if i in a:
cost_l += 1
print((min(cost_l, cost_r)))
| #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect # bisect_left これで二部探索の大小検索が行える
import fractions # 最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9 + 7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.deque()
... | false | 34.285714 | [
"+#!/usr/bin/env python3",
"-import numpy as np",
"+import bisect # bisect_left これで二部探索の大小検索が行える",
"+import fractions # 最小公倍数などはこっち",
"+import math",
"+import sys",
"+import collections",
"+from decimal import Decimal # 10進数で考慮できる",
"-n, m, x = list(map(int, input().split()))",
"-a = [int(i) fo... | false | 0.039645 | 0.1063 | 0.372958 | [
"s497813587",
"s969607043"
] |
u968166680 | p03033 | python | s984475021 | s819435087 | 1,244 | 792 | 136,036 | 66,000 | Accepted | Accepted | 36.33 | import sys
from heapq import heappush, heappop
from operator import itemgetter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, Q = map(int, readline().split())
work = [0] * N
fo... | import sys
from heapq import heappush, heappop
from operator import itemgetter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, Q = map(int, readline().split())
work = [0] * N
fo... | 41 | 42 | 925 | 927 | import sys
from heapq import heappush, heappop
from operator import itemgetter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, Q = map(int, readline().split())
work = [0] * N
for i in range(N):
... | import sys
from heapq import heappush, heappop
from operator import itemgetter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, Q = map(int, readline().split())
work = [0] * N
for i in range(N):
... | false | 2.380952 | [
"- work.sort(key=itemgetter(1), reverse=True)",
"+ work.sort(key=itemgetter(1))",
"+ idx = 0",
"- while work and work[-1][1] <= d:",
"- heappush(hq, work[-1])",
"- work.pop()",
"+ while idx < N and work[idx][1] <= d:",
"+ heappush(hq, work[idx])"... | false | 0.043574 | 0.045845 | 0.950469 | [
"s984475021",
"s819435087"
] |
u011621222 | p00481 | python | s999248880 | s063866022 | 17,950 | 14,580 | 36,504 | 87,232 | Accepted | Accepted | 18.77 | h,w,n = list(map(int, input().split()))
stage = [eval(input()) for i in range(h)]
starts = [str(i) for i in range(n)]
goals = [str(i+1) for i in range(n)]
starts_y = [0 for i in range(n)]
starts_x = [0 for i in range(n)]
goals_y = [0 for i in range(n)]
goals_x = [0 for i in range(n)]
starts[0] = "S"
for y in... | from collections import deque
h, w, n = list(map(int, input().split()))
g = ['0'] * h
sx, sy = -1, -1
pos = -1
for i in range(h):
g[i] = eval(input())
if pos == -1:
pos = g[i].find('S')
if pos != -1:
sx = i
sy = pos
book = set()
queue = deque()
ans =... | 52 | 50 | 1,627 | 1,022 | h, w, n = list(map(int, input().split()))
stage = [eval(input()) for i in range(h)]
starts = [str(i) for i in range(n)]
goals = [str(i + 1) for i in range(n)]
starts_y = [0 for i in range(n)]
starts_x = [0 for i in range(n)]
goals_y = [0 for i in range(n)]
goals_x = [0 for i in range(n)]
starts[0] = "S"
for y in range(... | from collections import deque
h, w, n = list(map(int, input().split()))
g = ["0"] * h
sx, sy = -1, -1
pos = -1
for i in range(h):
g[i] = eval(input())
if pos == -1:
pos = g[i].find("S")
if pos != -1:
sx = i
sy = pos
book = set()
queue = deque()
ans = 0
Next = [[-1, 0], [... | false | 3.846154 | [
"+from collections import deque",
"+",
"-stage = [eval(input()) for i in range(h)]",
"-starts = [str(i) for i in range(n)]",
"-goals = [str(i + 1) for i in range(n)]",
"-starts_y = [0 for i in range(n)]",
"-starts_x = [0 for i in range(n)]",
"-goals_y = [0 for i in range(n)]",
"-goals_x = [0 for i i... | false | 0.091105 | 0.034937 | 2.607648 | [
"s999248880",
"s063866022"
] |
u657913472 | p03146 | python | s687961753 | s716059608 | 24 | 18 | 3,064 | 2,940 | Accepted | Accepted | 25 | s=int(eval(input()))
i=2
while s>1:s=[s//2,s*3+1][s%2];i+=1
print((max(i,4))) | s=int(eval(input()))
i=4
while s>4or 3==s:s=[s//2,s*3+1][s%2];i+=1
print(i) | 4 | 4 | 72 | 72 | s = int(eval(input()))
i = 2
while s > 1:
s = [s // 2, s * 3 + 1][s % 2]
i += 1
print((max(i, 4)))
| s = int(eval(input()))
i = 4
while s > 4 or 3 == s:
s = [s // 2, s * 3 + 1][s % 2]
i += 1
print(i)
| false | 0 | [
"-i = 2",
"-while s > 1:",
"+i = 4",
"+while s > 4 or 3 == s:",
"-print((max(i, 4)))",
"+print(i)"
] | false | 0.040422 | 0.041023 | 0.98535 | [
"s687961753",
"s716059608"
] |
u608007704 | p02601 | python | s861318184 | s714128030 | 32 | 26 | 9,140 | 9,184 | Accepted | Accepted | 18.75 | A,B,C=list(map(int,input().split()))
K=int(eval(input()))
for i in range(K):
if A>=B:
B*=2
elif B>=C:
C*=2
if A<B and B<C:
print("Yes")
else:
print("No")
| import itertools
A,B,C=list(map(int,input().split()))
K=int(eval(input()))
l=[0,1,2,3,4,5,6,7]
for c in itertools.product(l, repeat=3):
if sum(c) == K and A*2**c[0]<B*2**c[1] and B*2**c[1]<C*2**c[2]:
print("Yes")
exit(0)
print("No")
| 14 | 11 | 177 | 250 | A, B, C = list(map(int, input().split()))
K = int(eval(input()))
for i in range(K):
if A >= B:
B *= 2
elif B >= C:
C *= 2
if A < B and B < C:
print("Yes")
else:
print("No")
| import itertools
A, B, C = list(map(int, input().split()))
K = int(eval(input()))
l = [0, 1, 2, 3, 4, 5, 6, 7]
for c in itertools.product(l, repeat=3):
if sum(c) == K and A * 2 ** c[0] < B * 2 ** c[1] and B * 2 ** c[1] < C * 2 ** c[2]:
print("Yes")
exit(0)
print("No")
| false | 21.428571 | [
"+import itertools",
"+",
"-for i in range(K):",
"- if A >= B:",
"- B *= 2",
"- elif B >= C:",
"- C *= 2",
"-if A < B and B < C:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+l = [0, 1, 2, 3, 4, 5, 6, 7]",
"+for c in itertools.product(l, repeat=3):",
"+ ... | false | 0.03388 | 0.035134 | 0.964287 | [
"s861318184",
"s714128030"
] |
u512212329 | p02615 | python | s683300069 | s253145275 | 177 | 154 | 32,668 | 32,720 | Accepted | Accepted | 12.99 | from collections import deque
def main():
eval(input()) # n
friendliness = [int(x) for x in input().split()]
friendliness.sort()
friendliness = deque(friendliness)
edges = deque()
popped = friendliness.pop()
edges.append(popped)
ans = 0
while friendliness:
ans... | from collections import deque
def main():
eval(input()) # n
friendliness = deque(sorted(int(x) for x in input().split()))
edges = deque()
popped = friendliness.pop()
edges.append(popped)
ans = 0
while friendliness:
ans += edges.popleft()
popped = friendliness.p... | 22 | 20 | 491 | 439 | from collections import deque
def main():
eval(input()) # n
friendliness = [int(x) for x in input().split()]
friendliness.sort()
friendliness = deque(friendliness)
edges = deque()
popped = friendliness.pop()
edges.append(popped)
ans = 0
while friendliness:
ans += edges.pop... | from collections import deque
def main():
eval(input()) # n
friendliness = deque(sorted(int(x) for x in input().split()))
edges = deque()
popped = friendliness.pop()
edges.append(popped)
ans = 0
while friendliness:
ans += edges.popleft()
popped = friendliness.pop()
... | false | 9.090909 | [
"- friendliness = [int(x) for x in input().split()]",
"- friendliness.sort()",
"- friendliness = deque(friendliness)",
"+ friendliness = deque(sorted(int(x) for x in input().split()))"
] | false | 0.039212 | 0.048348 | 0.811029 | [
"s683300069",
"s253145275"
] |
u014333473 | p03360 | python | s238666336 | s568108786 | 32 | 25 | 8,928 | 9,060 | Accepted | Accepted | 21.88 | a=sorted(map(int,input().split()));print((a[-1]*(2**(int(eval(input()))))+sum(a)-a[-1])) | a=sorted(map(int,input().split()))[::-1];print((a[0]*(2**(int(eval(input()))))+sum(a)-a[0])) | 1 | 1 | 80 | 84 | a = sorted(map(int, input().split()))
print((a[-1] * (2 ** (int(eval(input())))) + sum(a) - a[-1]))
| a = sorted(map(int, input().split()))[::-1]
print((a[0] * (2 ** (int(eval(input())))) + sum(a) - a[0]))
| false | 0 | [
"-a = sorted(map(int, input().split()))",
"-print((a[-1] * (2 ** (int(eval(input())))) + sum(a) - a[-1]))",
"+a = sorted(map(int, input().split()))[::-1]",
"+print((a[0] * (2 ** (int(eval(input())))) + sum(a) - a[0]))"
] | false | 0.040498 | 0.111903 | 0.361904 | [
"s238666336",
"s568108786"
] |
u869790980 | p03295 | python | s958020659 | s859283701 | 406 | 319 | 89,496 | 90,144 | Accepted | Accepted | 21.43 | n,m = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(m)]
c = 0
s.sort()
cur = []
for u,v in s:
if cur == []:
cur = [u,v]
if cur[1] <= u:
cur = [u,v]
c += 1
else:
cur = [max(u, cur[0]),min(v, cur[1])]
print(c + (1 if cur else 0))
"""
---- ------
4 ... | n,m = list(map(int, input().split()))
s,c = [list(map(int, input().split())) for _ in range(m)], 1
s.sort()
cur = s[0]
for u,v in s[1:]:
if cur[1] <= u:
cur,c = [u,v], c + 1
else: cur = [max(u, cur[0]),min(v, cur[1])]
print(c) | 24 | 9 | 393 | 234 | n, m = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(m)]
c = 0
s.sort()
cur = []
for u, v in s:
if cur == []:
cur = [u, v]
if cur[1] <= u:
cur = [u, v]
c += 1
else:
cur = [max(u, cur[0]), min(v, cur[1])]
print(c + (1 if cur else 0))
"""
-... | n, m = list(map(int, input().split()))
s, c = [list(map(int, input().split())) for _ in range(m)], 1
s.sort()
cur = s[0]
for u, v in s[1:]:
if cur[1] <= u:
cur, c = [u, v], c + 1
else:
cur = [max(u, cur[0]), min(v, cur[1])]
print(c)
| false | 62.5 | [
"-s = [list(map(int, input().split())) for _ in range(m)]",
"-c = 0",
"+s, c = [list(map(int, input().split())) for _ in range(m)], 1",
"-cur = []",
"-for u, v in s:",
"- if cur == []:",
"- cur = [u, v]",
"+cur = s[0]",
"+for u, v in s[1:]:",
"- cur = [u, v]",
"- c += 1",... | false | 0.037397 | 0.082608 | 0.452709 | [
"s958020659",
"s859283701"
] |
u524534026 | p03071 | python | s612518082 | s597207160 | 28 | 17 | 3,064 | 2,940 | Accepted | Accepted | 39.29 | a, b = list(map(int, input().split()))
ans=0
for i in range(2):
ans += max(a,b)
if a>b:
a -=1
else:
b -=1
print(ans) | a, b = list(map(int, input().split()))
preans = max(a*2-1,b*2-1)
ans=max(preans,a+b)
print(ans) | 9 | 4 | 146 | 92 | a, b = list(map(int, input().split()))
ans = 0
for i in range(2):
ans += max(a, b)
if a > b:
a -= 1
else:
b -= 1
print(ans)
| a, b = list(map(int, input().split()))
preans = max(a * 2 - 1, b * 2 - 1)
ans = max(preans, a + b)
print(ans)
| false | 55.555556 | [
"-ans = 0",
"-for i in range(2):",
"- ans += max(a, b)",
"- if a > b:",
"- a -= 1",
"- else:",
"- b -= 1",
"+preans = max(a * 2 - 1, b * 2 - 1)",
"+ans = max(preans, a + b)"
] | false | 0.085826 | 0.068699 | 1.249308 | [
"s612518082",
"s597207160"
] |
u440613652 | p02725 | python | s815406840 | s421846945 | 143 | 117 | 32,204 | 32,292 | Accepted | Accepted | 18.18 | k,n=list(map(int,input().split()))
arr=list(map(int,input().split()))
for i in range(n-1):
arr.append(arr[i]+k)
min_=99999999999
for i in range(n):
if arr[i+n-1]-arr[i]<min_:
min_=arr[i+n-1]-arr[i]
print(min_) | k,n=list(map(int,input().split()))
arr=list(map(int,input().split()))
min_=99999999999
for i in range(n):
if i==0:
x=arr[-1]-arr[0]
else:
x=k-(arr[i]-arr[i-1])
if x<min_:
min_=x
print(min_) | 14 | 16 | 225 | 212 | k, n = list(map(int, input().split()))
arr = list(map(int, input().split()))
for i in range(n - 1):
arr.append(arr[i] + k)
min_ = 99999999999
for i in range(n):
if arr[i + n - 1] - arr[i] < min_:
min_ = arr[i + n - 1] - arr[i]
print(min_)
| k, n = list(map(int, input().split()))
arr = list(map(int, input().split()))
min_ = 99999999999
for i in range(n):
if i == 0:
x = arr[-1] - arr[0]
else:
x = k - (arr[i] - arr[i - 1])
if x < min_:
min_ = x
print(min_)
| false | 12.5 | [
"-for i in range(n - 1):",
"- arr.append(arr[i] + k)",
"- if arr[i + n - 1] - arr[i] < min_:",
"- min_ = arr[i + n - 1] - arr[i]",
"+ if i == 0:",
"+ x = arr[-1] - arr[0]",
"+ else:",
"+ x = k - (arr[i] - arr[i - 1])",
"+ if x < min_:",
"+ min_ = x"
] | false | 0.040139 | 0.040763 | 0.984692 | [
"s815406840",
"s421846945"
] |
u045953894 | p02700 | python | s848829508 | s018963478 | 32 | 25 | 9,112 | 9,124 | Accepted | Accepted | 21.88 | a,b,c,d = list(map(int,input().split()))
for i in range(100):
c -= b
if c <= 0:
print('Yes')
break
a -= d
if a <= 0:
print('No')
break | import math
a,b,c,d = list(map(int,input().split()))
print(('Yes' if math.ceil(c/b) <= math.ceil(a/d) else 'No')) | 10 | 3 | 185 | 107 | a, b, c, d = list(map(int, input().split()))
for i in range(100):
c -= b
if c <= 0:
print("Yes")
break
a -= d
if a <= 0:
print("No")
break
| import math
a, b, c, d = list(map(int, input().split()))
print(("Yes" if math.ceil(c / b) <= math.ceil(a / d) else "No"))
| false | 70 | [
"+import math",
"+",
"-for i in range(100):",
"- c -= b",
"- if c <= 0:",
"- print(\"Yes\")",
"- break",
"- a -= d",
"- if a <= 0:",
"- print(\"No\")",
"- break",
"+print((\"Yes\" if math.ceil(c / b) <= math.ceil(a / d) else \"No\"))"
] | false | 0.036145 | 0.093342 | 0.38723 | [
"s848829508",
"s018963478"
] |
u952708174 | p02713 | python | s040711737 | s483602871 | 509 | 217 | 67,804 | 89,148 | Accepted | Accepted | 57.37 | def c_sum_of_gcd_of_tuples_easy():
from math import gcd
K = int(eval(input()))
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
ans += gcd(gcd(a, b), c)
return ans
print((c_sum_of_gcd_of_tuples_easy())) | def c_sum_of_gcd_of_tuples_easy():
import numpy as np
K = int(eval(input()))
r = np.arange(1, K + 1)
return np.gcd.outer(np.gcd.outer(r, r), r).sum()
print((c_sum_of_gcd_of_tuples_easy())) | 12 | 8 | 300 | 205 | def c_sum_of_gcd_of_tuples_easy():
from math import gcd
K = int(eval(input()))
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
ans += gcd(gcd(a, b), c)
return ans
print((c_sum_of_gcd_of_tuples_easy()))
| def c_sum_of_gcd_of_tuples_easy():
import numpy as np
K = int(eval(input()))
r = np.arange(1, K + 1)
return np.gcd.outer(np.gcd.outer(r, r), r).sum()
print((c_sum_of_gcd_of_tuples_easy()))
| false | 33.333333 | [
"- from math import gcd",
"+ import numpy as np",
"- ans = 0",
"- for a in range(1, K + 1):",
"- for b in range(1, K + 1):",
"- for c in range(1, K + 1):",
"- ans += gcd(gcd(a, b), c)",
"- return ans",
"+ r = np.arange(1, K + 1)",
"+ return np.... | false | 0.13529 | 0.185859 | 0.72792 | [
"s040711737",
"s483602871"
] |
u040298438 | p02573 | python | s896961289 | s359363567 | 617 | 502 | 47,156 | 47,132 | Accepted | Accepted | 18.64 | # Union Find
def find(x):
if par[x] < 0:
return x
else:
par[x] = find(par[x])
return par[x]
def unite(x, y):
x = find(x)
y = find(y)
if x == y:
return False
else:
if par[x] > par[y]:
x, y = y, x
par[x] += par[y]
... | # Union Find
def find(x):
if par[x] < 0:
return x
else:
par[x] = find(par[x])
return par[x]
def unite(x, y):
x = find(x)
y = find(y)
if x == y:
return False
else:
if par[x] > par[y]:
x, y = y, x
par[x] += par[y]
... | 52 | 37 | 829 | 618 | # Union Find
def find(x):
if par[x] < 0:
return x
else:
par[x] = find(par[x])
return par[x]
def unite(x, y):
x = find(x)
y = find(y)
if x == y:
return False
else:
if par[x] > par[y]:
x, y = y, x
par[x] += par[y]
par[y] = x
... | # Union Find
def find(x):
if par[x] < 0:
return x
else:
par[x] = find(par[x])
return par[x]
def unite(x, y):
x = find(x)
y = find(y)
if x == y:
return False
else:
if par[x] > par[y]:
x, y = y, x
par[x] += par[y]
par[y] = x
... | false | 28.846154 | [
"-def same(x, y):",
"- return find(x) == find(y)",
"-",
"-",
"-def size(x):",
"- return -par[find(x)]",
"-",
"-",
"+par = [-1] * n",
"-par = [-1] * n",
"-d = {}",
"-for i in range(n):",
"- i = find(i)",
"- if i in d:",
"- d[i] += 1",
"- else:",
"- d[i] = ... | false | 0.041283 | 0.036312 | 1.136891 | [
"s896961289",
"s359363567"
] |
u562935282 | p03078 | python | s581906889 | s968205818 | 502 | 234 | 105,612 | 46,192 | Accepted | Accepted | 53.39 | def main():
import sys
input = sys.stdin.readline
x, y, z, k = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)
B = sorted(map(int, input().split()), reverse=True)
C = sorted(map(int, input().split()), reverse=True)
ret = []
for p, a in enumerat... | def main():
import sys
input = sys.stdin.readline
x, y, z, k = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)
B = sorted(map(int, input().split()), reverse=True)
C = sorted(map(int, input().split()), reverse=True)
ret = []
for p, a in enumerat... | 27 | 28 | 685 | 719 | def main():
import sys
input = sys.stdin.readline
x, y, z, k = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)
B = sorted(map(int, input().split()), reverse=True)
C = sorted(map(int, input().split()), reverse=True)
ret = []
for p, a in enumerate(A):
... | def main():
import sys
input = sys.stdin.readline
x, y, z, k = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)
B = sorted(map(int, input().split()), reverse=True)
C = sorted(map(int, input().split()), reverse=True)
ret = []
for p, a in enumerate(A, 1):
... | false | 3.571429 | [
"- for p, a in enumerate(A):",
"- for q, b in enumerate(B):",
"+ for p, a in enumerate(A, 1):",
"+ for q, b in enumerate(B, 1):",
"- for r, c in enumerate(C):",
"+ for r, c in enumerate(C, 1):",
"+# Enumerateのindex間違えていた"
] | false | 0.082903 | 0.082258 | 1.007832 | [
"s581906889",
"s968205818"
] |
u083960235 | p02947 | python | s630698305 | s438160120 | 309 | 240 | 25,716 | 31,664 | Accepted | Accepted | 22.33 | import sys, re, os
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... | import sys, re, os
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... | 35 | 37 | 1,007 | 1,021 | import sys, re, os
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_upper... | import sys, re, os
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_upper... | false | 5.405405 | [
"-from heapq import heapify, heappop, heappush",
"+from fractions import gcd",
"+from bisect import bisect, bisect_left, bisect_right",
"-memo = defaultdict(int)",
"-for i in range(N):",
"- l = list(S[i])",
"- l.sort()",
"- l = \"\".join(l)",
"- memo[str(l)] += 1",
"-# print(memo)",
... | false | 0.0464 | 0.04544 | 1.021129 | [
"s630698305",
"s438160120"
] |
u883048396 | p03775 | python | s983277805 | s758184922 | 30 | 27 | 3,060 | 3,444 | Accepted | Accepted | 10 |
iN = int(eval(input()))
iLim = int(iN**0.5) + 1
iMinMax = len(str(iN))
for i in range(iLim+1,0,-1):
if iN % i == 0:
iMax = len(str(max(i,iN//i)))
if iMinMax < iMax :
print(iMinMax)
exit()
else:
iMinMax = iMax
print(iMinMax)
| def 解():
iN = int(eval(input()))
iLim = int(iN**0.5) + 1
iMinMax = len(str(iN))
for i in range(iLim+1,0,-1):
if iN % i == 0:
iMax = len(str(max(i,iN//i)))
if iMinMax < iMax :
print(iMinMax)
exit()
else:
... | 14 | 15 | 297 | 358 | iN = int(eval(input()))
iLim = int(iN**0.5) + 1
iMinMax = len(str(iN))
for i in range(iLim + 1, 0, -1):
if iN % i == 0:
iMax = len(str(max(i, iN // i)))
if iMinMax < iMax:
print(iMinMax)
exit()
else:
iMinMax = iMax
print(iMinMax)
| def 解():
iN = int(eval(input()))
iLim = int(iN**0.5) + 1
iMinMax = len(str(iN))
for i in range(iLim + 1, 0, -1):
if iN % i == 0:
iMax = len(str(max(i, iN // i)))
if iMinMax < iMax:
print(iMinMax)
exit()
else:
iMi... | false | 6.666667 | [
"-iN = int(eval(input()))",
"-iLim = int(iN**0.5) + 1",
"-iMinMax = len(str(iN))",
"-for i in range(iLim + 1, 0, -1):",
"- if iN % i == 0:",
"- iMax = len(str(max(i, iN // i)))",
"- if iMinMax < iMax:",
"- print(iMinMax)",
"- exit()",
"- else:",
"- ... | false | 0.043822 | 0.04302 | 1.018655 | [
"s983277805",
"s758184922"
] |
u281303342 | p03488 | python | s378609160 | s148413623 | 1,643 | 1,240 | 3,876 | 3,816 | Accepted | Accepted | 24.53 | S = eval(input())+"T"
X,Y = list(map(int,input().split()))
dX0,dX,dY,dr,dc = 0,[],[],"x",0
for s in S:
if s == "F":
dc += 1
elif s == "T":
if dr == "x":
dr = "y"
dX.append(dc)
else:
dr = "x"
dY.append(dc)
dc = 0
dX0,dX... | S = eval(input())
X,Y = list(map(int,input().split()))
S = S+"T"
d,cnt = 0,0
pos = [set([0]),set([0])]
init = False
for s in S:
# 前進
if s=="F":
cnt += 1
# 方向転換
else:
# 移動先を全列挙
if cnt>0:
temp = set([])
for p in pos[d]:
temp... | 32 | 28 | 649 | 568 | S = eval(input()) + "T"
X, Y = list(map(int, input().split()))
dX0, dX, dY, dr, dc = 0, [], [], "x", 0
for s in S:
if s == "F":
dc += 1
elif s == "T":
if dr == "x":
dr = "y"
dX.append(dc)
else:
dr = "x"
dY.append(dc)
dc = 0
dX0, dX ... | S = eval(input())
X, Y = list(map(int, input().split()))
S = S + "T"
d, cnt = 0, 0
pos = [set([0]), set([0])]
init = False
for s in S:
# 前進
if s == "F":
cnt += 1
# 方向転換
else:
# 移動先を全列挙
if cnt > 0:
temp = set([])
for p in pos[d]:
temp.add(p ... | false | 12.5 | [
"-S = eval(input()) + \"T\"",
"+S = eval(input())",
"-dX0, dX, dY, dr, dc = 0, [], [], \"x\", 0",
"+S = S + \"T\"",
"+d, cnt = 0, 0",
"+pos = [set([0]), set([0])]",
"+init = False",
"+ # 前進",
"- dc += 1",
"- elif s == \"T\":",
"- if dr == \"x\":",
"- dr = \"y\"",... | false | 0.037068 | 0.07351 | 0.50426 | [
"s378609160",
"s148413623"
] |
u661977789 | p03457 | python | s538127523 | s471034526 | 413 | 326 | 3,316 | 3,316 | Accepted | Accepted | 21.07 | N = int(eval(input()))
T, X, Y = 0, 0, 0
cnt = 0
for _ in range(N):
t, x, y = list(map(int,input().split()))
dist = abs(x-X) + abs(y-Y)
dt = t - T
cnt += all([dist <= dt, (dist - dt) % 2 == 0])
T, X, Y = t, x, y
print(("YNeos"[N!=cnt::2]))
| for _ in range(int(eval(input()))):
t, x, y = list(map(int,input().split()))
if (t+x+y)%2 + (t<x+y):
s = 1
break
s = 0
print(("YNeos"[s::2]))
| 11 | 8 | 250 | 153 | N = int(eval(input()))
T, X, Y = 0, 0, 0
cnt = 0
for _ in range(N):
t, x, y = list(map(int, input().split()))
dist = abs(x - X) + abs(y - Y)
dt = t - T
cnt += all([dist <= dt, (dist - dt) % 2 == 0])
T, X, Y = t, x, y
print(("YNeos"[N != cnt :: 2]))
| for _ in range(int(eval(input()))):
t, x, y = list(map(int, input().split()))
if (t + x + y) % 2 + (t < x + y):
s = 1
break
s = 0
print(("YNeos"[s::2]))
| false | 27.272727 | [
"-N = int(eval(input()))",
"-T, X, Y = 0, 0, 0",
"-cnt = 0",
"-for _ in range(N):",
"+for _ in range(int(eval(input()))):",
"- dist = abs(x - X) + abs(y - Y)",
"- dt = t - T",
"- cnt += all([dist <= dt, (dist - dt) % 2 == 0])",
"- T, X, Y = t, x, y",
"-print((\"YNeos\"[N != cnt :: 2]))... | false | 0.035355 | 0.035997 | 0.982168 | [
"s538127523",
"s471034526"
] |
u186838327 | p03371 | python | s170642720 | s127298979 | 178 | 66 | 39,696 | 67,728 | Accepted | Accepted | 62.92 | a, b, c, x, y = list(map(int, input().split()))
if a+b >= 2*c:
if x >= y:
ans = y*c*2
ans = ans+min((x-y)*a, (x-y)*2*c)
else:
ans = x*c*2
ans = ans+min((y-x)*b, (y-x)*2*c)
else:
ans = a*x + b*y
print(ans)
| a,b,c,x,y = list(map(int, input().split()))
ans = 10**18
for k in range(2*10**5+1):
if k%2 != 0:
continue
i = max(x-k//2, 0)
j = max(y-k//2, 0)
temp = a*i+b*j+c*k
ans = min(ans, temp)
print(ans)
| 13 | 11 | 257 | 228 | a, b, c, x, y = list(map(int, input().split()))
if a + b >= 2 * c:
if x >= y:
ans = y * c * 2
ans = ans + min((x - y) * a, (x - y) * 2 * c)
else:
ans = x * c * 2
ans = ans + min((y - x) * b, (y - x) * 2 * c)
else:
ans = a * x + b * y
print(ans)
| a, b, c, x, y = list(map(int, input().split()))
ans = 10**18
for k in range(2 * 10**5 + 1):
if k % 2 != 0:
continue
i = max(x - k // 2, 0)
j = max(y - k // 2, 0)
temp = a * i + b * j + c * k
ans = min(ans, temp)
print(ans)
| false | 15.384615 | [
"-if a + b >= 2 * c:",
"- if x >= y:",
"- ans = y * c * 2",
"- ans = ans + min((x - y) * a, (x - y) * 2 * c)",
"- else:",
"- ans = x * c * 2",
"- ans = ans + min((y - x) * b, (y - x) * 2 * c)",
"-else:",
"- ans = a * x + b * y",
"+ans = 10**18",
"+for k in ra... | false | 0.063304 | 0.670173 | 0.094459 | [
"s170642720",
"s127298979"
] |
u808427016 | p03329 | python | s016138039 | s007917767 | 277 | 256 | 2,940 | 2,940 | Accepted | Accepted | 7.58 | N = int(eval(input()))
result = 100000000000
def calc(x, base):
r = 0
while x:
x, m = divmod(x, base)
r += m
return r
for i in range(N + 1):
result = min(result, calc(i, 6) + calc(N - i, 9))
print(result)
| N = int(eval(input()))
def calc(x, base):
r = 0
while x:
x, m = divmod(x, base)
r += m
return r
result = min(calc(i, 6) + calc(N - i, 9) for i in range(N + 1))
print(result)
| 15 | 12 | 249 | 210 | N = int(eval(input()))
result = 100000000000
def calc(x, base):
r = 0
while x:
x, m = divmod(x, base)
r += m
return r
for i in range(N + 1):
result = min(result, calc(i, 6) + calc(N - i, 9))
print(result)
| N = int(eval(input()))
def calc(x, base):
r = 0
while x:
x, m = divmod(x, base)
r += m
return r
result = min(calc(i, 6) + calc(N - i, 9) for i in range(N + 1))
print(result)
| false | 20 | [
"-result = 100000000000",
"-for i in range(N + 1):",
"- result = min(result, calc(i, 6) + calc(N - i, 9))",
"+result = min(calc(i, 6) + calc(N - i, 9) for i in range(N + 1))"
] | false | 0.059937 | 0.083558 | 0.717308 | [
"s016138039",
"s007917767"
] |
u714642969 | p02599 | python | s558819263 | s085979682 | 1,716 | 742 | 235,400 | 168,660 | Accepted | Accepted | 56.76 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
N,Q=map(int,input().split())
a=tuple... | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
N,Q=map(int,input().split())
a=tuple... | 63 | 72 | 1,484 | 1,619 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
YesNo = lambda b: bool([print("Yes")] if b else print("No"))
YESNO = lambda b: bool([print("YES")] if b else print("NO"))
int1 = lambda x: int(x) - 1
N, Q = map(int, input().split(... | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
YesNo = lambda b: bool([print("Yes")] if b else print("No"))
YESNO = lambda b: bool([print("YES")] if b else print("NO"))
int1 = lambda x: int(x) - 1
N, Q = map(int, input().split(... | false | 12.5 | [
"-lr = [() for i in range(Q)]",
"+lr = [0] * Q",
"- lr[i] = (l, r, i)",
"-lr.sort(key=lambda t: t[1], reverse=1)",
"+ lr[i] = (r << 40) + (l << 20) + i",
"+lr.sort(reverse=1)",
"-l, r, j = lr.pop()",
"+mask = (1 << 20) - 1",
"+lrj = lr.pop()",
"+j = lrj & mask",
"+lrj >>= 20",
"+l = lrj ... | false | 0.035461 | 0.036344 | 0.975696 | [
"s558819263",
"s085979682"
] |
u515740713 | p02793 | python | s035659870 | s191063446 | 1,607 | 889 | 10,516 | 10,448 | Accepted | Accepted | 44.68 | import sys
from functools import reduce
from math import gcd
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
mod = 10 ** 9 + 7
N = int(readline())
A = list(map(int,readline().split()))
lcm = reduce(lambda x,y:x*y//gcd(x,y),A)
ans = 0
ans = sum(lcm//x ... | import sys
from functools import reduce
from math import gcd
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
mod = 10 ** 9 + 7
N = int(readline())
A = list(map(int,readline().split()))
lcm = reduce(lambda x,y:x*y//gcd(x,y),A)
ans = 0
coef = sum(pow(x,... | 13 | 14 | 347 | 378 | import sys
from functools import reduce
from math import gcd
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
mod = 10**9 + 7
N = int(readline())
A = list(map(int, readline().split()))
lcm = reduce(lambda x, y: x * y // gcd(x, y), A)
ans = 0
ans = sum(lcm // x fo... | import sys
from functools import reduce
from math import gcd
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
mod = 10**9 + 7
N = int(readline())
A = list(map(int, readline().split()))
lcm = reduce(lambda x, y: x * y // gcd(x, y), A)
ans = 0
coef = sum(pow(x, mod... | false | 7.142857 | [
"-ans = sum(lcm // x for x in A)",
"-print((ans % mod))",
"+coef = sum(pow(x, mod - 2, mod) for x in A)",
"+ans = lcm * coef % mod",
"+print(ans)"
] | false | 0.108931 | 0.036735 | 2.965333 | [
"s035659870",
"s191063446"
] |
u654470292 | p02844 | python | s841742430 | s460535231 | 486 | 353 | 41,964 | 41,180 | Accepted | Accepted | 27.37 | import sys
def input():
return sys.stdin.readline()[:-1]
inf=float("inf")
n=int(eval(input()))
s=eval(input())
dp=[[0]*10,[0]*100,[0]*1000]
for i in range(n):
for j in range(100):
if dp[1][j]>=1:
# print(j*10+int(s[i]))
dp[2][j*10+int(s[i])]+=1
for j in range(10):... | n=int(eval(input()))
s=eval(input())
ans=0
for i in range(1000):
tmp=str(i)
while len(tmp)<3:
tmp="0"+tmp
j=0
for k in range(n):
if tmp[j]==s[k]:
j+=1
if j==3:
ans+=1
break
print(ans) | 24 | 16 | 544 | 225 | import sys
def input():
return sys.stdin.readline()[:-1]
inf = float("inf")
n = int(eval(input()))
s = eval(input())
dp = [[0] * 10, [0] * 100, [0] * 1000]
for i in range(n):
for j in range(100):
if dp[1][j] >= 1:
# print(j*10+int(s[i]))
dp[2][j * 10 + int(s[i])] += 1
for... | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
tmp = str(i)
while len(tmp) < 3:
tmp = "0" + tmp
j = 0
for k in range(n):
if tmp[j] == s[k]:
j += 1
if j == 3:
ans += 1
break
print(ans)
| false | 33.333333 | [
"-import sys",
"-",
"-",
"-def input():",
"- return sys.stdin.readline()[:-1]",
"-",
"-",
"-inf = float(\"inf\")",
"-dp = [[0] * 10, [0] * 100, [0] * 1000]",
"-for i in range(n):",
"- for j in range(100):",
"- if dp[1][j] >= 1:",
"- # print(j*10+int(s[i]))",
"- ... | false | 0.170041 | 0.069532 | 2.445503 | [
"s841742430",
"s460535231"
] |
u111365362 | p02841 | python | s834124022 | s276192194 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | a,b = list(map(int,input().split()))
c,d = list(map(int,input().split()))
if a == c:
print((0))
else:
print((1)) | #22:04
a,b = list(map(int,input().split()))
c,d = list(map(int,input().split()))
print((int(a!=c))) | 6 | 4 | 105 | 88 | a, b = list(map(int, input().split()))
c, d = list(map(int, input().split()))
if a == c:
print((0))
else:
print((1))
| # 22:04
a, b = list(map(int, input().split()))
c, d = list(map(int, input().split()))
print((int(a != c)))
| false | 33.333333 | [
"+# 22:04",
"-if a == c:",
"- print((0))",
"-else:",
"- print((1))",
"+print((int(a != c)))"
] | false | 0.045394 | 0.048343 | 0.938994 | [
"s834124022",
"s276192194"
] |
u133936772 | p03816 | python | s086198132 | s614887680 | 52 | 46 | 20,208 | 22,540 | Accepted | Accepted | 11.54 | _,*l=list(map(int,open(0).read().split()))
c=len(set(l))
print((c-1+c%2)) | eval(input())
c=len(set(input().split()))
print((c-1+c%2)) | 3 | 3 | 67 | 52 | _, *l = list(map(int, open(0).read().split()))
c = len(set(l))
print((c - 1 + c % 2))
| eval(input())
c = len(set(input().split()))
print((c - 1 + c % 2))
| false | 0 | [
"-_, *l = list(map(int, open(0).read().split()))",
"-c = len(set(l))",
"+eval(input())",
"+c = len(set(input().split()))"
] | false | 0.038659 | 0.041796 | 0.924944 | [
"s086198132",
"s614887680"
] |
u312025627 | p03606 | python | s205783009 | s829936136 | 217 | 186 | 39,152 | 45,936 | Accepted | Accepted | 14.29 | n = int(eval(input()))
ans = 0
for i in range(n):
l, r = (int(i) for i in input().split())
ans += r - l + 1
print(ans) | def main():
import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
seats = [0]*(10**5+2)
LR = [[int(i) for i in input().split()] for j in range(N)]
for li, ri in LR:
seats[li] += 1
seats[ri+1] -= 1
from itertools import accumulate
S = list(accumulat... | 6 | 16 | 125 | 387 | n = int(eval(input()))
ans = 0
for i in range(n):
l, r = (int(i) for i in input().split())
ans += r - l + 1
print(ans)
| def main():
import sys
input = sys.stdin.buffer.readline
N = int(eval(input()))
seats = [0] * (10**5 + 2)
LR = [[int(i) for i in input().split()] for j in range(N)]
for li, ri in LR:
seats[li] += 1
seats[ri + 1] -= 1
from itertools import accumulate
S = list(accumulate(... | false | 62.5 | [
"-n = int(eval(input()))",
"-ans = 0",
"-for i in range(n):",
"- l, r = (int(i) for i in input().split())",
"- ans += r - l + 1",
"-print(ans)",
"+def main():",
"+ import sys",
"+",
"+ input = sys.stdin.buffer.readline",
"+ N = int(eval(input()))",
"+ seats = [0] * (10**5 + 2... | false | 0.040663 | 0.050914 | 0.798666 | [
"s205783009",
"s829936136"
] |
u102461423 | p04003 | python | s820265997 | s660889294 | 2,693 | 1,712 | 196,696 | 187,292 | Accepted | Accepted | 36.43 | import sys
input = sys.stdin.readline
from collections import defaultdict
"""
(駅、会社)を頂点にグラフを持つ。頂点数O(M)。
そのまま辺を貼ると辺が多くなりすぎる。
(駅、会社) -> (駅、無属性) -> (駅、会社)
"""
L = 32
mask = (1 << L) - 1
N,M = list(map(int,input().split()))
graph = defaultdict(list)
for _ in range(M):
p,q,c = list(map(int,input().split... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
N,M = list(map(int,readline().split()))
if M == 0:
print((-1))
exit()
m = list(map(int,read().split()))
P,Q,C = list(zip(*list(zip(m,m,m))))
V = []
... | 62 | 55 | 1,216 | 1,252 | import sys
input = sys.stdin.readline
from collections import defaultdict
"""
(駅、会社)を頂点にグラフを持つ。頂点数O(M)。
そのまま辺を貼ると辺が多くなりすぎる。
(駅、会社) -> (駅、無属性) -> (駅、会社)
"""
L = 32
mask = (1 << L) - 1
N, M = list(map(int, input().split()))
graph = defaultdict(list)
for _ in range(M):
p, q, c = list(map(int, input().split()))
p... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
N, M = list(map(int, readline().split()))
if M == 0:
print((-1))
exit()
m = list(map(int, read().split()))
P, Q, C = list(zip(*list(zip(m, m, m))))
V = []
V += [p <... | false | 11.290323 | [
"-input = sys.stdin.readline",
"-from collections import defaultdict",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+from collections import deque",
"-\"\"\"",
"-(駅、会社)を頂点にグラフを持つ。頂点数O(M)。",
"-そのまま辺を貼ると辺が多くなりすぎる。",
"-(駅、会社) ->... | false | 0.072108 | 0.062152 | 1.160195 | [
"s820265997",
"s660889294"
] |
u875541136 | p02707 | python | s315017298 | s213349750 | 235 | 184 | 32,240 | 34,052 | Accepted | Accepted | 21.7 | N = int(eval(input()))
A = list(map(int, input().split()))
i = -1
A = sorted(A) + [0]
for n in range(N):
count = 0
while(A[i+1] == n+1):
i += 1
count += 1
print(count) | import collections
N = int(eval(input()))
A = list(map(int, input().split()))
count = collections.Counter(A)
for n in range(N):
print((count[n+1])) | 10 | 6 | 184 | 146 | N = int(eval(input()))
A = list(map(int, input().split()))
i = -1
A = sorted(A) + [0]
for n in range(N):
count = 0
while A[i + 1] == n + 1:
i += 1
count += 1
print(count)
| import collections
N = int(eval(input()))
A = list(map(int, input().split()))
count = collections.Counter(A)
for n in range(N):
print((count[n + 1]))
| false | 40 | [
"+import collections",
"+",
"-i = -1",
"-A = sorted(A) + [0]",
"+count = collections.Counter(A)",
"- count = 0",
"- while A[i + 1] == n + 1:",
"- i += 1",
"- count += 1",
"- print(count)",
"+ print((count[n + 1]))"
] | false | 0.038763 | 0.06973 | 0.555897 | [
"s315017298",
"s213349750"
] |
u164727245 | p02669 | python | s754382478 | s846414914 | 1,639 | 1,180 | 11,220 | 10,960 | Accepted | Accepted | 28 | # coding: utf-8
from collections import defaultdict
def solve(*args: str) -> str:
t = int(args[0])
NABCD = [tuple(map(int, nabcd.split())) for nabcd in args[1:]]
ret = []
for n, a, b, c, d in NABCD:
ABC = ((2, a), (3, b), (5, c))
dp = defaultdict(lambda: n*d)
stack... | # coding: utf-8
from collections import defaultdict
def solve(*args: str) -> str:
t = int(args[0])
NABCD = [tuple(map(int, nabcd.split())) for nabcd in args[1:]]
ret = []
for n, a, b, c, d in NABCD:
ABC = ((2, a), (3, b), (5, c))
dp = defaultdict(lambda: n*d)
stack... | 34 | 36 | 921 | 963 | # coding: utf-8
from collections import defaultdict
def solve(*args: str) -> str:
t = int(args[0])
NABCD = [tuple(map(int, nabcd.split())) for nabcd in args[1:]]
ret = []
for n, a, b, c, d in NABCD:
ABC = ((2, a), (3, b), (5, c))
dp = defaultdict(lambda: n * d)
stack = [(n, 0)]... | # coding: utf-8
from collections import defaultdict
def solve(*args: str) -> str:
t = int(args[0])
NABCD = [tuple(map(int, nabcd.split())) for nabcd in args[1:]]
ret = []
for n, a, b, c, d in NABCD:
ABC = ((2, a), (3, b), (5, c))
dp = defaultdict(lambda: n * d)
stack = [(n, 0)]... | false | 5.555556 | [
"- l, h = rem // x, -(-rem // x)",
"- stack.append((l, d * abs(l * x - rem) + cost + y * (0 < l)))",
"- stack.append((h, d * abs(h * x - rem) + cost + y))",
"+ div, m = divmod(rem, x)",
"+ if div:",
"+ ... | false | 1.034231 | 0.961842 | 1.075261 | [
"s754382478",
"s846414914"
] |
u064505481 | p03163 | python | s562917926 | s108714580 | 879 | 253 | 278,488 | 45,296 | Accepted | Accepted | 71.22 | from sys import stdin, stdout
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: list(map(int, stdin.readline().split()))
INF, NINF = float('inf'), float('-inf')
def main():
n, W = rli()
weight = [0 for _ in range(n)]
val = [0 for _ in range(n)]
for i in range(n):
w, ... | from sys import stdin, stdout
from collections import deque, defaultdict
import math as m
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: list(map(int, stdin.readline().split()))
INF, NINF = float('inf'), float('-inf')
def main():
n, W = rli()
items = []
for _ in ra... | 33 | 26 | 814 | 573 | from sys import stdin, stdout
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: list(map(int, stdin.readline().split()))
INF, NINF = float("inf"), float("-inf")
def main():
n, W = rli()
weight = [0 for _ in range(n)]
val = [0 for _ in range(n)]
for i in range(n):
... | from sys import stdin, stdout
from collections import deque, defaultdict
import math as m
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: list(map(int, stdin.readline().split()))
INF, NINF = float("inf"), float("-inf")
def main():
n, W = rli()
items = []
for _ in range(... | false | 21.212121 | [
"+from collections import deque, defaultdict",
"+import math as m",
"- weight = [0 for _ in range(n)]",
"- val = [0 for _ in range(n)]",
"- for i in range(n):",
"+ items = []",
"+ for _ in range(n):",
"- weight[i], val[i] = w, v",
"- # dp(i, j) = max val using items 1,...,i ... | false | 0.040633 | 0.118194 | 0.343785 | [
"s562917926",
"s108714580"
] |
u605880635 | p02630 | python | s137933304 | s510647233 | 482 | 372 | 72,480 | 26,936 | Accepted | Accepted | 22.82 | # 371 ms, 27032 KB
n = int(eval(input()))
a = list(map(int, input().split()))
q = int(eval(input()))
b = []
c = []
bc = [list(map(int, input().split())) for _ in range(q)]
b, c = [list(i) for i in zip(*bc)]
dic = {}
for aa in a:
dic[aa] = dic.get(aa, 0) + 1
s = sum(a)
for i in range(q):
if... | # 371 ms, 27032 KB
n = int(eval(input()))
a = list(map(int, input().split()))
q = int(eval(input()))
b = []
c = []
for _ in range(q):
bi, ci = list(map(int, input().split()))
b.append(bi)
c.append(ci)
#bc = [map(int, input().split()) for _ in range(q)]
#b, c = [list(i) for i in zip(*bc)]
d... | 23 | 27 | 474 | 578 | # 371 ms, 27032 KB
n = int(eval(input()))
a = list(map(int, input().split()))
q = int(eval(input()))
b = []
c = []
bc = [list(map(int, input().split())) for _ in range(q)]
b, c = [list(i) for i in zip(*bc)]
dic = {}
for aa in a:
dic[aa] = dic.get(aa, 0) + 1
s = sum(a)
for i in range(q):
if b[i] not in dic:
... | # 371 ms, 27032 KB
n = int(eval(input()))
a = list(map(int, input().split()))
q = int(eval(input()))
b = []
c = []
for _ in range(q):
bi, ci = list(map(int, input().split()))
b.append(bi)
c.append(ci)
# bc = [map(int, input().split()) for _ in range(q)]
# b, c = [list(i) for i in zip(*bc)]
dic = {}
for aa i... | false | 14.814815 | [
"-bc = [list(map(int, input().split())) for _ in range(q)]",
"-b, c = [list(i) for i in zip(*bc)]",
"+for _ in range(q):",
"+ bi, ci = list(map(int, input().split()))",
"+ b.append(bi)",
"+ c.append(ci)",
"+# bc = [map(int, input().split()) for _ in range(q)]",
"+# b, c = [list(i) for i in zi... | false | 0.041013 | 0.183497 | 0.223508 | [
"s137933304",
"s510647233"
] |
u775681539 | p02838 | python | s352147829 | s442007280 | 1,997 | 484 | 35,852 | 89,712 | Accepted | Accepted | 75.76 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N = int(readline())
A = [int(i) for i in readline().split()]
P = int(1e9)+7
s = 0
for k in range(60):
cnt = 0
for num in A:
if (n... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
n = int(readline())
a = [int(i) for i in readline().split()]
s = 0
P = int(1e9)+7
for k in range(60):
cnt = 0
for e in a:
if ... | 20 | 20 | 461 | 467 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
N = int(readline())
A = [int(i) for i in readline().split()]
P = int(1e9) + 7
s = 0
for k in range(60):
cnt = 0
for num in A:
if (num >> k) &... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
n = int(readline())
a = [int(i) for i in readline().split()]
s = 0
P = int(1e9) + 7
for k in range(60):
cnt = 0
for e in a:
if (e >> k) & 1:
... | false | 0 | [
"- N = int(readline())",
"- A = [int(i) for i in readline().split()]",
"+ n = int(readline())",
"+ a = [int(i) for i in readline().split()]",
"+ s = 0",
"- s = 0",
"- for num in A:",
"- if (num >> k) & 1:",
"+ for e in a:",
"+ if (e >> k) & 1:"... | false | 0.042096 | 0.037262 | 1.129731 | [
"s352147829",
"s442007280"
] |
u607155447 | p02951 | python | s785006313 | s522891032 | 32 | 29 | 9,148 | 9,152 | Accepted | Accepted | 9.38 | A, B, C = list(map(int, input().split()))
D = B + C - A
print((max(0, D))) | A, B, C = list(map(int, input().split()))
print((max(0, B + C - A))) | 3 | 2 | 68 | 61 | A, B, C = list(map(int, input().split()))
D = B + C - A
print((max(0, D)))
| A, B, C = list(map(int, input().split()))
print((max(0, B + C - A)))
| false | 33.333333 | [
"-D = B + C - A",
"-print((max(0, D)))",
"+print((max(0, B + C - A)))"
] | false | 0.046269 | 0.046636 | 0.992142 | [
"s785006313",
"s522891032"
] |
u934442292 | p02960 | python | s229394446 | s426223748 | 336 | 173 | 96,168 | 96,036 | Accepted | Accepted | 48.51 | import sys
input = sys.stdin.readline
P = 10 ** 9 + 7
Q = 13
def main():
S = input().rstrip()
N = len(S)
dp = [[0] * Q for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
base = pow(10, N - 1 - i, Q)
D = S[i]
if D == "?":
for d in range(1... | import sys
input = sys.stdin.readline
P = 10 ** 9 + 7
Q = 13
def main():
S = input().rstrip()
N = len(S)
dp = [[0] * Q for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
D = S[i]
if D == "?":
for d in range(10):
for j in range(Q)... | 37 | 34 | 822 | 654 | import sys
input = sys.stdin.readline
P = 10**9 + 7
Q = 13
def main():
S = input().rstrip()
N = len(S)
dp = [[0] * Q for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
base = pow(10, N - 1 - i, Q)
D = S[i]
if D == "?":
for d in range(10):
n ... | import sys
input = sys.stdin.readline
P = 10**9 + 7
Q = 13
def main():
S = input().rstrip()
N = len(S)
dp = [[0] * Q for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
D = S[i]
if D == "?":
for d in range(10):
for j in range(Q):
... | false | 8.108108 | [
"- base = pow(10, N - 1 - i, Q)",
"- n = d * base",
"- next_j = (j + n) % Q",
"- dp[i + 1][next_j] += dp[i][j]",
"- dp[i + 1][next_j] %= P",
"+ dp[i + 1][(10 * j + d) % Q] += dp[i][j]",
"- n = in... | false | 0.038087 | 0.03807 | 1.000436 | [
"s229394446",
"s426223748"
] |
u948524308 | p03831 | python | s086199805 | s158086722 | 113 | 94 | 15,020 | 14,224 | Accepted | Accepted | 16.81 | N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
ans1 = 0
ans2 = 0
for i in range(1, N):
D = X[i] - X[i - 1]
ans1 += D * A
ans2 += min(D * A, B)
print((min(ans1, ans2)))
| N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 0
for i in range(1, N):
D = X[i] - X[i - 1]
ans += min(D * A, B)
print(ans)
| 11 | 9 | 215 | 172 | N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
ans1 = 0
ans2 = 0
for i in range(1, N):
D = X[i] - X[i - 1]
ans1 += D * A
ans2 += min(D * A, B)
print((min(ans1, ans2)))
| N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 0
for i in range(1, N):
D = X[i] - X[i - 1]
ans += min(D * A, B)
print(ans)
| false | 18.181818 | [
"-ans1 = 0",
"-ans2 = 0",
"+ans = 0",
"- ans1 += D * A",
"- ans2 += min(D * A, B)",
"-print((min(ans1, ans2)))",
"+ ans += min(D * A, B)",
"+print(ans)"
] | false | 0.039162 | 0.042298 | 0.925864 | [
"s086199805",
"s158086722"
] |
u631299617 | p04045 | python | s013126239 | s746711703 | 199 | 19 | 3,060 | 3,060 | Accepted | Accepted | 90.45 | n,k=list(map(int,input().split()))
d=input().split()
while 1:
t=0
p=list(str(n))
q=len(p)
for c in range(q):
if t==1:
break
for b in range(k):
if p[c]==d[b]:
n=n+1
t=1
break
if t==0:
break
... | n,k=list(map(int,input().split()))
d=input().split()
while 1:
t=0
p=list(str(n))
q=len(p)
for c in range(q):
if t==1:
break
for b in range(k):
if p[c]==d[b]:
r=10**(q-c-1)
n=int(n/r+1)*r
t=1
... | 17 | 18 | 323 | 363 | n, k = list(map(int, input().split()))
d = input().split()
while 1:
t = 0
p = list(str(n))
q = len(p)
for c in range(q):
if t == 1:
break
for b in range(k):
if p[c] == d[b]:
n = n + 1
t = 1
break
if t == 0:
... | n, k = list(map(int, input().split()))
d = input().split()
while 1:
t = 0
p = list(str(n))
q = len(p)
for c in range(q):
if t == 1:
break
for b in range(k):
if p[c] == d[b]:
r = 10 ** (q - c - 1)
n = int(n / r + 1) * r
... | false | 5.555556 | [
"- n = n + 1",
"+ r = 10 ** (q - c - 1)",
"+ n = int(n / r + 1) * r"
] | false | 0.046281 | 0.043245 | 1.070211 | [
"s013126239",
"s746711703"
] |
u877470159 | p03634 | python | s230376383 | s886122592 | 1,606 | 559 | 81,312 | 72,276 | Accepted | Accepted | 65.19 | n=int(eval(input()))
G=[[] for i in range(n)]
for i in range(n-1):
a,b,c=[int(v)-1 for v in input().split()]
c+=1
G[a].append((b,c))
G[b].append((a,c))
q,k=[int(v) for v in input().split()]
k=k-1
stack=[k]
dis=[-1]*n
dis[k]=0
while stack!=[]:
now=stack.pop()
d=dis[now]
for i i... | import sys
input=sys.stdin.readline
n=int(eval(input()))
G=[[] for i in range(n)]
for i in range(n-1):
a,b,c=[int(v)-1 for v in input().split()]
c+=1
G[a].append((b,c))
G[b].append((a,c))
q,k=[int(v) for v in input().split()]
k=k-1
stack=[k]
dis=[-1]*n
dis[k]=0
while stack!=[]:
now=st... | 23 | 25 | 506 | 544 | n = int(eval(input()))
G = [[] for i in range(n)]
for i in range(n - 1):
a, b, c = [int(v) - 1 for v in input().split()]
c += 1
G[a].append((b, c))
G[b].append((a, c))
q, k = [int(v) for v in input().split()]
k = k - 1
stack = [k]
dis = [-1] * n
dis[k] = 0
while stack != []:
now = stack.pop()
d ... | import sys
input = sys.stdin.readline
n = int(eval(input()))
G = [[] for i in range(n)]
for i in range(n - 1):
a, b, c = [int(v) - 1 for v in input().split()]
c += 1
G[a].append((b, c))
G[b].append((a, c))
q, k = [int(v) for v in input().split()]
k = k - 1
stack = [k]
dis = [-1] * n
dis[k] = 0
while st... | false | 8 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.036792 | 0.059868 | 0.61456 | [
"s230376383",
"s886122592"
] |
u062691227 | p04046 | python | s240389758 | s527216173 | 550 | 181 | 26,388 | 88,988 | Accepted | Accepted | 67.09 | H, W, A, B = list(map(int, open(0).read().split()))
MOD = 10**9+7
factorials = [1] * (H + W + 1)
inv_factorials = [1] * (H + W + 1)
for i in range(H + W):
factorials[i+1] = factorials[i] * (i + 1) % MOD
inv_factorials = list([pow(n, -1, MOD) for n in factorials])
def modcomb(m, n, mod):
return f... | H, W, A, B = list(map(int, open(0).read().split()))
MOD = 10**9+7
factorials = [1] * (H + W + 1)
inv_factorials = [1] * (H + W + 1)
for i in range(H + W):
factorials[i+1] = factorials[i] * (i + 1) % MOD
inv_factorials = list([pow(n, MOD - 2, MOD) for n in factorials])
def modcomb(m, n, mod):
ret... | 21 | 23 | 584 | 627 | H, W, A, B = list(map(int, open(0).read().split()))
MOD = 10**9 + 7
factorials = [1] * (H + W + 1)
inv_factorials = [1] * (H + W + 1)
for i in range(H + W):
factorials[i + 1] = factorials[i] * (i + 1) % MOD
inv_factorials = list([pow(n, -1, MOD) for n in factorials])
def modcomb(m, n, mod):
return factorials[... | H, W, A, B = list(map(int, open(0).read().split()))
MOD = 10**9 + 7
factorials = [1] * (H + W + 1)
inv_factorials = [1] * (H + W + 1)
for i in range(H + W):
factorials[i + 1] = factorials[i] * (i + 1) % MOD
inv_factorials = list([pow(n, MOD - 2, MOD) for n in factorials])
def modcomb(m, n, mod):
return factor... | false | 8.695652 | [
"-inv_factorials = list([pow(n, -1, MOD) for n in factorials])",
"+inv_factorials = list([pow(n, MOD - 2, MOD) for n in factorials])",
"-total = modcomb(H + W - 2, W - 1, MOD)",
"-for i in range(B):",
"- total -= (",
"+# total = modcomb(H + W - 2, W - 1, MOD)",
"+total = 0",
"+# for i in range(B):"... | false | 0.061378 | 0.042261 | 1.452363 | [
"s240389758",
"s527216173"
] |
u006493569 | p03768 | python | s116759145 | s404694701 | 1,489 | 621 | 119,584 | 73,244 | Accepted | Accepted | 58.29 | n, m = list(map(int, input().split()))
g = [[i] for i in range(n)]
for _ in range(m):
u, v = [int(x) - 1 for x in input().split()]
g[u].append(v)
g[v].append(u)
q = int(eval(input()))
c = [None] * q
dp = [[-1 for j in range(n)] for i in range(11)]
for i in range(q):
v, d, c[i] = list(map... | n, m = list(map(int, input().split()))
g = [[i] for i in range(n)]
for _ in range(m):
u, v = [int(x) - 1 for x in input().split()]
g[u].append(v)
g[v].append(u)
q = eval(input())
c = [None] * q
dp = [[-1 for j in range(n)] for i in range(11)]
for i in range(q):
v, d, c[i] = list(map(int,... | 24 | 24 | 578 | 590 | n, m = list(map(int, input().split()))
g = [[i] for i in range(n)]
for _ in range(m):
u, v = [int(x) - 1 for x in input().split()]
g[u].append(v)
g[v].append(u)
q = int(eval(input()))
c = [None] * q
dp = [[-1 for j in range(n)] for i in range(11)]
for i in range(q):
v, d, c[i] = list(map(int, input().sp... | n, m = list(map(int, input().split()))
g = [[i] for i in range(n)]
for _ in range(m):
u, v = [int(x) - 1 for x in input().split()]
g[u].append(v)
g[v].append(u)
q = eval(input())
c = [None] * q
dp = [[-1 for j in range(n)] for i in range(11)]
for i in range(q):
v, d, c[i] = list(map(int, input().split()... | false | 0 | [
"-q = int(eval(input()))",
"+q = eval(input())"
] | false | 0.188902 | 0.155641 | 1.213702 | [
"s116759145",
"s404694701"
] |
u350909943 | p03455 | python | s655668186 | s463391588 | 26 | 23 | 9,136 | 9,044 | Accepted | Accepted | 11.54 | a,b = list(map(int,input().split()))
num = a * b
mod = num % 2
if mod == 0:
print("Even")
else:
print("Odd") | a,b = list(map(int,input().split()))
if a*b%2==0:
print("Even")
else:
print("Odd") | 8 | 5 | 114 | 84 | a, b = list(map(int, input().split()))
num = a * b
mod = num % 2
if mod == 0:
print("Even")
else:
print("Odd")
| a, b = list(map(int, input().split()))
if a * b % 2 == 0:
print("Even")
else:
print("Odd")
| false | 37.5 | [
"-num = a * b",
"-mod = num % 2",
"-if mod == 0:",
"+if a * b % 2 == 0:"
] | false | 0.033587 | 0.033026 | 1.016992 | [
"s655668186",
"s463391588"
] |
u788703383 | p03557 | python | s567649808 | s107439518 | 418 | 321 | 24,264 | 23,092 | Accepted | Accepted | 23.21 | import bisect
n = int(eval(input()))
a = sorted(list(map(int,input().split())))
b = sorted(list(map(int,input().split())))
c = sorted(list(map(int,input().split())))
d = [-1] * n
ansum = 0
def stat(array,par):
return bisect.bisect(array,par)
for i in range(n):
indexC = stat(c,b[i])
d[i] = max(0... | import bisect
n = int(eval(input()))
a = sorted(list(map(int,input().split())))
b = sorted(list(map(int,input().split())))
c = sorted(list(map(int,input().split())))
ansum = 0
for B in b:
index = bisect.bisect_left(a,B)
index2= bisect.bisect_right(c,B)
ansum += index*(n-index2)
print(ansum)
| 20 | 11 | 470 | 308 | import bisect
n = int(eval(input()))
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
d = [-1] * n
ansum = 0
def stat(array, par):
return bisect.bisect(array, par)
for i in range(n):
indexC = stat(c, b[i])
d[i] = max(0, ... | import bisect
n = int(eval(input()))
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
ansum = 0
for B in b:
index = bisect.bisect_left(a, B)
index2 = bisect.bisect_right(c, B)
ansum += index * (n - index2)
print(ansum)
| false | 45 | [
"-d = [-1] * n",
"-",
"-",
"-def stat(array, par):",
"- return bisect.bisect(array, par)",
"-",
"-",
"-for i in range(n):",
"- indexC = stat(c, b[i])",
"- d[i] = max(0, n - indexC)",
"-for i in range(n - 1):",
"- d[n - i - 2] += d[n - i - 1]",
"-for A in a:",
"- index = stat... | false | 0.150776 | 0.042184 | 3.574284 | [
"s567649808",
"s107439518"
] |
u899909022 | p02924 | python | s193570723 | s686662428 | 34 | 17 | 5,076 | 2,940 | Accepted | Accepted | 50 | from decimal import Decimal
n = int(eval(input()))
ans = int((n / Decimal(2)) * (n - 1))
print(ans) | n = int(eval(input()))
ans = int(n * (n - 1) // 2)
print(ans)
| 4 | 3 | 96 | 58 | from decimal import Decimal
n = int(eval(input()))
ans = int((n / Decimal(2)) * (n - 1))
print(ans)
| n = int(eval(input()))
ans = int(n * (n - 1) // 2)
print(ans)
| false | 25 | [
"-from decimal import Decimal",
"-",
"-ans = int((n / Decimal(2)) * (n - 1))",
"+ans = int(n * (n - 1) // 2)"
] | false | 0.03798 | 0.060765 | 0.62503 | [
"s193570723",
"s686662428"
] |
u809898133 | p03722 | python | s586680427 | s790388379 | 1,272 | 896 | 3,316 | 3,316 | Accepted | Accepted | 29.56 | n,m = list(map(int , input().split()))
e = []
for i in range(m):
a,b,c = list(map(int , input().split()))
e.append((a-1,b-1,c))
maxdis = [-float('inf') for i in range(n)]
maxdis[0] = 0
mugen = False
for i in range(2*n):
for j in e:
st,gl,cost = j
if (maxdis[gl] < maxdis... | n,m = list(map(int , input().split()))
e = []
for i in range(m):
a,b,c = list(map(int , input().split()))
e.append((a-1,b-1,c))
maxdis = [-float('inf') for i in range(n)]
maxdis[0] = 0
mugen = False
for i in range(n):
for j in e:
st,gl,cost = j
if (maxdis[gl] < maxdis[s... | 26 | 26 | 522 | 520 | n, m = list(map(int, input().split()))
e = []
for i in range(m):
a, b, c = list(map(int, input().split()))
e.append((a - 1, b - 1, c))
maxdis = [-float("inf") for i in range(n)]
maxdis[0] = 0
mugen = False
for i in range(2 * n):
for j in e:
st, gl, cost = j
if maxdis[gl] < maxdis[st] + cost:... | n, m = list(map(int, input().split()))
e = []
for i in range(m):
a, b, c = list(map(int, input().split()))
e.append((a - 1, b - 1, c))
maxdis = [-float("inf") for i in range(n)]
maxdis[0] = 0
mugen = False
for i in range(n):
for j in e:
st, gl, cost = j
if maxdis[gl] < maxdis[st] + cost:
... | false | 0 | [
"-for i in range(2 * n):",
"+for i in range(n):"
] | false | 0.068871 | 0.114839 | 0.599716 | [
"s586680427",
"s790388379"
] |
u823885866 | p02891 | python | s799008423 | s082397347 | 148 | 17 | 12,500 | 3,064 | Accepted | Accepted | 88.51 | import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: list(map(str, sys.stdin.buffer.readline().split()))
ri = lambda: int(sys.stdin.readline())
rm = lambda: list(map(int, sys.stdin.buffer.readline().split... | import sys
rr = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(sys.stdin.readline())
s = rr()
k = ri()
cnt = 0
i = 0
if len(set(s)) == 1:
print((int(len(s)*k/2)))
exit()
while i < len(s)-1:
if s[i] == s[i+1]:
cnt += 1
i += 1
i += 1
cnt1 = 0
i1 = 0
s *= 2
while i1 < len(s)-1... | 36 | 27 | 700 | 418 | import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: list(map(str, sys.stdin.buffer.readline().split()))
ri = lambda: int(sys.stdin.readline())
rm = lambda: list(map(int, sys.stdin.buffer.readline().split()))
rl = l... | import sys
rr = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(sys.stdin.readline())
s = rr()
k = ri()
cnt = 0
i = 0
if len(set(s)) == 1:
print((int(len(s) * k / 2)))
exit()
while i < len(s) - 1:
if s[i] == s[i + 1]:
cnt += 1
i += 1
i += 1
cnt1 = 0
i1 = 0
s *= 2
while i1 < len(s... | false | 25 | [
"-import math",
"-import itertools",
"-import collections",
"-import heapq",
"-import re",
"-import numpy as np",
"-rs = lambda: list(map(str, sys.stdin.buffer.readline().split()))",
"-rm = lambda: list(map(int, sys.stdin.buffer.readline().split()))",
"-rl = lambda: list(map(int, sys.stdin.buffer.re... | false | 0.074625 | 0.053058 | 1.406494 | [
"s799008423",
"s082397347"
] |
u279955105 | p02399 | python | s127722502 | s450156507 | 40 | 20 | 7,660 | 7,676 | Accepted | Accepted | 50 | a,b = list(map(int, input().split()))
d = int(a / b)
r = int(a % b)
f = a / b
print((str(d) + " " + str(r) + " " + str("{0:.10f}".format(f)))) | a,b = list(map(int, input().split()))
c = int(a / b)
d = a % b
e = a / b
print((str(c) + " " + str(d) + " "+"{0:.8f}".format(e))) | 5 | 6 | 144 | 133 | a, b = list(map(int, input().split()))
d = int(a / b)
r = int(a % b)
f = a / b
print((str(d) + " " + str(r) + " " + str("{0:.10f}".format(f))))
| a, b = list(map(int, input().split()))
c = int(a / b)
d = a % b
e = a / b
print((str(c) + " " + str(d) + " " + "{0:.8f}".format(e)))
| false | 16.666667 | [
"-d = int(a / b)",
"-r = int(a % b)",
"-f = a / b",
"-print((str(d) + \" \" + str(r) + \" \" + str(\"{0:.10f}\".format(f))))",
"+c = int(a / b)",
"+d = a % b",
"+e = a / b",
"+print((str(c) + \" \" + str(d) + \" \" + \"{0:.8f}\".format(e)))"
] | false | 0.037258 | 0.042655 | 0.873472 | [
"s127722502",
"s450156507"
] |
u970197315 | p03476 | python | s302163164 | s689099503 | 1,145 | 164 | 4,980 | 81,600 | Accepted | Accepted | 85.68 | def isPrime(x):
for i in range(2,int(x**0.5)+1):
if x%i==0:
return False
return True
q=int(eval(input()))
f=[1]*(10**5+1)
f[0],f[1]=0,0
n=len(f)
for i in range(2,n):
if isPrime(i):
for j in range(i*2,n,i):
f[j]=0
c=[0]*(10**5+1)
for i in range(2,10**5+1):
if i%2==1:
i... | from itertools import accumulate
import sys
input = sys.stdin.buffer.readline
def sieve(n):
f = []
is_prime = [True]*(n+1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5)+1):
if not is_prime[i]:
continue
for j in range(i*2, n+1, i):
... | 27 | 39 | 500 | 784 | def isPrime(x):
for i in range(2, int(x**0.5) + 1):
if x % i == 0:
return False
return True
q = int(eval(input()))
f = [1] * (10**5 + 1)
f[0], f[1] = 0, 0
n = len(f)
for i in range(2, n):
if isPrime(i):
for j in range(i * 2, n, i):
f[j] = 0
c = [0] * (10**5 + 1)
for... | from itertools import accumulate
import sys
input = sys.stdin.buffer.readline
def sieve(n):
f = []
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, n + 1, i):
... | false | 30.769231 | [
"-def isPrime(x):",
"- for i in range(2, int(x**0.5) + 1):",
"- if x % i == 0:",
"- return False",
"- return True",
"+from itertools import accumulate",
"+import sys",
"+",
"+input = sys.stdin.buffer.readline",
"-q = int(eval(input()))",
"-f = [1] * (10**5 + 1)",
"-f[0]... | false | 0.725763 | 0.091474 | 7.934052 | [
"s302163164",
"s689099503"
] |
u445624660 | p02780 | python | s050849727 | s683347790 | 274 | 227 | 24,804 | 24,804 | Accepted | Accepted | 17.15 | # きりみんちゃんの配信をみてたので期待値は分かる
# 素直にTLEくらったので累積和で加減する
# え これでもだめなの
# あほだった sumしてるし
# 単純にみたら 0.5ずつ増えてるのでそうするか
# 1WA...
# N = 1の場合か?
n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
table = {}
ans = 0
for i in range(1, 1000 + 1):
table[i] = (i + 1) * 0.5
if n == 1:
print((... | # 和の期待値は期待値の和
# それぞれ期待値を出したあとは大きさKの区間和の最大値
# n(n+1)/2
n, k = list(map(int, input().split()))
p = []
for x in list(map(int, input().split())):
p.append((x * (x + 1) // 2) / x)
ans = 0
tmp = 0
for i in range(n):
tmp += p[i]
if i >= k:
tmp -= p[i - k]
ans = max(ans, tmp)
print(ans... | 27 | 17 | 613 | 315 | # きりみんちゃんの配信をみてたので期待値は分かる
# 素直にTLEくらったので累積和で加減する
# え これでもだめなの
# あほだった sumしてるし
# 単純にみたら 0.5ずつ増えてるのでそうするか
# 1WA...
# N = 1の場合か?
n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
table = {}
ans = 0
for i in range(1, 1000 + 1):
table[i] = (i + 1) * 0.5
if n == 1:
print((table[arr[0]]))
... | # 和の期待値は期待値の和
# それぞれ期待値を出したあとは大きさKの区間和の最大値
# n(n+1)/2
n, k = list(map(int, input().split()))
p = []
for x in list(map(int, input().split())):
p.append((x * (x + 1) // 2) / x)
ans = 0
tmp = 0
for i in range(n):
tmp += p[i]
if i >= k:
tmp -= p[i - k]
ans = max(ans, tmp)
print(ans)
| false | 37.037037 | [
"-# きりみんちゃんの配信をみてたので期待値は分かる",
"-# 素直にTLEくらったので累積和で加減する",
"-# え これでもだめなの",
"-# あほだった sumしてるし",
"-# 単純にみたら 0.5ずつ増えてるのでそうするか",
"-# 1WA...",
"-# N = 1の場合か?",
"+# 和の期待値は期待値の和",
"+# それぞれ期待値を出したあとは大きさKの区間和の最大値",
"+# n(n+1)/2",
"-arr = list(map(int, input().split()))",
"-table = {}",
"+p = []",
"+... | false | 0.082918 | 0.042897 | 1.932977 | [
"s050849727",
"s683347790"
] |
u683956577 | p03163 | python | s019211366 | s835681334 | 480 | 343 | 120,300 | 41,708 | Accepted | Accepted | 28.54 | import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
n, W = na()
w = []
v = []
for i in range(n):
x,y = list(map(int,input().split()))
w.append(x)
v.append(y)
dp = [[0]*(... | import sys
input = sys.stdin.readline
n,w = list(map(int,input().split()))
wv = [tuple(map(int,input().split())) for i in range(n)]
dp = [0]*(w+1)
for i in range(n):
for j in range(w,wv[i][0]-1,-1):
dp[j] = max(dp[j],dp[j-wv[i][0]]+wv[i][1])
print((max(dp))) | 27 | 11 | 543 | 274 | import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
n, W = na()
w = []
v = []
for i in range(n):
x, y = list(map(int, input().split()))
w.append(x)
v.append(y)
dp = [[0] * (W + 1) for i in... | import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
wv = [tuple(map(int, input().split())) for i in range(n)]
dp = [0] * (w + 1)
for i in range(n):
for j in range(w, wv[i][0] - 1, -1):
dp[j] = max(dp[j], dp[j - wv[i][0]] + wv[i][1])
print((max(dp)))
| false | 59.259259 | [
"-stdin = sys.stdin",
"-ni = lambda: int(ns())",
"-na = lambda: list(map(int, stdin.readline().split()))",
"-ns = lambda: stdin.readline().rstrip() # ignore trailing spaces",
"-n, W = na()",
"-w = []",
"-v = []",
"+input = sys.stdin.readline",
"+n, w = list(map(int, input().split()))",
"+wv = [tu... | false | 0.040049 | 0.038872 | 1.030262 | [
"s019211366",
"s835681334"
] |
u437351386 | p02642 | python | s535289321 | s939597075 | 876 | 429 | 92,804 | 55,212 | Accepted | Accepted | 51.03 | #エラストテネスのふるいを用いることを考える
#出たものの倍数をいれるダメリストを準備しておく。
#各a[i]についてダメリストに入っていないものが求める個数である
#同じものが複数回出てくるもの(Counterを使えばいい)に関してはダメリストにその数もいれれば良い
from collections import Counter
n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
min_a=a[0]
max_a=a[n-1]
#同じものが複数回出てくるもののcheck
dic=Counter(a)
#別リスト
check=set(... | n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
k=max(a)
num_list=set()
prime_list=set()
from collections import Counter
dic=Counter(a)
a=set(a)
for i in dic:
if dic[i]>=2:
dic[i]=0
if i not in num_list:
for j in range(i*2,k+1,i):
if j in a:
dic[j]=0
... | 31 | 25 | 575 | 373 | # エラストテネスのふるいを用いることを考える
# 出たものの倍数をいれるダメリストを準備しておく。
# 各a[i]についてダメリストに入っていないものが求める個数である
# 同じものが複数回出てくるもの(Counterを使えばいい)に関してはダメリストにその数もいれれば良い
from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
min_a = a[0]
max_a = a[n - 1]
# 同じものが複数回出てくるもののcheck
dic = Counter(a)
# 別リスト
che... | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
k = max(a)
num_list = set()
prime_list = set()
from collections import Counter
dic = Counter(a)
a = set(a)
for i in dic:
if dic[i] >= 2:
dic[i] = 0
if i not in num_list:
for j in range(i * 2, k + 1, i):
if j in a:
... | false | 19.354839 | [
"-# エラストテネスのふるいを用いることを考える",
"-# 出たものの倍数をいれるダメリストを準備しておく。",
"-# 各a[i]についてダメリストに入っていないものが求める個数である",
"-# 同じものが複数回出てくるもの(Counterを使えばいい)に関してはダメリストにその数もいれれば良い",
"-from collections import Counter",
"-",
"-min_a = a[0]",
"-max_a = a[n - 1]",
"-# 同じものが複数回出てくるもののcheck",
"+k = max(a)",
"+num_list = set()",... | false | 0.035425 | 0.058542 | 0.605119 | [
"s535289321",
"s939597075"
] |
u627803856 | p02623 | python | s076990557 | s165019156 | 190 | 146 | 111,300 | 118,304 | Accepted | Accepted | 23.16 | n, m, k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
MAX = 10 ** 18
# 累積和
accA, accB = [0] * (n + 1), [0] * (m + 1)
accA[1], accB[1] = A[0], B[0]
for i in range(2, n + 1):
accA[i] = accA[i - 1] + A[i - 1]
for i in range(2, m + 1):
accB[i... | n, m, k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
t = sum(B)
# しゃくとり法
res = 0
j = m
for i in range(n + 1):
while j > 0 and t > k:
j -= 1
t -= B[j]
if t > k:
break
res = max(res, i + j)
if i == n: br... | 25 | 20 | 596 | 346 | n, m, k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
MAX = 10**18
# 累積和
accA, accB = [0] * (n + 1), [0] * (m + 1)
accA[1], accB[1] = A[0], B[0]
for i in range(2, n + 1):
accA[i] = accA[i - 1] + A[i - 1]
for i in range(2, m + 1):
accB[i] = accB[i - 1] ... | n, m, k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
t = sum(B)
# しゃくとり法
res = 0
j = m
for i in range(n + 1):
while j > 0 and t > k:
j -= 1
t -= B[j]
if t > k:
break
res = max(res, i + j)
if i == n:
break
t ... | false | 20 | [
"-MAX = 10**18",
"-# 累積和",
"-accA, accB = [0] * (n + 1), [0] * (m + 1)",
"-accA[1], accB[1] = A[0], B[0]",
"-for i in range(2, n + 1):",
"- accA[i] = accA[i - 1] + A[i - 1]",
"-for i in range(2, m + 1):",
"- accB[i] = accB[i - 1] + B[i - 1]",
"-accA.append(MAX)",
"-accB.append(MAX)",
"-fro... | false | 0.044481 | 0.043298 | 1.027316 | [
"s076990557",
"s165019156"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.