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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u604839890 | p03160 | python | s528031338 | s660601950 | 124 | 111 | 20,528 | 20,620 | Accepted | Accepted | 10.48 | N = int(eval(input()))
h = list(map(int, input().split()))
DP = [0, abs(h[0]-h[1])]
for i in range(N-2):
DP += [min(DP[-2] + abs(h[i]-h[i+2]), DP[-1] + abs(h[i+1]-h[i+2]))]
print((DP[-1])) | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0, abs(h[1]-h[0])]
for i in range(2, n):
dp.append(min(dp[-2]+abs(h[i]-h[i-2]), dp[-1]+abs(h[i]-h[i-1])))
print((dp[-1])) | 8 | 7 | 195 | 187 | N = int(eval(input()))
h = list(map(int, input().split()))
DP = [0, abs(h[0] - h[1])]
for i in range(N - 2):
DP += [min(DP[-2] + abs(h[i] - h[i + 2]), DP[-1] + abs(h[i + 1] - h[i + 2]))]
print((DP[-1]))
| n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0, abs(h[1] - h[0])]
for i in range(2, n):
dp.append(min(dp[-2] + abs(h[i] - h[i - 2]), dp[-1] + abs(h[i] - h[i - 1])))
print((dp[-1]))
| false | 12.5 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-DP = [0, abs(h[0] - h[1])]",
"-for i in range(N - 2):",
"- DP += [min(DP[-2] + abs(h[i] - h[i + 2]), DP[-1] + abs(h[i + 1] - h[i + 2]))]",
"-print((DP[-1]))",
"+dp = [0, abs(h[1] - h[0])]",
"+for i in range(2, n):",
"+ dp.append(min(dp[-2... | false | 0.055065 | 0.065885 | 0.83577 | [
"s528031338",
"s660601950"
] |
u602972961 | p02619 | python | s400661821 | s601013498 | 142 | 34 | 27,296 | 9,348 | Accepted | Accepted | 76.06 | import numpy as np
D=int(eval(input()))
c=[int(i) for i in input().split()]
s=[]
for d in range(D):
s.append([int(i) for i in input().split()])
t=[]
for d in range(D):
t.append(int(eval(input())) - 1)
v = [0]*D
last = [[0 for i in range(26)] for d in range(D)]
for d in range(D):
if d>=1:... | D=int(eval(input()))
c=[int(i) for i in input().split()]
s=[]
for d in range(D):
s.append([int(i) for i in input().split()])
t=[]
for d in range(D):
t.append(int(eval(input())) - 1)
v = [0]*D
last = [[0 for i in range(26)] for d in range(D)]
for d in range(D):
if d>=1:
last[d] = la... | 27 | 25 | 528 | 506 | import numpy as np
D = int(eval(input()))
c = [int(i) for i in input().split()]
s = []
for d in range(D):
s.append([int(i) for i in input().split()])
t = []
for d in range(D):
t.append(int(eval(input())) - 1)
v = [0] * D
last = [[0 for i in range(26)] for d in range(D)]
for d in range(D):
if d >= 1:
... | D = int(eval(input()))
c = [int(i) for i in input().split()]
s = []
for d in range(D):
s.append([int(i) for i in input().split()])
t = []
for d in range(D):
t.append(int(eval(input())) - 1)
v = [0] * D
last = [[0 for i in range(26)] for d in range(D)]
for d in range(D):
if d >= 1:
last[d] = last[d -... | false | 7.407407 | [
"-import numpy as np",
"-"
] | false | 0.047941 | 0.077018 | 0.622472 | [
"s400661821",
"s601013498"
] |
u347600233 | p02596 | python | s845857722 | s922795144 | 329 | 180 | 48,280 | 9,128 | Accepted | Accepted | 45.29 | k = int(eval(input()))
ans = -1
a = [7%k] * k
for i in range(k - 1):
a[i + 1] = (10*a[i] + 7) % k
for i in range(k):
if a[i] == 0:
ans = i + 1
break
print(ans) | k = int(eval(input()))
ans = -1
a = 7%k
for i in range(k):
if a == 0:
ans = i + 1
break
a = (10*a + 7) % k
print(ans) | 10 | 9 | 186 | 143 | k = int(eval(input()))
ans = -1
a = [7 % k] * k
for i in range(k - 1):
a[i + 1] = (10 * a[i] + 7) % k
for i in range(k):
if a[i] == 0:
ans = i + 1
break
print(ans)
| k = int(eval(input()))
ans = -1
a = 7 % k
for i in range(k):
if a == 0:
ans = i + 1
break
a = (10 * a + 7) % k
print(ans)
| false | 10 | [
"-a = [7 % k] * k",
"-for i in range(k - 1):",
"- a[i + 1] = (10 * a[i] + 7) % k",
"+a = 7 % k",
"- if a[i] == 0:",
"+ if a == 0:",
"+ a = (10 * a + 7) % k"
] | false | 0.322492 | 0.062481 | 5.161454 | [
"s845857722",
"s922795144"
] |
u556389276 | p02757 | python | s224970983 | s105603817 | 150 | 138 | 3,500 | 6,560 | Accepted | Accepted | 8 | n,p = tuple(map(int,input().split()))
s = eval(input())
modlist = [0]*p
modlist[0] = 1
if p!= 2 and p != 5:
mod = 0
pwrmod = 1
for i in s[::-1]:
mod = (mod + pwrmod * int(i)) % p
pwrmod = (pwrmod * 10) % p
modlist[mod] += 1
ans = 0
for i in modlist:
ans +... | n,p = tuple(int(x) for x in input().split())
s = [int(s) for s in eval(input())][::-1]
modlist = [0]*p
modlist[0] = 1
if p!= 2 and p != 5:
mod = 0
pwrmod = 1
for i in s:
mod = (mod + pwrmod * i) % p
pwrmod = (pwrmod * 10) % p
modlist[mod] += 1
ans = 0
for i in mod... | 22 | 22 | 467 | 482 | n, p = tuple(map(int, input().split()))
s = eval(input())
modlist = [0] * p
modlist[0] = 1
if p != 2 and p != 5:
mod = 0
pwrmod = 1
for i in s[::-1]:
mod = (mod + pwrmod * int(i)) % p
pwrmod = (pwrmod * 10) % p
modlist[mod] += 1
ans = 0
for i in modlist:
ans += (i * (... | n, p = tuple(int(x) for x in input().split())
s = [int(s) for s in eval(input())][::-1]
modlist = [0] * p
modlist[0] = 1
if p != 2 and p != 5:
mod = 0
pwrmod = 1
for i in s:
mod = (mod + pwrmod * i) % p
pwrmod = (pwrmod * 10) % p
modlist[mod] += 1
ans = 0
for i in modlist:
... | false | 0 | [
"-n, p = tuple(map(int, input().split()))",
"-s = eval(input())",
"+n, p = tuple(int(x) for x in input().split())",
"+s = [int(s) for s in eval(input())][::-1]",
"- for i in s[::-1]:",
"- mod = (mod + pwrmod * int(i)) % p",
"+ for i in s:",
"+ mod = (mod + pwrmod * i) % p",
"- ... | false | 0.042286 | 0.077465 | 0.545869 | [
"s224970983",
"s105603817"
] |
u222668979 | p02579 | python | s522865461 | s627405235 | 1,377 | 1,263 | 99,736 | 97,240 | Accepted | Accepted | 8.28 | from collections import deque
from itertools import product
def bfs(x, y):
dist = [[10 ** 9] * w for _ in range(h)]
dist[y][x] = 0
for i, si in enumerate(s):
for j, sij in enumerate(si):
if sij == '#':
dist[i][j] = -1
que = deque([(x, y)])
while le... | from collections import deque
from itertools import product
def bfs(x, y):
dist = [[10 ** 9] * w for _ in range(h)]
dist[y][x] = 0
que = deque([(x, y)])
while len(que) > 0:
x, y = que.popleft()
near_a = [(x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)]
num = product... | 38 | 35 | 1,201 | 1,086 | from collections import deque
from itertools import product
def bfs(x, y):
dist = [[10**9] * w for _ in range(h)]
dist[y][x] = 0
for i, si in enumerate(s):
for j, sij in enumerate(si):
if sij == "#":
dist[i][j] = -1
que = deque([(x, y)])
while len(que) > 0:
... | from collections import deque
from itertools import product
def bfs(x, y):
dist = [[10**9] * w for _ in range(h)]
dist[y][x] = 0
que = deque([(x, y)])
while len(que) > 0:
x, y = que.popleft()
near_a = [(x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)]
num = product([-2, -1, 0, 1,... | false | 7.894737 | [
"- for i, si in enumerate(s):",
"- for j, sij in enumerate(si):",
"- if sij == \"#\":",
"- dist[i][j] = -1",
"+ if (x, y) == (Dw - 1, Dh - 1):",
"+ return dist[y][x]",
"- return dist",
"+ return -1",
"-ans = bfs(Cw - 1, Ch - 1)[Dh - 1][Dw -... | false | 0.038414 | 0.039626 | 0.969409 | [
"s522865461",
"s627405235"
] |
u241159583 | p03341 | python | s464982215 | s392576649 | 265 | 214 | 17,720 | 21,128 | Accepted | Accepted | 19.25 | n = int(eval(input()))
s = list(eval(input()))
# EりーだーW
cnt = [0] * (n+1)
for i in range(1, n+1):
cnt[i] += cnt[i-1]
if s[i-1] == "E": cnt[i] += 1
ans = float("INF")
for i in range(1,n+1):
a = ((i-1) - cnt[i-1]) + (cnt[-1] - cnt[i])
if ans > a: ans = a
print(ans) | n = int(eval(input()))
s = eval(input())
# E:右 W:左
cnt = [0] * (n+1)
for i in range(1, n+1):
cnt[i] += cnt[i-1]
if s[i-1] == "E": cnt[i] += 1
ans = float("INF")
for i in range(1,n+1):
a = ((i-1) - cnt[i-1]) + (cnt[-1]-cnt[i])
if ans > a: ans = a
print(ans) | 13 | 14 | 280 | 275 | n = int(eval(input()))
s = list(eval(input()))
# EりーだーW
cnt = [0] * (n + 1)
for i in range(1, n + 1):
cnt[i] += cnt[i - 1]
if s[i - 1] == "E":
cnt[i] += 1
ans = float("INF")
for i in range(1, n + 1):
a = ((i - 1) - cnt[i - 1]) + (cnt[-1] - cnt[i])
if ans > a:
ans = a
print(ans)
| n = int(eval(input()))
s = eval(input())
# E:右 W:左
cnt = [0] * (n + 1)
for i in range(1, n + 1):
cnt[i] += cnt[i - 1]
if s[i - 1] == "E":
cnt[i] += 1
ans = float("INF")
for i in range(1, n + 1):
a = ((i - 1) - cnt[i - 1]) + (cnt[-1] - cnt[i])
if ans > a:
ans = a
print(ans)
| false | 7.142857 | [
"-s = list(eval(input()))",
"-# EりーだーW",
"+s = eval(input())",
"+# E:右 W:左"
] | false | 0.039194 | 0.043175 | 0.9078 | [
"s464982215",
"s392576649"
] |
u648212584 | p03682 | python | s498553182 | s668020475 | 1,274 | 1,117 | 72,536 | 54,952 | Accepted | Accepted | 12.32 | import heapq
import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
x,y = [],[]
root = [[] for _ in range(N)]
go = [True for _ in range(N)]
for i in range(N):
_x,_y = list(map(int,input().split()))
x.append((_x,i))
y.append((_y,i))
... | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
rx,ry = [],[]
_root = []
for i in range(N):
a,b = list(map(int,input().split()))
rx.append((a,i))
ry.append((b,i))
I = [i for i in range(N)]
rank = [1 for _ in range(N)]
def r... | 43 | 52 | 1,049 | 1,161 | import heapq
import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
x, y = [], []
root = [[] for _ in range(N)]
go = [True for _ in range(N)]
for i in range(N):
_x, _y = list(map(int, input().split()))
x.append((_x, i))
y.append((_y, i))
x.sort()
... | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
rx, ry = [], []
_root = []
for i in range(N):
a, b = list(map(int, input().split()))
rx.append((a, i))
ry.append((b, i))
I = [i for i in range(N)]
rank = [1 for _ in range(N)]
def root(x):
... | false | 17.307692 | [
"-import heapq",
"- x, y = [], []",
"- root = [[] for _ in range(N)]",
"- go = [True for _ in range(N)]",
"+ rx, ry = [], []",
"+ _root = []",
"- _x, _y = list(map(int, input().split()))",
"- x.append((_x, i))",
"- y.append((_y, i))",
"- x.sort()",
"- y.... | false | 0.082314 | 0.119993 | 0.685991 | [
"s498553182",
"s668020475"
] |
u921617614 | p02676 | python | s851723578 | s801510176 | 31 | 27 | 9,016 | 9,076 | Accepted | Accepted | 12.9 | k=int(eval(input()))
s=eval(input())
print((s[:k]+"{0}".format("..."*(len(s)>k)))) | k,s=open(0)
k=int(k)
print((s[:k]+'...'*(len(s)-1>k)))
| 3 | 3 | 70 | 55 | k = int(eval(input()))
s = eval(input())
print((s[:k] + "{0}".format("..." * (len(s) > k))))
| k, s = open(0)
k = int(k)
print((s[:k] + "..." * (len(s) - 1 > k)))
| false | 0 | [
"-k = int(eval(input()))",
"-s = eval(input())",
"-print((s[:k] + \"{0}\".format(\"...\" * (len(s) > k))))",
"+k, s = open(0)",
"+k = int(k)",
"+print((s[:k] + \"...\" * (len(s) - 1 > k)))"
] | false | 0.036876 | 0.038656 | 0.953946 | [
"s851723578",
"s801510176"
] |
u869919400 | p02818 | python | s253316060 | s443952145 | 167 | 30 | 38,256 | 9,064 | Accepted | Accepted | 82.04 | A, B, K = list(map(int, input().split()))
if A < K:
print((0))
if B < K-A:
print((0))
else:
print((B-(K-A)))
else:
print((A-K))
print(B)
| a,b,k=list(map(int,input().split()))
t=min(a,k)
s=min(b,k-t)
print((a-t,b-s)) | 11 | 4 | 170 | 72 | A, B, K = list(map(int, input().split()))
if A < K:
print((0))
if B < K - A:
print((0))
else:
print((B - (K - A)))
else:
print((A - K))
print(B)
| a, b, k = list(map(int, input().split()))
t = min(a, k)
s = min(b, k - t)
print((a - t, b - s))
| false | 63.636364 | [
"-A, B, K = list(map(int, input().split()))",
"-if A < K:",
"- print((0))",
"- if B < K - A:",
"- print((0))",
"- else:",
"- print((B - (K - A)))",
"-else:",
"- print((A - K))",
"- print(B)",
"+a, b, k = list(map(int, input().split()))",
"+t = min(a, k)",
"+s = m... | false | 0.041905 | 0.035779 | 1.171232 | [
"s253316060",
"s443952145"
] |
u274819371 | p03545 | python | s781003647 | s550864339 | 182 | 18 | 38,256 | 3,064 | Accepted | Accepted | 90.11 | n = list(map(int,input().rstrip()))
for i in range(2**3):
ope = []
ans = n[0]
for j in range(3):
if (i >> j) & 1:
ope.append("+")
ans += n[j+1]
else:
ope.append("-")
ans -= n[j+1]
if ans == 7:
res = [ope[i]+str(n[1+i]) for i in range(3)]
res = "".join(res)
... | n = list(map(int,input().rstrip()))
for i in range(2**3):
ope = ["-"] * 3
ans = n[0]
for j in range(3):
if (i >> j) & 1:
ope[j] = "+"
ans += n[j+1]
else:
ans -= n[j+1]
if ans == 7:
res = [ope[i]+str(n[1+i]) for i in range(3)]
res = "".join(res)
res = str(n[0]) ... | 17 | 16 | 378 | 359 | n = list(map(int, input().rstrip()))
for i in range(2**3):
ope = []
ans = n[0]
for j in range(3):
if (i >> j) & 1:
ope.append("+")
ans += n[j + 1]
else:
ope.append("-")
ans -= n[j + 1]
if ans == 7:
res = [ope[i] + str(n[1 + i]) for ... | n = list(map(int, input().rstrip()))
for i in range(2**3):
ope = ["-"] * 3
ans = n[0]
for j in range(3):
if (i >> j) & 1:
ope[j] = "+"
ans += n[j + 1]
else:
ans -= n[j + 1]
if ans == 7:
res = [ope[i] + str(n[1 + i]) for i in range(3)]
r... | false | 5.882353 | [
"- ope = []",
"+ ope = [\"-\"] * 3",
"- ope.append(\"+\")",
"+ ope[j] = \"+\"",
"- ope.append(\"-\")"
] | false | 0.065204 | 0.033513 | 1.945636 | [
"s781003647",
"s550864339"
] |
u608088992 | p02879 | python | s528422831 | s267009409 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | A, B = list(map(int, input().split()))
if A <= 9 and B <= 9: print((A * B))
else: print((-1)) | import sys
def solve():
input = sys.stdin.readline
A, B = list(map(int, input().split()))
if A < 10 and B < 10: print((A * B))
else: print((-1))
return 0
if __name__ == "__main__":
solve() | 3 | 12 | 85 | 216 | A, B = list(map(int, input().split()))
if A <= 9 and B <= 9:
print((A * B))
else:
print((-1))
| import sys
def solve():
input = sys.stdin.readline
A, B = list(map(int, input().split()))
if A < 10 and B < 10:
print((A * B))
else:
print((-1))
return 0
if __name__ == "__main__":
solve()
| false | 75 | [
"-A, B = list(map(int, input().split()))",
"-if A <= 9 and B <= 9:",
"- print((A * B))",
"-else:",
"- print((-1))",
"+import sys",
"+",
"+",
"+def solve():",
"+ input = sys.stdin.readline",
"+ A, B = list(map(int, input().split()))",
"+ if A < 10 and B < 10:",
"+ print(... | false | 0.082281 | 0.058195 | 1.413892 | [
"s528422831",
"s267009409"
] |
u318127926 | p03660 | python | s658847259 | s252395115 | 556 | 357 | 134,864 | 27,852 | Accepted | Accepted | 35.79 | import sys
sys.setrecursionlimit(10**6)
n = int(eval(input()))
graph = [[] for _ in range(n)]
for _ in range(n-1):
a, b = list(map(int, input().split()))
graph[a-1].append(b-1)
graph[b-1].append(a-1)
pre = [None]*n
def dfs(node, p_node=-1):
for c_node in graph[node]:
if c_node==p_node... | from collections import deque
n = int(eval(input()))
graph = [[] for _ in range(n)]
for _ in range(n-1):
a, b = list(map(int, input().split()))
graph[a-1].append(b-1)
graph[b-1].append(a-1)
cnt = [1, 1]
q = deque([(0, 0), (n-1, 1)])
seen = [False]*n
seen[0] = seen[n-1] = True
while q:
node, ... | 31 | 20 | 772 | 534 | import sys
sys.setrecursionlimit(10**6)
n = int(eval(input()))
graph = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = list(map(int, input().split()))
graph[a - 1].append(b - 1)
graph[b - 1].append(a - 1)
pre = [None] * n
def dfs(node, p_node=-1):
for c_node in graph[node]:
if c_node == ... | from collections import deque
n = int(eval(input()))
graph = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = list(map(int, input().split()))
graph[a - 1].append(b - 1)
graph[b - 1].append(a - 1)
cnt = [1, 1]
q = deque([(0, 0), (n - 1, 1)])
seen = [False] * n
seen[0] = seen[n - 1] = True
while q:
n... | false | 35.483871 | [
"-import sys",
"+from collections import deque",
"-sys.setrecursionlimit(10**6)",
"-pre = [None] * n",
"-",
"-",
"-def dfs(node, p_node=-1):",
"+cnt = [1, 1]",
"+q = deque([(0, 0), (n - 1, 1)])",
"+seen = [False] * n",
"+seen[0] = seen[n - 1] = True",
"+while q:",
"+ node, turn = q.poplef... | false | 0.046241 | 0.080108 | 0.577233 | [
"s658847259",
"s252395115"
] |
u207241407 | p02678 | python | s910552822 | s749225718 | 514 | 386 | 34,684 | 34,968 | Accepted | Accepted | 24.9 | import sys
from collections import deque
n, m = list(map(int, sys.stdin.readline().split()))
to = [[] for _ in range(n + 1)]
for _ in range(m):
a, b = list(map(int, sys.stdin.readline().split()))
to[a].append(b)
to[b].append(a)
INF = float("inf")
dist = [INF] * (n + 1)
dist[1] = 0
pre = [0]... | import sys
from collections import deque
def main():
n, m = list(map(int, sys.stdin.readline().split()))
to = [[] for _ in range(n + 1)]
for _ in range(m):
a, b = list(map(int, sys.stdin.readline().split()))
to[a].append(b)
to[b].append(a)
INF = float("inf")
... | 29 | 35 | 591 | 738 | import sys
from collections import deque
n, m = list(map(int, sys.stdin.readline().split()))
to = [[] for _ in range(n + 1)]
for _ in range(m):
a, b = list(map(int, sys.stdin.readline().split()))
to[a].append(b)
to[b].append(a)
INF = float("inf")
dist = [INF] * (n + 1)
dist[1] = 0
pre = [0] * (n + 1)
que =... | import sys
from collections import deque
def main():
n, m = list(map(int, sys.stdin.readline().split()))
to = [[] for _ in range(n + 1)]
for _ in range(m):
a, b = list(map(int, sys.stdin.readline().split()))
to[a].append(b)
to[b].append(a)
INF = float("inf")
dist = [INF] * ... | false | 17.142857 | [
"-n, m = list(map(int, sys.stdin.readline().split()))",
"-to = [[] for _ in range(n + 1)]",
"-for _ in range(m):",
"- a, b = list(map(int, sys.stdin.readline().split()))",
"- to[a].append(b)",
"- to[b].append(a)",
"-INF = float(\"inf\")",
"-dist = [INF] * (n + 1)",
"-dist[1] = 0",
"-pre =... | false | 0.039605 | 0.040177 | 0.985773 | [
"s910552822",
"s749225718"
] |
u909643606 | p03078 | python | s057241209 | s758314850 | 1,331 | 495 | 112,348 | 105,100 | Accepted | Accepted | 62.81 |
def main():
x,y,z,k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans = []
for i in range(x):
... |
x,y,z,k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans=[]
for i in range(x):
if i > k:
break
for j in range(y):
... | 30 | 26 | 656 | 539 | def main():
x, y, z, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans = []
for i in range(x):
if i > k:
... | x, y, z, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans = []
for i in range(x):
if i > k:
break
for j in range(y):
if i * j ... | false | 13.333333 | [
"-def main():",
"- x, y, z, k = [int(i) for i in input().split()]",
"- a = [int(i) for i in input().split()]",
"- b = [int(i) for i in input().split()]",
"- c = [int(i) for i in input().split()]",
"- a.sort(reverse=True)",
"- b.sort(reverse=True)",
"- c.sort(reverse=True)",
"- ... | false | 0.047091 | 0.045 | 1.046463 | [
"s057241209",
"s758314850"
] |
u729133443 | p02913 | python | s435435601 | s670167160 | 61 | 49 | 4,208 | 4,196 | Accepted | Accepted | 19.67 | class RollingHash():
def __init__(self,s):
self.n=n=len(s)
self.b=b=129
self.M=M=2**61-1
x,y=1,0
self.f=f=[x]*(n+1)
self.h=h=[y]*(n+1)
for i,c in enumerate(s.encode()):
f[i+1]=x=x*b%M
h[i+1]=y=(y*b+c)%M
def get(self,l,r):... | def main():
import sys
input=sys.stdin.buffer.readline
n=int(eval(input()))
b=129
M=2**61-1
x,y=1,0
f=[x]*(n+2)
h=[y]*(n+2)
for i,c in enumerate(eval(input())):
f[i+1]=x=x*b%M
h[i+1]=y=(y*b+c)%M
ok,ng=0,n//2+1
while ng-ok>1:
mid=ok+ng>>1
... | 32 | 28 | 787 | 610 | class RollingHash:
def __init__(self, s):
self.n = n = len(s)
self.b = b = 129
self.M = M = 2**61 - 1
x, y = 1, 0
self.f = f = [x] * (n + 1)
self.h = h = [y] * (n + 1)
for i, c in enumerate(s.encode()):
f[i + 1] = x = x * b % M
h[i + 1]... | def main():
import sys
input = sys.stdin.buffer.readline
n = int(eval(input()))
b = 129
M = 2**61 - 1
x, y = 1, 0
f = [x] * (n + 2)
h = [y] * (n + 2)
for i, c in enumerate(eval(input())):
f[i + 1] = x = x * b % M
h[i + 1] = y = (y * b + c) % M
ok, ng = 0, n // 2 ... | false | 12.5 | [
"-class RollingHash:",
"- def __init__(self, s):",
"- self.n = n = len(s)",
"- self.b = b = 129",
"- self.M = M = 2**61 - 1",
"- x, y = 1, 0",
"- self.f = f = [x] * (n + 1)",
"- self.h = h = [y] * (n + 1)",
"- for i, c in enumerate(s.encode()):",
... | false | 0.035893 | 0.114268 | 0.314114 | [
"s435435601",
"s670167160"
] |
u564902833 | p03050 | python | s751935006 | s349713149 | 186 | 123 | 38,896 | 3,060 | Accepted | Accepted | 33.87 | N = int(eval(input()))
ans = sum(
(N - q) // q
for q in range(1, int(N**0.5) + 1)
if (N - q) % q == 0 and N // ((N - q) // q) == N % ((N - q) // q)
) if N >= 2 else 0
print(ans) | # 入力
N = int(eval(input()))
# sqrt(N) + 1 より大きい N の約数dについて、 d - 1 がお気に入りの数か
# 判定し、お気に入りの数であるものの和を解とする
ans = sum(
N // d - 1
for d in range(1, int(N**0.5) + 1)
if N % d == 0 and N // d > 1 and (N // (N // d - 1)) == (N % (N // d - 1))
)
# 出力
print(ans)
| 7 | 13 | 189 | 272 | N = int(eval(input()))
ans = (
sum(
(N - q) // q
for q in range(1, int(N**0.5) + 1)
if (N - q) % q == 0 and N // ((N - q) // q) == N % ((N - q) // q)
)
if N >= 2
else 0
)
print(ans)
| # 入力
N = int(eval(input()))
# sqrt(N) + 1 より大きい N の約数dについて、 d - 1 がお気に入りの数か
# 判定し、お気に入りの数であるものの和を解とする
ans = sum(
N // d - 1
for d in range(1, int(N**0.5) + 1)
if N % d == 0 and N // d > 1 and (N // (N // d - 1)) == (N % (N // d - 1))
)
# 出力
print(ans)
| false | 46.153846 | [
"+# 入力",
"-ans = (",
"- sum(",
"- (N - q) // q",
"- for q in range(1, int(N**0.5) + 1)",
"- if (N - q) % q == 0 and N // ((N - q) // q) == N % ((N - q) // q)",
"- )",
"- if N >= 2",
"- else 0",
"+# sqrt(N) + 1 より大きい N の約数dについて、 d - 1 がお気に入りの数か",
"+# 判定し、お気に入りの数であ... | false | 0.224159 | 0.617661 | 0.362916 | [
"s751935006",
"s349713149"
] |
u388927326 | p02819 | python | s068358645 | s904552587 | 342 | 61 | 79,216 | 6,432 | Accepted | Accepted | 82.16 | #!/usr/bin/env python3
def main():
x = int(eval(input()))
primes = furui(300000)
for p in primes:
if x <= p:
print(p)
return
raise ValueError
# https://mathtrain.jp/eratosthenes
def furui(nmax):
assert nmax > 2
p = 2
primes = list(range(2, nma... | #!/usr/bin/env python3
def main():
x = int(eval(input()))
primes = sieve(300000)
for p in primes:
if x <= p:
print(p)
return
raise ValueError
# O(nloglogn) https://mathtrain.jp/eratosthenes
def sieve(n): # exclusive
s = [True] * n
for x in range(2... | 29 | 22 | 646 | 511 | #!/usr/bin/env python3
def main():
x = int(eval(input()))
primes = furui(300000)
for p in primes:
if x <= p:
print(p)
return
raise ValueError
# https://mathtrain.jp/eratosthenes
def furui(nmax):
assert nmax > 2
p = 2
primes = list(range(2, nmax + 1))
whi... | #!/usr/bin/env python3
def main():
x = int(eval(input()))
primes = sieve(300000)
for p in primes:
if x <= p:
print(p)
return
raise ValueError
# O(nloglogn) https://mathtrain.jp/eratosthenes
def sieve(n): # exclusive
s = [True] * n
for x in range(2, int(n**0.5) ... | false | 24.137931 | [
"- primes = furui(300000)",
"+ primes = sieve(300000)",
"-# https://mathtrain.jp/eratosthenes",
"-def furui(nmax):",
"- assert nmax > 2",
"- p = 2",
"- primes = list(range(2, nmax + 1))",
"- while True:",
"- if p**2 > nmax:",
"- break",
"- primes_next =... | false | 1.074422 | 0.267732 | 4.013045 | [
"s068358645",
"s904552587"
] |
u810787773 | p03680 | python | s755595520 | s499367101 | 181 | 152 | 7,084 | 13,016 | Accepted | Accepted | 16.02 | def main():
N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)]
i = 1
ans = 0
for K in range(N):
i = a[i-1]
ans += 1
if i == 2:
return ans
ans = -1
return ans
print((main()))
| def main():
N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)]
cnt = 0
tmp = 1
while cnt<=100001:
tmp = a[tmp-1]
cnt += 1
if tmp == 2:
return cnt
elif tmp == 1:
return -1
return -1
print((main()))
| 15 | 16 | 264 | 295 | def main():
N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)]
i = 1
ans = 0
for K in range(N):
i = a[i - 1]
ans += 1
if i == 2:
return ans
ans = -1
return ans
print((main()))
| def main():
N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)]
cnt = 0
tmp = 1
while cnt <= 100001:
tmp = a[tmp - 1]
cnt += 1
if tmp == 2:
return cnt
elif tmp == 1:
return -1
return -1
print((main()))
| false | 6.25 | [
"- i = 1",
"- ans = 0",
"- for K in range(N):",
"- i = a[i - 1]",
"- ans += 1",
"- if i == 2:",
"- return ans",
"- ans = -1",
"- return ans",
"+ cnt = 0",
"+ tmp = 1",
"+ while cnt <= 100001:",
"+ tmp = a[tmp - 1]",
"+ c... | false | 0.035496 | 0.061213 | 0.579882 | [
"s755595520",
"s499367101"
] |
u631277801 | p03837 | python | s734033068 | s242829454 | 181 | 96 | 14,184 | 3,660 | Accepted | Accepted | 46.96 | import numpy as np
from scipy.sparse.csgraph import floyd_warshall as fw
import sys
sdin = sys.stdin.readline
n,m = list(map(int, sdin().split()))
INF = float("inf")
adj_mat = INF * np.ones((n, n))
for _ in range(m):
a,b,c = list(map(int, sdin().split()))
a -= 1
b -= 1
adj_mat[a,b] ... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.re... | 34 | 63 | 581 | 1,538 | import numpy as np
from scipy.sparse.csgraph import floyd_warshall as fw
import sys
sdin = sys.stdin.readline
n, m = list(map(int, sdin().split()))
INF = float("inf")
adj_mat = INF * np.ones((n, n))
for _ in range(m):
a, b, c = list(map(int, sdin().split()))
a -= 1
b -= 1
adj_mat[a, b] = c
adj_mat[... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 46.031746 | [
"-import numpy as np",
"-from scipy.sparse.csgraph import floyd_warshall as fw",
"-sdin = sys.stdin.readline",
"-n, m = list(map(int, sdin().split()))",
"-INF = float(\"inf\")",
"-adj_mat = INF * np.ones((n, n))",
"+stdin = sys.stdin",
"+sys.setrecursionlimit(10**5)",
"+",
"+",
"+def li():",
"... | false | 0.277901 | 0.036801 | 7.55137 | [
"s734033068",
"s242829454"
] |
u077291787 | p03214 | python | s724315175 | s094524855 | 20 | 17 | 3,060 | 3,064 | Accepted | Accepted | 15 | # dwacon5th-prelimsA - Thumbnail
def main():
N = int(eval(input()))
A = tuple(map(int, input().split()))
avg = sum(A) / N
D = sorted((abs(avg - a), i) for i, a in enumerate(A))
print((D[0][1]))
if __name__ == "__main__":
main() | # dwacon5th-prelimsA - Thumbnail
def main():
N = int(eval(input()))
A = tuple(map(int, input().split()))
avg = sum(A) / N
D = [(abs(avg - a), i) for i, a in enumerate(A)]
print((min(D)[1]))
if __name__ == "__main__":
main() | 11 | 11 | 255 | 251 | # dwacon5th-prelimsA - Thumbnail
def main():
N = int(eval(input()))
A = tuple(map(int, input().split()))
avg = sum(A) / N
D = sorted((abs(avg - a), i) for i, a in enumerate(A))
print((D[0][1]))
if __name__ == "__main__":
main()
| # dwacon5th-prelimsA - Thumbnail
def main():
N = int(eval(input()))
A = tuple(map(int, input().split()))
avg = sum(A) / N
D = [(abs(avg - a), i) for i, a in enumerate(A)]
print((min(D)[1]))
if __name__ == "__main__":
main()
| false | 0 | [
"- D = sorted((abs(avg - a), i) for i, a in enumerate(A))",
"- print((D[0][1]))",
"+ D = [(abs(avg - a), i) for i, a in enumerate(A)]",
"+ print((min(D)[1]))"
] | false | 0.04181 | 0.039531 | 1.057646 | [
"s724315175",
"s094524855"
] |
u844646164 | p02901 | python | s181974865 | s108228600 | 366 | 333 | 46,936 | 46,460 | Accepted | Accepted | 9.02 | N, M = list(map(int, input().split()))
key = []
for _ in range(M):
a, b = list(map(int, input().split()))
s = 0
C = list([int(x)-1 for x in input().split()])
for c in C:
s |= 1<<c
key += [(s, a)]
dp = [float('inf')]*(1<<N)
dp[0] = 0
for s in range(1<<N):
for i in range(M):
t = s | k... | N, M = list(map(int, input().split()))
keys = []
for _ in range(M):
a, b = list(map(int, input().split()))
c = list(map(int, input().split()))
s = 0
for cc in c:
cc -= 1
s |= 1<<cc
keys += [(s, a)]
dp = [float('inf')]*(1<<N)
dp[0] = 0
for s in range(1<<N):
for i in range(M):
t = ... | 25 | 22 | 460 | 431 | N, M = list(map(int, input().split()))
key = []
for _ in range(M):
a, b = list(map(int, input().split()))
s = 0
C = list([int(x) - 1 for x in input().split()])
for c in C:
s |= 1 << c
key += [(s, a)]
dp = [float("inf")] * (1 << N)
dp[0] = 0
for s in range(1 << N):
for i in range(M):
... | N, M = list(map(int, input().split()))
keys = []
for _ in range(M):
a, b = list(map(int, input().split()))
c = list(map(int, input().split()))
s = 0
for cc in c:
cc -= 1
s |= 1 << cc
keys += [(s, a)]
dp = [float("inf")] * (1 << N)
dp[0] = 0
for s in range(1 << N):
for i in range(... | false | 12 | [
"-key = []",
"+keys = []",
"+ c = list(map(int, input().split()))",
"- C = list([int(x) - 1 for x in input().split()])",
"- for c in C:",
"- s |= 1 << c",
"- key += [(s, a)]",
"+ for cc in c:",
"+ cc -= 1",
"+ s |= 1 << cc",
"+ keys += [(s, a)]",
"- ... | false | 0.036986 | 0.035787 | 1.033512 | [
"s181974865",
"s108228600"
] |
u790012205 | p03963 | python | s184262951 | s352209095 | 171 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.06 | N, K = list(map(int, input().split()))
A = K
if N != 1:
for i in range(N - 1):
A *= (K - 1)
print(A) | N, K = list(map(int, input().split()))
print((K * (K - 1) ** (N - 1))) | 6 | 2 | 111 | 63 | N, K = list(map(int, input().split()))
A = K
if N != 1:
for i in range(N - 1):
A *= K - 1
print(A)
| N, K = list(map(int, input().split()))
print((K * (K - 1) ** (N - 1)))
| false | 66.666667 | [
"-A = K",
"-if N != 1:",
"- for i in range(N - 1):",
"- A *= K - 1",
"-print(A)",
"+print((K * (K - 1) ** (N - 1)))"
] | false | 0.047295 | 0.044304 | 1.067512 | [
"s184262951",
"s352209095"
] |
u747602774 | p03816 | python | s750969726 | s719464285 | 93 | 81 | 21,980 | 21,972 | Accepted | Accepted | 12.9 | from collections import Counter
N = int(eval(input()))
A = list(map(int,input().split()))
A.sort()
#print(A)
Ac = Counter(A).most_common()
#print(Ac)
ans = 0
for i in range(len(Ac)):
if Ac[i][1] > 1:
ans += Ac[i][1]-1
print((N-ans if ans%2 == 0 else N-ans-1))
| from collections import Counter
N = int(eval(input()))
A = list(map(int,input().split()))
Ac = Counter(A).most_common()
#print(Ac)
ans = 0
for i in range(len(Ac)):
if Ac[i][1] > 1:
ans += Ac[i][1]-1
print((N-ans if ans%2 == 0 else N-ans-1))
| 16 | 14 | 283 | 262 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
# print(A)
Ac = Counter(A).most_common()
# print(Ac)
ans = 0
for i in range(len(Ac)):
if Ac[i][1] > 1:
ans += Ac[i][1] - 1
print((N - ans if ans % 2 == 0 else N - ans - 1))
| from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
Ac = Counter(A).most_common()
# print(Ac)
ans = 0
for i in range(len(Ac)):
if Ac[i][1] > 1:
ans += Ac[i][1] - 1
print((N - ans if ans % 2 == 0 else N - ans - 1))
| false | 12.5 | [
"-A.sort()",
"-# print(A)"
] | false | 0.034446 | 0.036142 | 0.953074 | [
"s750969726",
"s719464285"
] |
u858748695 | p03127 | python | s780756247 | s863820255 | 80 | 60 | 16,240 | 20,324 | Accepted | Accepted | 25 | #!/usr/bin/env python3
from fractions import gcd
from functools import reduce
N = int(eval(input()))
A = list(map(int, input().split()))
print((reduce(gcd, A)))
| from math import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
g = 0
for x in a:
g = gcd(g, x)
print(g)
| 6 | 8 | 158 | 127 | #!/usr/bin/env python3
from fractions import gcd
from functools import reduce
N = int(eval(input()))
A = list(map(int, input().split()))
print((reduce(gcd, A)))
| from math import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
g = 0
for x in a:
g = gcd(g, x)
print(g)
| false | 25 | [
"-#!/usr/bin/env python3",
"-from fractions import gcd",
"-from functools import reduce",
"+from math import gcd",
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-print((reduce(gcd, A)))",
"+n = int(eval(input()))",
"+a = list(map(int, input().split()))",
"+g = 0",
"+for x i... | false | 0.059525 | 0.112584 | 0.528714 | [
"s780756247",
"s863820255"
] |
u426534722 | p02283 | python | s448165469 | s002133740 | 9,810 | 8,320 | 162,044 | 105,016 | Accepted | Accepted | 15.19 | class Node():
key = 0
l = None
r = None
def __init__(self, key):
self.key = key
T = [None] * 5000005
def insert(z):
if z == 0: return
y = 0
x = 0
while x is not None:
y = x
x = (T[x].l if T[z].key < T[x].key else T[x].r)
if T[z].key < T[y].key : ... | NIL = None
class Tree:
def __init__(self, key = None):
self.key = key
self.p = NIL
self.left = NIL
self.right = NIL
n = int(input())
tree = {"root":NIL}
def insert(T, z):
y = NIL
x = T["root"]
while x != NIL:
y = x
if z.key < x.key:
... | 38 | 48 | 835 | 1,116 | class Node:
key = 0
l = None
r = None
def __init__(self, key):
self.key = key
T = [None] * 5000005
def insert(z):
if z == 0:
return
y = 0
x = 0
while x is not None:
y = x
x = T[x].l if T[z].key < T[x].key else T[x].r
if T[z].key < T[y].key:
... | NIL = None
class Tree:
def __init__(self, key=None):
self.key = key
self.p = NIL
self.left = NIL
self.right = NIL
n = int(input())
tree = {"root": NIL}
def insert(T, z):
y = NIL
x = T["root"]
while x != NIL:
y = x
if z.key < x.key:
x = x.... | false | 20.833333 | [
"-class Node:",
"- key = 0",
"- l = None",
"- r = None",
"-",
"- def __init__(self, key):",
"- self.key = key",
"+NIL = None",
"-T = [None] * 5000005",
"-",
"-",
"-def insert(z):",
"- if z == 0:",
"- return",
"- y = 0",
"- x = 0",
"- while x is n... | false | 0.272879 | 0.008248 | 33.086036 | [
"s448165469",
"s002133740"
] |
u254871849 | p03501 | python | s786214950 | s492293863 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | import sys
read = sys.stdin.buffer.read
# readline = sys.stdin.buffer.readline
# readlines = sys.stdin.buffer.readlines
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
def main():
a, t, b = (int(x) for x in read().split())
if a... | import sys
n, a, b = list(map(int, sys.stdin.readline().split()))
def main():
return min(a * n, b)
if __name__ == '__main__':
ans = main()
print(ans) | 21 | 10 | 447 | 167 | import sys
read = sys.stdin.buffer.read
# readline = sys.stdin.buffer.readline
# readlines = sys.stdin.buffer.readlines
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
def main():
a, t, b = (int(x) for x in read().split())
if a * t >= b:
... | import sys
n, a, b = list(map(int, sys.stdin.readline().split()))
def main():
return min(a * n, b)
if __name__ == "__main__":
ans = main()
print(ans)
| false | 52.380952 | [
"-read = sys.stdin.buffer.read",
"-# readline = sys.stdin.buffer.readline",
"-# readlines = sys.stdin.buffer.readlines",
"-# import collections",
"-# import math",
"-# import string",
"-# import bisect",
"-# import re",
"-# import itertools",
"-# import statistics",
"+n, a, b = list(map(int, sys... | false | 0.037619 | 0.037756 | 0.99639 | [
"s786214950",
"s492293863"
] |
u272028993 | p03923 | python | s017113009 | s433512721 | 56 | 13 | 32,796 | 2,568 | Accepted | Accepted | 76.79 | n,a=list(map(int,input().split()))
ans=10**12+5
for eat_num in range(45):
if 2**(eat_num-1)>n:break
time=eat_num*a
t=eat_num+1
l=0;r=n
while r-l>1:
m=(r+l)/2
if m**t>=n:r=m
else:l=m
for j in range(t+1):
if r**(t-j) * (r-1)**j < n:break
surplus... | n,a=list(map(int,input().split()))
ans=10**12+5
for eat_num in range(45):
if 2**(eat_num-1)>n:break
time=eat_num*a
bake=eat_num+1
l=0;r=n
while r-l>1:
m=(r+l)/2
if m**bake>=n:r=m
else:l=m
for surplus in range(1,bake+1):
if r**(bake-surplus) * (r-1)**su... | 16 | 17 | 384 | 427 | n, a = list(map(int, input().split()))
ans = 10**12 + 5
for eat_num in range(45):
if 2 ** (eat_num - 1) > n:
break
time = eat_num * a
t = eat_num + 1
l = 0
r = n
while r - l > 1:
m = (r + l) / 2
if m**t >= n:
r = m
else:
l = m
for j in ... | n, a = list(map(int, input().split()))
ans = 10**12 + 5
for eat_num in range(45):
if 2 ** (eat_num - 1) > n:
break
time = eat_num * a
bake = eat_num + 1
l = 0
r = n
while r - l > 1:
m = (r + l) / 2
if m**bake >= n:
r = m
else:
l = m
for... | false | 5.882353 | [
"- t = eat_num + 1",
"+ bake = eat_num + 1",
"- if m**t >= n:",
"+ if m**bake >= n:",
"- for j in range(t + 1):",
"- if r ** (t - j) * (r - 1) ** j < n:",
"+ for surplus in range(1, bake + 1):",
"+ if r ** (bake - surplus) * (r - 1) ** surplus < n:",
"- ... | false | 0.077359 | 0.069045 | 1.120416 | [
"s017113009",
"s433512721"
] |
u690536347 | p03053 | python | s697961924 | s883937515 | 605 | 549 | 121,564 | 85,720 | Accepted | Accepted | 9.26 | from collections import deque
def solve():
H, W = list(map(int, input().split()))
m = [[-1]*W for _ in range(H)]
l = [list(eval(input())) for _ in range(H)]
dx = [-1, 1, 0, 0]
dy = [0, 0, -1, 1]
q = deque([])
for i in range(H):
for j in range(W):
if l[i][j... | from collections import deque
def solve():
H, W = list(map(int, input().split()))
m = [[-1]*W for _ in range(H)]
dx = [-1, 1, 0, 0]
dy = [0, 0, -1, 1]
q = deque([])
for i in range(H):
s = eval(input())
for j in range(W):
if s[j]=="#":
... | 33 | 33 | 757 | 736 | from collections import deque
def solve():
H, W = list(map(int, input().split()))
m = [[-1] * W for _ in range(H)]
l = [list(eval(input())) for _ in range(H)]
dx = [-1, 1, 0, 0]
dy = [0, 0, -1, 1]
q = deque([])
for i in range(H):
for j in range(W):
if l[i][j] == "#":
... | from collections import deque
def solve():
H, W = list(map(int, input().split()))
m = [[-1] * W for _ in range(H)]
dx = [-1, 1, 0, 0]
dy = [0, 0, -1, 1]
q = deque([])
for i in range(H):
s = eval(input())
for j in range(W):
if s[j] == "#":
q.append((i... | false | 0 | [
"- l = [list(eval(input())) for _ in range(H)]",
"+ s = eval(input())",
"- if l[i][j] == \"#\":",
"+ if s[j] == \"#\":"
] | false | 0.036669 | 0.036879 | 0.994296 | [
"s697961924",
"s883937515"
] |
u193599711 | p02406 | python | s268932483 | s776070481 | 60 | 50 | 7,012 | 6,752 | Accepted | Accepted | 16.67 | array = []
for i in range(3,int(input()) + 1):
if i % 3 == 0 or i % 10 == 3 or '3' in str(i):
array.append(i)
for i in array:
print('',"{0}".format(i),end='')
print()
| n = int(input())
for i in range(3, n + 1):
if i % 3 == 0 or i % 10 == 3 or '3' in str(i):
print('',"{0}".format(i),end='')
print()
| 7 | 5 | 180 | 142 | array = []
for i in range(3, int(input()) + 1):
if i % 3 == 0 or i % 10 == 3 or "3" in str(i):
array.append(i)
for i in array:
print("", "{0}".format(i), end="")
print()
| n = int(input())
for i in range(3, n + 1):
if i % 3 == 0 or i % 10 == 3 or "3" in str(i):
print("", "{0}".format(i), end="")
print()
| false | 28.571429 | [
"-array = []",
"-for i in range(3, int(input()) + 1):",
"+n = int(input())",
"+for i in range(3, n + 1):",
"- array.append(i)",
"-for i in array:",
"- print(\"\", \"{0}\".format(i), end=\"\")",
"+ print(\"\", \"{0}\".format(i), end=\"\")"
] | false | 0.050221 | 0.050263 | 0.999158 | [
"s268932483",
"s776070481"
] |
u729133443 | p02936 | python | s258412967 | s265580012 | 1,973 | 1,160 | 207,492 | 178,100 | Accepted | Accepted | 41.21 | (n,q),*t=[list(map(int,t.split()))for t in open(0)]
s=[0]
d=s*n
f=s*n
e=[[]for _ in d]
for t in t:
a,b=t
if~-n:n-=1;e[a-1]+=b-1,;e[b-1]+=a-1,
else:d[a-1]+=b
while s:
v=s.pop();f[v]=-1
for w in e[v]:
if~f[w]:d[w]+=d[v];s+=w,
print((*d)) | (n,q),*t=[list(map(int,t.split()))for t in open(0)]
s=[0]
d=s*n
f=s*n
e=[[]for _ in d]
for a,b in t:
if~-n:n-=1;e[a-1]+=b-1,;e[b-1]+=a-1,
else:d[a-1]+=b
while s:
v=s.pop();f[v]=-1
for w in e[v]:
if~f[w]:d[w]+=d[v];s+=w,
print((*d)) | 14 | 13 | 247 | 241 | (n, q), *t = [list(map(int, t.split())) for t in open(0)]
s = [0]
d = s * n
f = s * n
e = [[] for _ in d]
for t in t:
a, b = t
if ~-n:
n -= 1
e[a - 1] += (b - 1,)
e[b - 1] += (a - 1,)
else:
d[a - 1] += b
while s:
v = s.pop()
f[v] = -1
for w in e[v]:
if ~f[... | (n, q), *t = [list(map(int, t.split())) for t in open(0)]
s = [0]
d = s * n
f = s * n
e = [[] for _ in d]
for a, b in t:
if ~-n:
n -= 1
e[a - 1] += (b - 1,)
e[b - 1] += (a - 1,)
else:
d[a - 1] += b
while s:
v = s.pop()
f[v] = -1
for w in e[v]:
if ~f[w]:
... | false | 7.142857 | [
"-for t in t:",
"- a, b = t",
"+for a, b in t:"
] | false | 0.007668 | 0.044215 | 0.173425 | [
"s258412967",
"s265580012"
] |
u369133448 | p02629 | python | s151583450 | s094700051 | 31 | 27 | 9,224 | 9,188 | Accepted | Accepted | 12.9 | n=int(eval(input()))
alpha=[chr(i) for i in range(97, 97+26)]
def calc(x):
if x//26>0:
return calc(x//26-1) + str(x%26).zfill(2)
return str(x%26).zfill(2)
wk=calc(n-1)
ans=""
for i in range(0,len(wk),2):
ans+=alpha[int(wk[i:i+2])]
print(ans) | n=int(eval(input()))
alpha=[chr(i) for i in range(97,97+26)]
def test(x,t):
if x//t>0:
return test(x//t-1,t)+alpha[x%t]
return alpha[x%t]
print((test(n-1,26))) | 11 | 7 | 255 | 165 | n = int(eval(input()))
alpha = [chr(i) for i in range(97, 97 + 26)]
def calc(x):
if x // 26 > 0:
return calc(x // 26 - 1) + str(x % 26).zfill(2)
return str(x % 26).zfill(2)
wk = calc(n - 1)
ans = ""
for i in range(0, len(wk), 2):
ans += alpha[int(wk[i : i + 2])]
print(ans)
| n = int(eval(input()))
alpha = [chr(i) for i in range(97, 97 + 26)]
def test(x, t):
if x // t > 0:
return test(x // t - 1, t) + alpha[x % t]
return alpha[x % t]
print((test(n - 1, 26)))
| false | 36.363636 | [
"-def calc(x):",
"- if x // 26 > 0:",
"- return calc(x // 26 - 1) + str(x % 26).zfill(2)",
"- return str(x % 26).zfill(2)",
"+def test(x, t):",
"+ if x // t > 0:",
"+ return test(x // t - 1, t) + alpha[x % t]",
"+ return alpha[x % t]",
"-wk = calc(n - 1)",
"-ans = \"\"",
... | false | 0.04073 | 0.038996 | 1.044482 | [
"s151583450",
"s094700051"
] |
u905203728 | p02585 | python | s330442208 | s808774622 | 378 | 308 | 75,064 | 74,244 | Accepted | Accepted | 18.52 | class UnionFind():
def __init__(self,n):
self.n=n
self.root=[-1]*n
self.rank=[-1]*n
def Find_Root(self,x):
if self.root[x]<0:return x
else:
self.root[x]=self.Find_Root(self.root[x])
return self.root[x]
def Unite(self,x,y):
... | N,K=list(map(int,input().split()))
P=list(map(int,input().split()))
C=list(map(int,input().split()))
E=[]
color=["white" for _ in range(N)]
for i in range(N):
if color[i]=="white":
index,F=i,[]
while 1:
if color[index]=="white":
color[index]="black"
... | 85 | 37 | 2,119 | 939 | class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * n
self.rank = [-1] * n
def Find_Root(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.Find_Root(self.root[x])
return self.root[x]
def Unite(sel... | N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
C = list(map(int, input().split()))
E = []
color = ["white" for _ in range(N)]
for i in range(N):
if color[i] == "white":
index, F = i, []
while 1:
if color[index] == "white":
color[index] = "black... | false | 56.470588 | [
"-class UnionFind:",
"- def __init__(self, n):",
"- self.n = n",
"- self.root = [-1] * n",
"- self.rank = [-1] * n",
"-",
"- def Find_Root(self, x):",
"- if self.root[x] < 0:",
"- return x",
"- else:",
"- self.root[x] = self.Find_Roo... | false | 0.0382 | 0.038616 | 0.989247 | [
"s330442208",
"s808774622"
] |
u761320129 | p02998 | python | s545944820 | s134738719 | 807 | 644 | 47,024 | 55,724 | Accepted | Accepted | 20.2 | N = int(eval(input()))
XY = [tuple(map(int,input().split())) for i in range(N)]
V = 10**5+5
class UnionFind:
def __init__(self,N):
self.parent = [i for i in range(N)]
self.rank = [0] * N
self.size_x = [1 - i//V for i in range(N)]
self.size_y = [i//V for i in range(N)]
... | N = int(eval(input()))
XY = [tuple(map(int,input().split())) for i in range(N)]
class UnionFind:
def __init__(self,N):
self.parent = [i for i in range(N)]
self._size = [1] * N
self.count = 0
def root(self,a):
if self.parent[a] == a:
return a
else:
... | 48 | 48 | 1,333 | 1,184 | N = int(eval(input()))
XY = [tuple(map(int, input().split())) for i in range(N)]
V = 10**5 + 5
class UnionFind:
def __init__(self, N):
self.parent = [i for i in range(N)]
self.rank = [0] * N
self.size_x = [1 - i // V for i in range(N)]
self.size_y = [i // V for i in range(N)]
... | N = int(eval(input()))
XY = [tuple(map(int, input().split())) for i in range(N)]
class UnionFind:
def __init__(self, N):
self.parent = [i for i in range(N)]
self._size = [1] * N
self.count = 0
def root(self, a):
if self.parent[a] == a:
return a
else:
... | false | 0 | [
"-V = 10**5 + 5",
"- self.rank = [0] * N",
"- self.size_x = [1 - i // V for i in range(N)]",
"- self.size_y = [i // V for i in range(N)]",
"+ self._size = [1] * N",
"+ self.count = 0",
"- if self.rank[ra] < self.rank[rb]:",
"- self.parent[ra] = rb",... | false | 0.563303 | 0.583508 | 0.965373 | [
"s545944820",
"s134738719"
] |
u744920373 | p04045 | python | s860452794 | s422972410 | 186 | 118 | 38,896 | 3,368 | Accepted | Accepted | 36.56 | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): ret... | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): ret... | 39 | 27 | 1,065 | 901 | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
de... | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
de... | false | 30.769231 | [
"-D = li()",
"-r = [i for i in range(10) if i not in D]",
"-if r[0] == 0:",
"- que = deque(r[1:])",
"- # que = r[:][1:]",
"-else:",
"- que = deque(r)",
"- # que = r[:]",
"-for num in que:",
"- if N <= num:",
"+D = list(map(str, sys.stdin.readline().split()))",
"+for num in range... | false | 0.153338 | 0.037648 | 4.072959 | [
"s860452794",
"s422972410"
] |
u873762144 | p02687 | python | s068323526 | s025164300 | 23 | 20 | 9,100 | 9,092 | Accepted | Accepted | 13.04 | s = eval(input())
print(("ARC" if s == "ABC" else "ABC")) | s = eval(input())
if s == "ABC":
print("ARC")
else:
print("ABC") | 2 | 5 | 50 | 66 | s = eval(input())
print(("ARC" if s == "ABC" else "ABC"))
| s = eval(input())
if s == "ABC":
print("ARC")
else:
print("ABC")
| false | 60 | [
"-print((\"ARC\" if s == \"ABC\" else \"ABC\"))",
"+if s == \"ABC\":",
"+ print(\"ARC\")",
"+else:",
"+ print(\"ABC\")"
] | false | 0.038713 | 0.037242 | 1.039492 | [
"s068323526",
"s025164300"
] |
u489959379 | p04013 | python | s458349187 | s845361130 | 324 | 202 | 118,188 | 119,072 | Accepted | Accepted | 37.65 | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, a = list(map(int, input().split()))
X = list(map(int, input().split()))
MAX = n * a
dp = [[[0] * (MAX + 1) for _ in range(n + 1)] for _ in range(n + 1)]
dp[0]... | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, a = list(map(int, input().split()))
X = list(map(int, input().split()))
MAX = 50 * 50 + 1
dp = [[[0] * MAX for _ in range(n + 1)] for _ in range(n + 1)]
dp[0][0][0] = 1
for i in r... | 29 | 29 | 722 | 695 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n, a = list(map(int, input().split()))
X = list(map(int, input().split()))
MAX = n * a
dp = [[[0] * (MAX + 1) for _ in range(n + 1)] for _ in range(n + 1)]
dp[0][0][0] = 1
fo... | import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n, a = list(map(int, input().split()))
X = list(map(int, input().split()))
MAX = 50 * 50 + 1
dp = [[[0] * MAX for _ in range(n + 1)] for _ in range(n + 1)]
dp[0][0][0] = 1
for i in range(1, n + 1):
... | false | 0 | [
"-input = sys.stdin.readline",
"- MAX = n * a",
"- dp = [[[0] * (MAX + 1) for _ in range(n + 1)] for _ in range(n + 1)]",
"+ MAX = 50 * 50 + 1",
"+ dp = [[[0] * MAX for _ in range(n + 1)] for _ in range(n + 1)]",
"- for k in range(n):",
"- for s in range(MAX):",
"- ... | false | 0.041865 | 0.14177 | 0.295302 | [
"s458349187",
"s845361130"
] |
u475503988 | p02548 | python | s205729079 | s767064825 | 1,971 | 151 | 34,688 | 9,012 | Accepted | Accepted | 92.34 | import numpy as np
n = int(eval(input()))
ans = np.zeros(n, dtype=np.int64)
for a in range(1,n):
ans[a::a] += 1
print((ans.sum())) | n = int(eval(input()))
ans = 0
for a in range(1,n):
ans += (n-1)//a
print(ans) | 6 | 5 | 131 | 80 | import numpy as np
n = int(eval(input()))
ans = np.zeros(n, dtype=np.int64)
for a in range(1, n):
ans[a::a] += 1
print((ans.sum()))
| n = int(eval(input()))
ans = 0
for a in range(1, n):
ans += (n - 1) // a
print(ans)
| false | 16.666667 | [
"-import numpy as np",
"-",
"-ans = np.zeros(n, dtype=np.int64)",
"+ans = 0",
"- ans[a::a] += 1",
"-print((ans.sum()))",
"+ ans += (n - 1) // a",
"+print(ans)"
] | false | 0.747557 | 0.061622 | 12.131356 | [
"s205729079",
"s767064825"
] |
u150984829 | p00040 | python | s649196584 | s004107837 | 270 | 160 | 5,608 | 5,600 | Accepted | Accepted | 40.74 | for _ in[0]*int(eval(input())):
e=eval(input())
for i in range(26):
for j in range(26):
a=''.join([c,chr(((ord(c)-97)*i+j)%26+97)][c.islower()]for c in e)
if'that'in a or'this'in a:print(a);break
| for _ in[0]*int(eval(input())):
e=eval(input())
for i in range(1,26,2):
for j in range(26):
a=''.join([c,chr(((ord(c)-97)*i+j)%26+97)][c.islower()]for c in e)
if'that'in a or'this'in a:print(a);break
| 6 | 6 | 199 | 203 | for _ in [0] * int(eval(input())):
e = eval(input())
for i in range(26):
for j in range(26):
a = "".join(
[c, chr(((ord(c) - 97) * i + j) % 26 + 97)][c.islower()] for c in e
)
if "that" in a or "this" in a:
print(a)
brea... | for _ in [0] * int(eval(input())):
e = eval(input())
for i in range(1, 26, 2):
for j in range(26):
a = "".join(
[c, chr(((ord(c) - 97) * i + j) % 26 + 97)][c.islower()] for c in e
)
if "that" in a or "this" in a:
print(a)
... | false | 0 | [
"- for i in range(26):",
"+ for i in range(1, 26, 2):"
] | false | 0.039637 | 0.039296 | 1.008667 | [
"s649196584",
"s004107837"
] |
u616382321 | p03262 | python | s276279125 | s311315781 | 196 | 85 | 38,124 | 20,308 | Accepted | Accepted | 56.63 | import numpy as np
def gcd(a,b):
if a % b == 0:
return b
return gcd(b, a%b)
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
s = np.array(x)
s = abs(s-X)
if len(s) == 1:
print((s[0]))
exit()
for i in range(1, len(s)):
if i == 1:
D =... | from math import gcd
N, X = list(map(int, input().split()))
xs = list(map(int, input().split()))
aX = list([abs(x-X) for x in xs])
ans = aX[0]
for i in range(1, N):
ans = gcd(ans, aX[i])
print(ans)
| 24 | 11 | 364 | 214 | import numpy as np
def gcd(a, b):
if a % b == 0:
return b
return gcd(b, a % b)
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
s = np.array(x)
s = abs(s - X)
if len(s) == 1:
print((s[0]))
exit()
for i in range(1, len(s)):
if i == 1:
D = gcd(s[i], s[i - ... | from math import gcd
N, X = list(map(int, input().split()))
xs = list(map(int, input().split()))
aX = list([abs(x - X) for x in xs])
ans = aX[0]
for i in range(1, N):
ans = gcd(ans, aX[i])
print(ans)
| false | 54.166667 | [
"-import numpy as np",
"-",
"-",
"-def gcd(a, b):",
"- if a % b == 0:",
"- return b",
"- return gcd(b, a % b)",
"-",
"+from math import gcd",
"-x = list(map(int, input().split()))",
"-s = np.array(x)",
"-s = abs(s - X)",
"-if len(s) == 1:",
"- print((s[0]))",
"- exit()... | false | 0.249651 | 0.044499 | 5.610314 | [
"s276279125",
"s311315781"
] |
u843175622 | p03078 | python | s649325703 | s873689985 | 1,503 | 105 | 159,876 | 16,840 | Accepted | Accepted | 93.01 | x, y, z, K = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))[::-1]
b = sorted(list(map(int, input().split())))[::-1]
c = sorted(list(map(int, input().split())))[::-1]
ans = []
for i in range(x):
for j in range(y):
if i * j > K:
break
for k in rang... | x, y, z, K = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))[::-1]
b = sorted(list(map(int, input().split())))[::-1]
c = sorted(list(map(int, input().split())))[::-1]
ans = []
for i in range(x):
for j in range(y):
if (i + 1) * (j + 1) > K:
break
for... | 18 | 16 | 482 | 488 | x, y, z, K = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))[::-1]
b = sorted(list(map(int, input().split())))[::-1]
c = sorted(list(map(int, input().split())))[::-1]
ans = []
for i in range(x):
for j in range(y):
if i * j > K:
break
for k in range(z):
... | x, y, z, K = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))[::-1]
b = sorted(list(map(int, input().split())))[::-1]
c = sorted(list(map(int, input().split())))[::-1]
ans = []
for i in range(x):
for j in range(y):
if (i + 1) * (j + 1) > K:
break
for k in range... | false | 11.111111 | [
"- if i * j > K:",
"+ if (i + 1) * (j + 1) > K:",
"- if i * j * k > K:",
"+ if (i + 1) * (j + 1) * (k + 1) > K:",
"-for i in range(K):",
"- print((ans[i]))",
"+print((*ans[:K]))"
] | false | 0.075894 | 0.036494 | 2.079654 | [
"s649325703",
"s873689985"
] |
u729133443 | p02665 | python | s921717982 | s352840549 | 479 | 441 | 88,292 | 20,244 | Accepted | Accepted | 7.93 | *a,=list(map(int,[*open(0)][1].split()))
c=sum(a)
s=b=1
for a in a:c-=a;b=min(c,(b-a)*2);s+=b
print((max(-1,s))) | c=sum(a:=[*list(map(int,[*open(0)][1].split()))])
s=b=1
for a in a:b=min(c:=c-a,b-a<<1);s+=b
print((max(-1,s))) | 5 | 4 | 108 | 106 | (*a,) = list(map(int, [*open(0)][1].split()))
c = sum(a)
s = b = 1
for a in a:
c -= a
b = min(c, (b - a) * 2)
s += b
print((max(-1, s)))
| c = sum(a := [*list(map(int, [*open(0)][1].split()))])
s = b = 1
for a in a:
b = min(c := c - a, b - a << 1)
s += b
print((max(-1, s)))
| false | 20 | [
"-(*a,) = list(map(int, [*open(0)][1].split()))",
"-c = sum(a)",
"+c = sum(a := [*list(map(int, [*open(0)][1].split()))])",
"- c -= a",
"- b = min(c, (b - a) * 2)",
"+ b = min(c := c - a, b - a << 1)"
] | false | 0.072691 | 0.111433 | 0.652326 | [
"s921717982",
"s352840549"
] |
u621935300 | p02579 | python | s021320151 | s996468811 | 1,984 | 1,671 | 231,744 | 183,888 | Accepted | Accepted | 15.78 | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque
H,W=list(map(int, sys.stdin.readline().split()))
CH,CW=list(map(int, sys.stdin.readline().split()))
CH-=1
CW-=1
DH,DW=list(map(int, sys.stdin.readline().split()))
DH-=1
DW-=1
S=[ sys.stdin.readline().strip() for _ in range(H) ]
... | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque
H,W=list(map(int, sys.stdin.readline().split()))
CH,CW=list(map(int, sys.stdin.readline().split()))
CH-=1
CW-=1
DH,DW=list(map(int, sys.stdin.readline().split()))
DH-=1
DW-=1
S=[ sys.stdin.readline().strip() for _ in range(H) ]
... | 47 | 45 | 1,368 | 1,242 | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque
H, W = list(map(int, sys.stdin.readline().split()))
CH, CW = list(map(int, sys.stdin.readline().split()))
CH -= 1
CW -= 1
DH, DW = list(map(int, sys.stdin.readline().split()))
DH -= 1
DW -= 1
S = [sys.stdin.readline().strip() for _ in range(... | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque
H, W = list(map(int, sys.stdin.readline().split()))
CH, CW = list(map(int, sys.stdin.readline().split()))
CH -= 1
CW -= 1
DH, DW = list(map(int, sys.stdin.readline().split()))
DH -= 1
DW -= 1
S = [sys.stdin.readline().strip() for _ in range(... | false | 4.255319 | [
"- and visit[(to_h, to_w)] == 0",
"- visit[(to_h, to_w)] == 1",
"- and visit[(to_h, to_w)] == 0",
"- visit[(to_h, to_w)] == 1"
] | false | 0.036305 | 0.078826 | 0.460566 | [
"s021320151",
"s996468811"
] |
u981931040 | p03836 | python | s063538803 | s847406972 | 308 | 18 | 51,692 | 3,064 | Accepted | Accepted | 94.16 | sx , sy ,tx ,ty = map(int,input().split())
for _ in range(ty - sy):
print("U",end = "")
for _ in range(tx - sx):
print("R",end = "")
for _ in range(ty - sy):
print("D",end = "")
for _ in range(tx - sx):
print("L",end = "")
print("L" , end = "")
for _ in range(ty - sy + 1):
print("U",end... | sx, sy, tx, ty = map(int, input().split())
directions = ['U', 'D', 'L', 'R']
print(directions[0] * (ty - sy), end='')
print(directions[3] * (tx - sx), end='')
print(directions[1] * (ty - sy), end='')
print(directions[2] * (tx - sx), end='')
print(directions[2], end='')
print(directions[0] * (ty - sy + 1), end=... | 22 | 15 | 549 | 544 | sx, sy, tx, ty = map(int, input().split())
for _ in range(ty - sy):
print("U", end="")
for _ in range(tx - sx):
print("R", end="")
for _ in range(ty - sy):
print("D", end="")
for _ in range(tx - sx):
print("L", end="")
print("L", end="")
for _ in range(ty - sy + 1):
print("U", end="")
for _ in range... | sx, sy, tx, ty = map(int, input().split())
directions = ["U", "D", "L", "R"]
print(directions[0] * (ty - sy), end="")
print(directions[3] * (tx - sx), end="")
print(directions[1] * (ty - sy), end="")
print(directions[2] * (tx - sx), end="")
print(directions[2], end="")
print(directions[0] * (ty - sy + 1), end="")
print... | false | 31.818182 | [
"-for _ in range(ty - sy):",
"- print(\"U\", end=\"\")",
"-for _ in range(tx - sx):",
"- print(\"R\", end=\"\")",
"-for _ in range(ty - sy):",
"- print(\"D\", end=\"\")",
"-for _ in range(tx - sx):",
"- print(\"L\", end=\"\")",
"-print(\"L\", end=\"\")",
"-for _ in range(ty - sy + 1):"... | false | 0.059462 | 0.007008 | 8.484396 | [
"s063538803",
"s847406972"
] |
u683530136 | p02675 | python | s144393420 | s468550213 | 24 | 20 | 9,112 | 9,144 | Accepted | Accepted | 16.67 | num = eval(input())
if num[-1] == "3":
print('bon')
elif num[-1] == "0" or num[-1] == "1" or num[-1] == "6" or num[-1] == "8":
print('pon')
else :
print('hon') | num = int(eval(input()))
num_list = list(range(10))
num_list.insert(0, 'pon')
num_list.insert(1, 'pon')
num_list.insert(2, 'hon')
num_list.insert(3, 'bon')
num_list.insert(4, 'hon')
num_list.insert(5, 'hon')
num_list.insert(6, 'pon')
num_list.insert(7, 'hon')
num_list.insert(8, 'pon')
num_list.insert(9, 'hon... | 8 | 14 | 173 | 343 | num = eval(input())
if num[-1] == "3":
print("bon")
elif num[-1] == "0" or num[-1] == "1" or num[-1] == "6" or num[-1] == "8":
print("pon")
else:
print("hon")
| num = int(eval(input()))
num_list = list(range(10))
num_list.insert(0, "pon")
num_list.insert(1, "pon")
num_list.insert(2, "hon")
num_list.insert(3, "bon")
num_list.insert(4, "hon")
num_list.insert(5, "hon")
num_list.insert(6, "pon")
num_list.insert(7, "hon")
num_list.insert(8, "pon")
num_list.insert(9, "hon")
print((n... | false | 42.857143 | [
"-num = eval(input())",
"-if num[-1] == \"3\":",
"- print(\"bon\")",
"-elif num[-1] == \"0\" or num[-1] == \"1\" or num[-1] == \"6\" or num[-1] == \"8\":",
"- print(\"pon\")",
"-else:",
"- print(\"hon\")",
"+num = int(eval(input()))",
"+num_list = list(range(10))",
"+num_list.insert(0, \"... | false | 0.043558 | 0.039487 | 1.103114 | [
"s144393420",
"s468550213"
] |
u472534477 | p02700 | python | s366269030 | s079922409 | 23 | 21 | 9,112 | 9,120 | Accepted | Accepted | 8.7 |
a, b, c, d = list(map( int, input().split() ))
#print( a, b, c, d )
for i in range( 200 ):
c = c - b
if c <= 0:
print( "Yes" )
exit()
a = a - d
if a <= 0:
print( "No" )
exit() | a, b, c, d = list(map( int, input().split() ))
#print( a, b, c, d )
for i in range( 200 ):
c = c - b
if c <= 0:
print( "Yes" )
break
a = a - d
if a <= 0:
print( "No" )
break | 14 | 13 | 235 | 231 | a, b, c, d = list(map(int, input().split()))
# print( a, b, c, d )
for i in range(200):
c = c - b
if c <= 0:
print("Yes")
exit()
a = a - d
if a <= 0:
print("No")
exit()
| a, b, c, d = list(map(int, input().split()))
# print( a, b, c, d )
for i in range(200):
c = c - b
if c <= 0:
print("Yes")
break
a = a - d
if a <= 0:
print("No")
break
| false | 7.142857 | [
"- exit()",
"+ break",
"- exit()",
"+ break"
] | false | 0.098884 | 0.086458 | 1.143718 | [
"s366269030",
"s079922409"
] |
u980205854 | p02844 | python | s731176085 | s963794141 | 788 | 118 | 73,572 | 74,964 | Accepted | Accepted | 85.03 | # D - Lucky PIN
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(10):
for j in range(10):
for k in range(10):
tmp = 0
while tmp<N and int(S[tmp])!=i:
tmp += 1
if tmp==N:
continue
tmp += 1
... | import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
fro... | 24 | 99 | 604 | 2,459 | # D - Lucky PIN
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(10):
for j in range(10):
for k in range(10):
tmp = 0
while tmp < N and int(S[tmp]) != i:
tmp += 1
if tmp == N:
continue
tmp += 1
while t... | import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right # func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from mat... | false | 75.757576 | [
"-# D - Lucky PIN",
"-N = int(eval(input()))",
"-S = eval(input())",
"-ans = 0",
"-for i in range(10):",
"- for j in range(10):",
"- for k in range(10):",
"- tmp = 0",
"- while tmp < N and int(S[tmp]) != i:",
"- tmp += 1",
"- if tmp == N:... | false | 0.048758 | 0.040353 | 1.208302 | [
"s731176085",
"s963794141"
] |
u848535504 | p02777 | python | s838218025 | s470111884 | 30 | 26 | 9,080 | 9,136 | Accepted | Accepted | 13.33 | S,T = input().split()
A,B = list(map(int,input().split()))
U = eval(input())
if U == S:
print((A-1,B))
else:
print((A,B-1)) | S,T = input().split() #文字列のの複数一行入力
A,B = list(map(int,input().split())) #数値の複数一行入力(形は覚える)
U = eval(input()) #文字列の入力
if U == S: #もしUとSが同じだった場合
print((A-1,B)) #(問題文より、)Aから1引いてAとBを出力
else: #そうでなかった場合(UとTが同じだった場合)
print((A,B-1)) #Bから1引いてAとBを出力
'''例
入力
S = red , T = blue
A = 3 , B = 4
U = red
... | 8 | 23 | 123 | 358 | S, T = input().split()
A, B = list(map(int, input().split()))
U = eval(input())
if U == S:
print((A - 1, B))
else:
print((A, B - 1))
| S, T = input().split() # 文字列のの複数一行入力
A, B = list(map(int, input().split())) # 数値の複数一行入力(形は覚える)
U = eval(input()) # 文字列の入力
if U == S: # もしUとSが同じだった場合
print((A - 1, B)) # (問題文より、)Aから1引いてAとBを出力
else: # そうでなかった場合(UとTが同じだった場合)
print((A, B - 1)) # Bから1引いてAとBを出力
"""例
入力
S = red , T = blue
A = 3 , B = 4
U = red
... | false | 65.217391 | [
"-S, T = input().split()",
"-A, B = list(map(int, input().split()))",
"-U = eval(input())",
"-if U == S:",
"- print((A - 1, B))",
"-else:",
"- print((A, B - 1))",
"+S, T = input().split() # 文字列のの複数一行入力",
"+A, B = list(map(int, input().split())) # 数値の複数一行入力(形は覚える)",
"+U = eval(input()) # 文... | false | 0.037681 | 0.045654 | 0.825358 | [
"s838218025",
"s470111884"
] |
u724687935 | p03111 | python | s472528766 | s353140865 | 336 | 73 | 55,536 | 3,064 | Accepted | Accepted | 78.27 | def calc(T, bam):
mix = len(bam) - 1
total = sum(bam)
return mix * 10 + abs(T - total)
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
var = [[] for _ in range(N + 1)]
var[0].append('')
for i in range(N):
for j in var[i]:
for c in '0abc... | import sys
sys.setrecursionlimit(10 ** 6)
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
INF = 10 ** 12
def dfs(cur, a, b, c):
if cur == N:
return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
ret0 = dfs(cur + 1, a, b, c)
... | 43 | 20 | 865 | 520 | def calc(T, bam):
mix = len(bam) - 1
total = sum(bam)
return mix * 10 + abs(T - total)
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
var = [[] for _ in range(N + 1)]
var[0].append("")
for i in range(N):
for j in var[i]:
for c in "0abc":
var... | import sys
sys.setrecursionlimit(10**6)
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
INF = 10**12
def dfs(cur, a, b, c):
if cur == N:
return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
ret0 = dfs(cur + 1, a, b, c)
ret1 = dfs(cu... | false | 53.488372 | [
"-def calc(T, bam):",
"- mix = len(bam) - 1",
"- total = sum(bam)",
"- return mix * 10 + abs(T - total)",
"+import sys",
"+",
"+sys.setrecursionlimit(10**6)",
"+N, A, B, C = list(map(int, input().split()))",
"+L = [int(eval(input())) for _ in range(N)]",
"+INF = 10**12",
"-N, A, B, C = ... | false | 0.267381 | 0.064391 | 4.152429 | [
"s472528766",
"s353140865"
] |
u312025627 | p03062 | python | s767493624 | s865798669 | 251 | 68 | 64,752 | 12,524 | Accepted | Accepted | 72.91 | def main():
_ = int(eval(input()))
A = [int(i) for i in input().split()]
cnt_minus = 0
zero_flag = False
for i, a in enumerate(A):
if a < 0:
cnt_minus += 1
elif a == 0:
zero_flag = True
ans = 0
if cnt_minus % 2 == 0 or zero_flag:
... | def main():
import sys
input = sys.stdin.buffer.readline
_ = int(eval(input()))
A = [int(i) for i in input().split()]
sumA = sum(abs(a) for a in A)
mi = len([a for a in A if a < 0])
if 0 in A or mi % 2 == 0:
print(sumA)
else:
print((sumA - 2*min(abs(a) for a in ... | 21 | 15 | 481 | 361 | def main():
_ = int(eval(input()))
A = [int(i) for i in input().split()]
cnt_minus = 0
zero_flag = False
for i, a in enumerate(A):
if a < 0:
cnt_minus += 1
elif a == 0:
zero_flag = True
ans = 0
if cnt_minus % 2 == 0 or zero_flag:
ans = sum(abs(... | def main():
import sys
input = sys.stdin.buffer.readline
_ = int(eval(input()))
A = [int(i) for i in input().split()]
sumA = sum(abs(a) for a in A)
mi = len([a for a in A if a < 0])
if 0 in A or mi % 2 == 0:
print(sumA)
else:
print((sumA - 2 * min(abs(a) for a in A)))
... | false | 28.571429 | [
"+ import sys",
"+",
"+ input = sys.stdin.buffer.readline",
"- cnt_minus = 0",
"- zero_flag = False",
"- for i, a in enumerate(A):",
"- if a < 0:",
"- cnt_minus += 1",
"- elif a == 0:",
"- zero_flag = True",
"- ans = 0",
"- if cnt_minus ... | false | 0.057333 | 0.037727 | 1.519649 | [
"s767493624",
"s865798669"
] |
u537782349 | p02983 | python | s136440775 | s766112002 | 97 | 80 | 2,940 | 2,940 | Accepted | Accepted | 17.53 | a, b = list(map(int, input().split()))
c = 2019
for i in range(a, b):
for j in range(a + 1 , b + 1):
c = min(c, i * j % 2019)
if c == 0:
print(c)
exit()
print(c)
| a, b = list(map(int, input().split()))
c = a * b
for i in range(a, b+1):
for j in range(a, b+1):
if i != j:
if c > i * j % 2019:
c = i * j % 2019
if c == 0:
print((0))
exit()
print(c)
| 9 | 11 | 208 | 270 | a, b = list(map(int, input().split()))
c = 2019
for i in range(a, b):
for j in range(a + 1, b + 1):
c = min(c, i * j % 2019)
if c == 0:
print(c)
exit()
print(c)
| a, b = list(map(int, input().split()))
c = a * b
for i in range(a, b + 1):
for j in range(a, b + 1):
if i != j:
if c > i * j % 2019:
c = i * j % 2019
if c == 0:
print((0))
exit()
print(c)
| false | 18.181818 | [
"-c = 2019",
"-for i in range(a, b):",
"- for j in range(a + 1, b + 1):",
"- c = min(c, i * j % 2019)",
"- if c == 0:",
"- print(c)",
"- exit()",
"+c = a * b",
"+for i in range(a, b + 1):",
"+ for j in range(a, b + 1):",
"+ if i != j:",
"+ ... | false | 0.034933 | 0.042701 | 0.81808 | [
"s136440775",
"s766112002"
] |
u953855545 | p02731 | python | s011625487 | s664200092 | 460 | 17 | 29,620 | 2,940 | Accepted | Accepted | 96.3 | import scipy.optimize
L = int(eval(input()))
func = lambda x: -1 * (x[0] * x[1] * (L - x[0] - x[1]))
res = scipy.optimize.minimize(func, (0.1 ,0.2), bounds = ((0, None), (0, None)), tol=1e-6)
print((-1 * res.fun)) | L = int(eval(input()))
print((L/3 * L/3 * L/3)) | 9 | 2 | 217 | 40 | import scipy.optimize
L = int(eval(input()))
func = lambda x: -1 * (x[0] * x[1] * (L - x[0] - x[1]))
res = scipy.optimize.minimize(func, (0.1, 0.2), bounds=((0, None), (0, None)), tol=1e-6)
print((-1 * res.fun))
| L = int(eval(input()))
print((L / 3 * L / 3 * L / 3))
| false | 77.777778 | [
"-import scipy.optimize",
"-",
"-func = lambda x: -1 * (x[0] * x[1] * (L - x[0] - x[1]))",
"-res = scipy.optimize.minimize(func, (0.1, 0.2), bounds=((0, None), (0, None)), tol=1e-6)",
"-print((-1 * res.fun))",
"+print((L / 3 * L / 3 * L / 3))"
] | false | 1.520787 | 0.035086 | 43.344789 | [
"s011625487",
"s664200092"
] |
u504836877 | p03837 | python | s601699387 | s244378733 | 625 | 357 | 3,444 | 43,868 | Accepted | Accepted | 42.88 | N,M = list(map(int, input().split()))
INF = 10**6
Edge = [[INF]*N for _ in range(N)]
for _ in range(M):
a,b,c = list(map(int, input().split()))
Edge[a-1][b-1] = c
Edge[b-1][a-1] = c
dp = [[INF]*N for _ in range(N)]
for i in range(N):
for j in range(N):
if i == j:
dp[... | N,M = list(map(int, input().split()))
inf = 10**8
d = [[inf]*N for _ in range(N)]
E = [[] for _ in range(N)]
for _ in range(M):
a,b,c = list(map(int, input().split()))
d[a-1][b-1] = c
d[b-1][a-1] = c
E[a-1].append((b-1, c))
for i in range(N):
d[i][i] = 0
for k in range(N):
for i in... | 30 | 32 | 700 | 804 | N, M = list(map(int, input().split()))
INF = 10**6
Edge = [[INF] * N for _ in range(N)]
for _ in range(M):
a, b, c = list(map(int, input().split()))
Edge[a - 1][b - 1] = c
Edge[b - 1][a - 1] = c
dp = [[INF] * N for _ in range(N)]
for i in range(N):
for j in range(N):
if i == j:
dp[i]... | N, M = list(map(int, input().split()))
inf = 10**8
d = [[inf] * N for _ in range(N)]
E = [[] for _ in range(N)]
for _ in range(M):
a, b, c = list(map(int, input().split()))
d[a - 1][b - 1] = c
d[b - 1][a - 1] = c
E[a - 1].append((b - 1, c))
for i in range(N):
d[i][i] = 0
for k in range(N):
for i... | false | 6.25 | [
"-INF = 10**6",
"-Edge = [[INF] * N for _ in range(N)]",
"+inf = 10**8",
"+d = [[inf] * N for _ in range(N)]",
"+E = [[] for _ in range(N)]",
"- Edge[a - 1][b - 1] = c",
"- Edge[b - 1][a - 1] = c",
"-dp = [[INF] * N for _ in range(N)]",
"+ d[a - 1][b - 1] = c",
"+ d[b - 1][a - 1] = c",... | false | 0.07059 | 0.040741 | 1.732673 | [
"s601699387",
"s244378733"
] |
u761320129 | p03200 | python | s001129453 | s979155126 | 49 | 43 | 3,500 | 3,500 | Accepted | Accepted | 12.24 | S = eval(input())
b = 0
ans = 0
for c in S:
if c == 'B':
b += 1
else:
ans += b
print(ans) | S = eval(input())
b = ans = 0
for c in S:
if c=='B':
b += 1
else:
ans += b
print(ans) | 9 | 8 | 115 | 110 | S = eval(input())
b = 0
ans = 0
for c in S:
if c == "B":
b += 1
else:
ans += b
print(ans)
| S = eval(input())
b = ans = 0
for c in S:
if c == "B":
b += 1
else:
ans += b
print(ans)
| false | 11.111111 | [
"-b = 0",
"-ans = 0",
"+b = ans = 0"
] | false | 0.04682 | 0.041668 | 1.123653 | [
"s001129453",
"s979155126"
] |
u814171899 | p03037 | python | s744870130 | s960582983 | 323 | 298 | 3,888 | 11,784 | Accepted | Accepted | 7.74 | n, m = list(map(int, input().split()))
card=[0 for _ in range(n)]
l, r = list(map(int, input().split()))
l-=1
for i in range(m-1):
li, ri = list(map(int, input().split()))
li-=1
if li>r or ri<l:
l=r
break
elif li>=l and ri<=r:
l=li; r=ri
elif li<=l and ri>=r:
... | n, m = list(map(int, input().split()))
card=[0 for _ in range(n)]
l=[]; r=[]
for i in range(m):
li, ri = list(map(int, input().split()))
l.append(li)
r.append(ri)
print((max(0, min(r)-max(l)+1)))
| 21 | 8 | 431 | 201 | n, m = list(map(int, input().split()))
card = [0 for _ in range(n)]
l, r = list(map(int, input().split()))
l -= 1
for i in range(m - 1):
li, ri = list(map(int, input().split()))
li -= 1
if li > r or ri < l:
l = r
break
elif li >= l and ri <= r:
l = li
r = ri
elif li <... | n, m = list(map(int, input().split()))
card = [0 for _ in range(n)]
l = []
r = []
for i in range(m):
li, ri = list(map(int, input().split()))
l.append(li)
r.append(ri)
print((max(0, min(r) - max(l) + 1)))
| false | 61.904762 | [
"-l, r = list(map(int, input().split()))",
"-l -= 1",
"-for i in range(m - 1):",
"+l = []",
"+r = []",
"+for i in range(m):",
"- li -= 1",
"- if li > r or ri < l:",
"- l = r",
"- break",
"- elif li >= l and ri <= r:",
"- l = li",
"- r = ri",
"- elif ... | false | 0.047686 | 0.050679 | 0.940941 | [
"s744870130",
"s960582983"
] |
u133805688 | p03814 | python | s083401218 | s270998880 | 59 | 20 | 3,516 | 3,500 | Accepted | Accepted | 66.1 | s = eval(input())
p = -1
for i in range(len(s)) :
if s[i] == 'A' and p == -1:
p = i
if s[i] == 'Z':
q = i
print((q - p + 1))
| s = eval(input())
p = s.find('A')
q = s.rfind('Z')
ans = q - p + 1
print(ans)
| 10 | 7 | 156 | 84 | s = eval(input())
p = -1
for i in range(len(s)):
if s[i] == "A" and p == -1:
p = i
if s[i] == "Z":
q = i
print((q - p + 1))
| s = eval(input())
p = s.find("A")
q = s.rfind("Z")
ans = q - p + 1
print(ans)
| false | 30 | [
"-p = -1",
"-for i in range(len(s)):",
"- if s[i] == \"A\" and p == -1:",
"- p = i",
"- if s[i] == \"Z\":",
"- q = i",
"-print((q - p + 1))",
"+p = s.find(\"A\")",
"+q = s.rfind(\"Z\")",
"+ans = q - p + 1",
"+print(ans)"
] | false | 0.044524 | 0.085181 | 0.5227 | [
"s083401218",
"s270998880"
] |
u525065967 | p02606 | python | s281908815 | s722969411 | 29 | 24 | 9,068 | 9,080 | Accepted | Accepted | 17.24 | l, r, d = list(map(int, input().split()))
print((r//d - l//d + (l%d==0)))
| l, r, d = list(map(int, input().split()))
print((r//d - (l-1)//d))
| 2 | 2 | 67 | 60 | l, r, d = list(map(int, input().split()))
print((r // d - l // d + (l % d == 0)))
| l, r, d = list(map(int, input().split()))
print((r // d - (l - 1) // d))
| false | 0 | [
"-print((r // d - l // d + (l % d == 0)))",
"+print((r // d - (l - 1) // d))"
] | false | 0.034937 | 0.0347 | 1.006831 | [
"s281908815",
"s722969411"
] |
u260980560 | p00295 | python | s634725612 | s526749424 | 710 | 140 | 4,424 | 4,424 | Accepted | Accepted | 80.28 | def rotate(p, comm):
if comm==0:
p[0],p[1],p[2], p[27],p[28],p[29] = p[27],p[28],p[29], p[0],p[1],p[2]
p[14], p[15] = p[15], p[14]
p[18], p[20] = p[20], p[18]
elif comm==1:
p[2],p[5],p[8], p[21],p[24],p[27] = p[21],p[24],p[27], p[2],p[5],p[8]
p[11], p[18] = p[18], ... | def rotate(p, comm):
if comm==0:
p[0],p[1],p[2], p[27],p[28],p[29] = p[27],p[28],p[29], p[0],p[1],p[2]
p[14], p[15] = p[15], p[14]
p[18], p[20] = p[20], p[18]
elif comm==1:
p[2],p[5],p[8], p[21],p[24],p[27] = p[21],p[24],p[27], p[2],p[5],p[8]
p[11], p[18] = p[18], ... | 42 | 44 | 1,342 | 1,386 | def rotate(p, comm):
if comm == 0:
p[0], p[1], p[2], p[27], p[28], p[29] = p[27], p[28], p[29], p[0], p[1], p[2]
p[14], p[15] = p[15], p[14]
p[18], p[20] = p[20], p[18]
elif comm == 1:
p[2], p[5], p[8], p[21], p[24], p[27] = p[21], p[24], p[27], p[2], p[5], p[8]
p[11], p[... | def rotate(p, comm):
if comm == 0:
p[0], p[1], p[2], p[27], p[28], p[29] = p[27], p[28], p[29], p[0], p[1], p[2]
p[14], p[15] = p[15], p[14]
p[18], p[20] = p[20], p[18]
elif comm == 1:
p[2], p[5], p[8], p[21], p[24], p[27] = p[21], p[24], p[27], p[2], p[5], p[8]
p[11], p[... | false | 4.545455 | [
"- if cnt > ans:",
"+ if ans <= cnt:",
"+ if ans <= cnt + 1:",
"+ break"
] | false | 0.108772 | 0.059349 | 1.832762 | [
"s634725612",
"s526749424"
] |
u754022296 | p03078 | python | s575194541 | s554485524 | 975 | 95 | 153,856 | 9,996 | Accepted | Accepted | 90.26 | 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()))
L = []
for i in A:
for j in B:
L.append(i+j)
S = sorted(L, reverse=True)[:k]
T = []
for i in S:
for j in sorted(C, reverse=True)[:k]:
T.append(i+j)
... | x, y, z, k = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)
L = []
for i in range(min(x, k)):
for j in range(min(y, k//(i+1))):
for l in range(min(z, k//(... | 14 | 10 | 365 | 405 | 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()))
L = []
for i in A:
for j in B:
L.append(i + j)
S = sorted(L, reverse=True)[:k]
T = []
for i in S:
for j in sorted(C, reverse=True)[:k]:
T.append(i + ... | x, y, z, k = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)
L = []
for i in range(min(x, k)):
for j in range(min(y, k // (i + 1))):
for l in range(min(z, k... | false | 28.571429 | [
"-A = list(map(int, input().split()))",
"-B = list(map(int, input().split()))",
"-C = list(map(int, input().split()))",
"+A = sorted(list(map(int, input().split())), reverse=True)",
"+B = sorted(list(map(int, input().split())), reverse=True)",
"+C = sorted(list(map(int, input().split())), reverse=True)",
... | false | 0.119113 | 0.036752 | 3.241034 | [
"s575194541",
"s554485524"
] |
u140201022 | p02412 | python | s499701662 | s179146540 | 3,690 | 420 | 4,672 | 4,208 | Accepted | Accepted | 88.62 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import timeit
import time
import sys
import io
import re
import math
#start = time.time()
#start = time.clock()
while True:
l = []
(n,x)=list(map(int, input().split()))
if n==x==0:
break
ans=0
for a in range(1,n+1):
l.appe... | while 1:
ans=0
n,x=list(map(int,input().split()))
if n:
for i in range(1,n-1):
for j in range(i+1,n):
for k in range(j+1,n+1):
if i+j+k==x:ans+=1
else:break
print(ans) | 31 | 10 | 650 | 249 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import timeit
import time
import sys
import io
import re
import math
# start = time.time()
# start = time.clock()
while True:
l = []
(n, x) = list(map(int, input().split()))
if n == x == 0:
break
ans = 0
for a in range(1, n + 1):
l.append... | while 1:
ans = 0
n, x = list(map(int, input().split()))
if n:
for i in range(1, n - 1):
for j in range(i + 1, n):
for k in range(j + 1, n + 1):
if i + j + k == x:
ans += 1
else:
break
print(ans)
| false | 67.741935 | [
"-#!/usr/bin/env python",
"-# -*- coding:utf-8 -*-",
"-import timeit",
"-import time",
"-import sys",
"-import io",
"-import re",
"-import math",
"-",
"-# start = time.time()",
"-# start = time.clock()",
"-while True:",
"- l = []",
"- (n, x) = list(map(int, input().split()))",
"- ... | false | 0.04465 | 0.041853 | 1.066834 | [
"s499701662",
"s179146540"
] |
u071693485 | p00226 | python | s492509612 | s998167335 | 200 | 180 | 7,420 | 7,420 | Accepted | Accepted | 10 | for q in range(12000):
a, b = input().split()
if a[0] is '0' and b[0] is '0':
break
hit = sum(1 for c, d in zip(a, b) if d is c)
blow = sum(1 for e in b if e in a) - hit
print((hit, blow)) | while True:
a, b = input().split()
if a[0] is '0' and b[0] is '0':
break
hit = sum(1 for c, d in zip(a, b) if d is c)
blow = sum(1 for e in b if e in a) - hit
print((hit, blow)) | 8 | 8 | 222 | 212 | for q in range(12000):
a, b = input().split()
if a[0] is "0" and b[0] is "0":
break
hit = sum(1 for c, d in zip(a, b) if d is c)
blow = sum(1 for e in b if e in a) - hit
print((hit, blow))
| while True:
a, b = input().split()
if a[0] is "0" and b[0] is "0":
break
hit = sum(1 for c, d in zip(a, b) if d is c)
blow = sum(1 for e in b if e in a) - hit
print((hit, blow))
| false | 0 | [
"-for q in range(12000):",
"+while True:"
] | false | 0.055397 | 0.056516 | 0.98021 | [
"s492509612",
"s998167335"
] |
u077291787 | p02948 | python | s588135160 | s048122127 | 445 | 281 | 29,452 | 29,504 | Accepted | Accepted | 36.85 | # ABC137D - Summer Vacation
from heapq import heappop, heappush
heappop_max = lambda heap: -heappop(heap)
heappush_max = lambda heap, x: heappush(heap, -x)
def main():
N, M = list(map(int, input().split()))
all_jobs = tuple(tuple(map(int, input().split())) for _ in range(N))
available_jobs = [[... | # ABC137D - Summer Vacation
import sys
from heapq import heappop, heappush
readline = sys.stdin.buffer.readline
heappop_max = lambda heap: -heappop(heap)
heappush_max = lambda heap, x: heappush(heap, -x)
def main():
N, M = list(map(int, readline().split()))
all_jobs = tuple(tuple(map(int, readline... | 26 | 28 | 738 | 794 | # ABC137D - Summer Vacation
from heapq import heappop, heappush
heappop_max = lambda heap: -heappop(heap)
heappush_max = lambda heap, x: heappush(heap, -x)
def main():
N, M = list(map(int, input().split()))
all_jobs = tuple(tuple(map(int, input().split())) for _ in range(N))
available_jobs = [[] for _ in... | # ABC137D - Summer Vacation
import sys
from heapq import heappop, heappush
readline = sys.stdin.buffer.readline
heappop_max = lambda heap: -heappop(heap)
heappush_max = lambda heap, x: heappush(heap, -x)
def main():
N, M = list(map(int, readline().split()))
all_jobs = tuple(tuple(map(int, readline().split())... | false | 7.142857 | [
"+import sys",
"+readline = sys.stdin.buffer.readline",
"- N, M = list(map(int, input().split()))",
"- all_jobs = tuple(tuple(map(int, input().split())) for _ in range(N))",
"+ N, M = list(map(int, readline().split()))",
"+ all_jobs = tuple(tuple(map(int, readline().split())) for _ in range(N)... | false | 0.078224 | 0.079687 | 0.981631 | [
"s588135160",
"s048122127"
] |
u143492911 | p03986 | python | s870161309 | s109957199 | 91 | 76 | 6,436 | 6,436 | Accepted | Accepted | 16.48 | x=list(eval(input()))
stack=[]
for i in range(len(x)):
if x[i]=="S":
stack.append(x[i])
elif x[i]=="T":
if len(stack)==0:
stack.append(x[i])
elif stack[-1]=="T":
stack.append(x[i])
elif stack[-1]=="S":
stack.pop()
print((len(stack))... | x=list(eval(input()))
stack=[]
t_f=[]
for i in range(len(x)):
if x[i]=="S":
stack.append(x[i])
elif x[i]=="T":
if len(stack)!=0:
stack.pop()
else:
t_f.append(x[i])
print((len(stack)+len(t_f)))
| 13 | 13 | 314 | 254 | x = list(eval(input()))
stack = []
for i in range(len(x)):
if x[i] == "S":
stack.append(x[i])
elif x[i] == "T":
if len(stack) == 0:
stack.append(x[i])
elif stack[-1] == "T":
stack.append(x[i])
elif stack[-1] == "S":
stack.pop()
print((len(stack... | x = list(eval(input()))
stack = []
t_f = []
for i in range(len(x)):
if x[i] == "S":
stack.append(x[i])
elif x[i] == "T":
if len(stack) != 0:
stack.pop()
else:
t_f.append(x[i])
print((len(stack) + len(t_f)))
| false | 0 | [
"+t_f = []",
"- if len(stack) == 0:",
"- stack.append(x[i])",
"- elif stack[-1] == \"T\":",
"- stack.append(x[i])",
"- elif stack[-1] == \"S\":",
"+ if len(stack) != 0:",
"-print((len(stack)))",
"+ else:",
"+ t_f.append(x[i])",
... | false | 0.047603 | 0.046637 | 1.020713 | [
"s870161309",
"s109957199"
] |
u553987207 | p02936 | python | s536159792 | s668642713 | 1,248 | 846 | 98,296 | 83,100 | Accepted | Accepted | 32.21 | import sys
readline = sys.stdin.readline
N, Q = list(map(int, readline().split()))
T = [set() for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, readline().split()))
T[a - 1].add(b - 1)
T[b - 1].add(a - 1)
ans = [0] * N
for _ in range(Q):
p, x = list(map(int, readline().split()))... | import sys
N, Q = list(map(int, input().split()))
G = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, sys.stdin.readline().split()))
G[a-1].append(b-1)
G[b-1].append(a-1)
X = [0] * N
for _ in range(Q):
p, x = list(map(int, sys.stdin.readline().split()))
X[p-1] += x
an... | 28 | 24 | 629 | 562 | import sys
readline = sys.stdin.readline
N, Q = list(map(int, readline().split()))
T = [set() for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, readline().split()))
T[a - 1].add(b - 1)
T[b - 1].add(a - 1)
ans = [0] * N
for _ in range(Q):
p, x = list(map(int, readline().split()))
ans[p ... | import sys
N, Q = list(map(int, input().split()))
G = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, sys.stdin.readline().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
X = [0] * N
for _ in range(Q):
p, x = list(map(int, sys.stdin.readline().split()))
X[p - 1] += x
ans ... | false | 14.285714 | [
"-readline = sys.stdin.readline",
"-N, Q = list(map(int, readline().split()))",
"-T = [set() for _ in range(N)]",
"+N, Q = list(map(int, input().split()))",
"+G = [[] for _ in range(N)]",
"- a, b = list(map(int, readline().split()))",
"- T[a - 1].add(b - 1)",
"- T[b - 1].add(a - 1)",
"+ ... | false | 0.038594 | 0.053857 | 0.7166 | [
"s536159792",
"s668642713"
] |
u729133443 | p02889 | python | s021982839 | s541440887 | 441 | 361 | 36,252 | 36,760 | Accepted | Accepted | 18.14 | import sys
from scipy.sparse.csgraph import floyd_warshall as f
def main():
n,m,l,*t=list(map(int,sys.stdin.buffer.read().split()))
d=[[0]*(n+1)for _ in range(n+1)]
for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=c
d=f(f(d,0)<=l)
d[d>n]=0
print(('\n'.join(map(str,list(map(int,[d[i]-1for i in zip(*[iter... | import sys
from scipy.sparse.csgraph import floyd_warshall as f
def main():
n,m,l,*t=list(map(int,sys.stdin.buffer.read().split()))
d=[[0]*(n+1)for _ in range(n+1)]
for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=c
d=f(f(d,0)<=l)-1
d[d>n]=-1
print(('\n'.join(str(int(d[i]))for i in zip(*[iter(t[m*3+1:])... | 10 | 10 | 336 | 327 | import sys
from scipy.sparse.csgraph import floyd_warshall as f
def main():
n, m, l, *t = list(map(int, sys.stdin.buffer.read().split()))
d = [[0] * (n + 1) for _ in range(n + 1)]
for a, b, c in zip(*[iter(t[: m * 3])] * 3):
d[a][b] = c
d = f(f(d, 0) <= l)
d[d > n] = 0
print(
(... | import sys
from scipy.sparse.csgraph import floyd_warshall as f
def main():
n, m, l, *t = list(map(int, sys.stdin.buffer.read().split()))
d = [[0] * (n + 1) for _ in range(n + 1)]
for a, b, c in zip(*[iter(t[: m * 3])] * 3):
d[a][b] = c
d = f(f(d, 0) <= l) - 1
d[d > n] = -1
print(("\n"... | false | 0 | [
"- d = f(f(d, 0) <= l)",
"- d[d > n] = 0",
"- print(",
"- (",
"- \"\\n\".join(",
"- map(",
"- str,",
"- list(",
"- map(int, [d[i] - 1 for i in zip(*[iter(t[m * 3 + 1 :])] * 2)])",
"- ... | false | 0.471029 | 0.512899 | 0.918366 | [
"s021982839",
"s541440887"
] |
u037430802 | p03409 | python | s594898613 | s503065177 | 26 | 19 | 3,064 | 3,064 | Accepted | Accepted | 26.92 | import heapq
N = int(eval(input()))
red = []
for i in range(N):
x,y = list(map(int, input().split()))
heapq.heappush(red, (-y, x))
blue = []
for i in range(N):
x,y = list(map(int, input().split()))
heapq.heappush(blue, (x,y))
ans = 0
for i in range(N):
tmp = []
bx,by = heapq... |
N = int(eval(input()))
r = []
for _ in range(N):
x,y = list(map(int, input().split()))
r.append((-y,x))
b = []
for _ in range(N):
x,y = list(map(int, input().split()))
b.append((x,y))
r.sort()
b.sort()
ans = 0
for my,x in r:
for j in range(len(b)):
if -my < b[j][... | 37 | 27 | 832 | 399 | import heapq
N = int(eval(input()))
red = []
for i in range(N):
x, y = list(map(int, input().split()))
heapq.heappush(red, (-y, x))
blue = []
for i in range(N):
x, y = list(map(int, input().split()))
heapq.heappush(blue, (x, y))
ans = 0
for i in range(N):
tmp = []
bx, by = heapq.heappop(blue)
... | N = int(eval(input()))
r = []
for _ in range(N):
x, y = list(map(int, input().split()))
r.append((-y, x))
b = []
for _ in range(N):
x, y = list(map(int, input().split()))
b.append((x, y))
r.sort()
b.sort()
ans = 0
for my, x in r:
for j in range(len(b)):
if -my < b[j][1] and x < b[j][0]:
... | false | 27.027027 | [
"-import heapq",
"-",
"-red = []",
"-for i in range(N):",
"+r = []",
"+for _ in range(N):",
"- heapq.heappush(red, (-y, x))",
"-blue = []",
"-for i in range(N):",
"+ r.append((-y, x))",
"+b = []",
"+for _ in range(N):",
"- heapq.heappush(blue, (x, y))",
"+ b.append((x, y))",
... | false | 0.102714 | 0.131363 | 0.781907 | [
"s594898613",
"s503065177"
] |
u050428930 | p03503 | python | s309025019 | s623042132 | 316 | 100 | 3,064 | 3,064 | Accepted | Accepted | 68.35 | N=int(eval(input()))
H=['']*N
W=['']*N
x=[]
for i in range(N):
H[i]=list(map(int,input().split()))
for j in range(N):
W[j]=list(map(int,input().split()))
for k in range(1,1024):
t=[]
for ii in range(10):
if k&(1<<ii):
t+=[1]
else:
t+=[0]
ans=0
... | N=int(eval(input()))
ans=-10**9
s=["".join(list(input().split())) for i in range(N)]
t=[list(map(int,input().split())) for i in range(N)]
for j in range(1,1024):
q=0
for i in range(len(s)):
q+=t[i][(bin(int(s[i],2)&j)).count("1")]
ans=max(ans,q)
print(ans)
| 23 | 10 | 473 | 280 | N = int(eval(input()))
H = [""] * N
W = [""] * N
x = []
for i in range(N):
H[i] = list(map(int, input().split()))
for j in range(N):
W[j] = list(map(int, input().split()))
for k in range(1, 1024):
t = []
for ii in range(10):
if k & (1 << ii):
t += [1]
else:
t += [... | N = int(eval(input()))
ans = -(10**9)
s = ["".join(list(input().split())) for i in range(N)]
t = [list(map(int, input().split())) for i in range(N)]
for j in range(1, 1024):
q = 0
for i in range(len(s)):
q += t[i][(bin(int(s[i], 2) & j)).count("1")]
ans = max(ans, q)
print(ans)
| false | 56.521739 | [
"-H = [\"\"] * N",
"-W = [\"\"] * N",
"-x = []",
"-for i in range(N):",
"- H[i] = list(map(int, input().split()))",
"-for j in range(N):",
"- W[j] = list(map(int, input().split()))",
"-for k in range(1, 1024):",
"- t = []",
"- for ii in range(10):",
"- if k & (1 << ii):",
"-... | false | 0.195182 | 0.048572 | 4.018387 | [
"s309025019",
"s623042132"
] |
u094191970 | p02720 | python | s466582443 | s160130715 | 460 | 207 | 32,676 | 17,268 | Accepted | Accepted | 55 | import sys
sys.setrecursionlimit(10**9)
k=int(eval(input()))
def dfs(keta,num):
lunlun.append(int(num))
if keta==10:
return
min_v=max(0,int(num[-1])-1)
max_v=min(9,int(num[-1])+1)
for i in range(min_v,max_v+1):
dfs(keta+1,num+str(i))
lunlun=[]
for i in range(1,10):
dfs(0,str(i... | k=int(eval(input()))
def dfs(keta,num):
global ans
ans.append(int(''.join(num)))
if keta==10:
return
min_n=max(0,int(num[-1])-1)
max_n=min(9,int(num[-1])+1)
for i in range(min_n,max_n+1):
dfs(keta+1,num+[str(i)])
ans=[]
for i in range(1,10):
dfs(1,[str(i)])
ans.sort()
print... | 22 | 20 | 353 | 324 | import sys
sys.setrecursionlimit(10**9)
k = int(eval(input()))
def dfs(keta, num):
lunlun.append(int(num))
if keta == 10:
return
min_v = max(0, int(num[-1]) - 1)
max_v = min(9, int(num[-1]) + 1)
for i in range(min_v, max_v + 1):
dfs(keta + 1, num + str(i))
lunlun = []
for i in r... | k = int(eval(input()))
def dfs(keta, num):
global ans
ans.append(int("".join(num)))
if keta == 10:
return
min_n = max(0, int(num[-1]) - 1)
max_n = min(9, int(num[-1]) + 1)
for i in range(min_n, max_n + 1):
dfs(keta + 1, num + [str(i)])
ans = []
for i in range(1, 10):
dfs(... | false | 9.090909 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**9)",
"- lunlun.append(int(num))",
"+ global ans",
"+ ans.append(int(\"\".join(num)))",
"- min_v = max(0, int(num[-1]) - 1)",
"- max_v = min(9, int(num[-1]) + 1)",
"- for i in range(min_v, max_v + 1):",
"- dfs(keta + 1, num + ... | false | 1.177679 | 1.017109 | 1.157869 | [
"s466582443",
"s160130715"
] |
u720483676 | p03210 | python | s550527079 | s566134647 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a=input();print("NO") if a!="5" and a!="3" and a!="7" else print("YES")
| print("YES") if input()in["3","5","7"] else print("NO")
| 1 | 1 | 71 | 55 | a = input()
print("NO") if a != "5" and a != "3" and a != "7" else print("YES")
| print("YES") if input() in ["3", "5", "7"] else print("NO")
| false | 0 | [
"-a = input()",
"-print(\"NO\") if a != \"5\" and a != \"3\" and a != \"7\" else print(\"YES\")",
"+print(\"YES\") if input() in [\"3\", \"5\", \"7\"] else print(\"NO\")"
] | false | 0.05668 | 0.05576 | 1.016498 | [
"s550527079",
"s566134647"
] |
u888092736 | p03166 | python | s855709142 | s944456459 | 709 | 467 | 85,268 | 59,056 | Accepted | Accepted | 34.13 | from collections import defaultdict
import sys
sys.setrecursionlimit(10 ** 7)
def input():
return sys.stdin.readline().strip()
def dfs(v):
if dp[v] >= 0:
return dp[v]
res = 0
for nv in g[v]:
res = max(res, dfs(nv) + 1)
dp[v] = res
return res
n, m = list... | import sys
sys.setrecursionlimit(10 ** 7)
def input():
return sys.stdin.readline().strip()
def dfs(v):
if dp[v] >= 0:
return dp[v]
res = 0
for nv in g[v]:
res = max(res, dfs(nv) + 1)
dp[v] = res
return res
n, m = list(map(int, input().split()))
g = [[] fo... | 30 | 28 | 561 | 502 | from collections import defaultdict
import sys
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline().strip()
def dfs(v):
if dp[v] >= 0:
return dp[v]
res = 0
for nv in g[v]:
res = max(res, dfs(nv) + 1)
dp[v] = res
return res
n, m = list(map(int, input().spli... | import sys
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline().strip()
def dfs(v):
if dp[v] >= 0:
return dp[v]
res = 0
for nv in g[v]:
res = max(res, dfs(nv) + 1)
dp[v] = res
return res
n, m = list(map(int, input().split()))
g = [[] for i in range(n)]
for... | false | 6.666667 | [
"-from collections import defaultdict",
"-g = {i: set() for i in range(n)}",
"+g = [[] for i in range(n)]",
"- g[x - 1].add(y - 1)",
"-dp = defaultdict(lambda: -1)",
"-for v in g:",
"+ g[x - 1].append(y - 1)",
"+dp = [-1] * n",
"+for v in range(n):",
"-print((max(dp.values())))",
"+print((... | false | 0.048041 | 0.044697 | 1.074818 | [
"s855709142",
"s944456459"
] |
u478275206 | p02938 | python | s133482464 | s294423377 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | L, R = list(map(int, input().split()))
MOD = 10 ** 9 + 7
l = '{:060b}'.format(L)[::-1]
r = '{:060b}'.format(R)[::-1]
memo = [[[[-1 for l in range(2)] for k in range(2)] for j in range(2)] for i in range(60)]
def f(pos, flagX, flagY, flagZ):
if pos == -1:
return 1
if memo[pos][flagX][flagY][f... | L, R = list(map(int, input().split()))
MOD = 10 ** 9 + 7
l = '{:060b}'.format(L)[::-1]
r = '{:060b}'.format(R)[::-1]
memo = [[[[-1 for l in range(2)] for k in range(2)] for j in range(2)] for i in range(60)]
def f(pos, flagX, flagY, flagZ):
if pos == -1:
return 1
if memo[pos][flagX][flagY]... | 28 | 28 | 870 | 873 | L, R = list(map(int, input().split()))
MOD = 10**9 + 7
l = "{:060b}".format(L)[::-1]
r = "{:060b}".format(R)[::-1]
memo = [
[[[-1 for l in range(2)] for k in range(2)] for j in range(2)] for i in range(60)
]
def f(pos, flagX, flagY, flagZ):
if pos == -1:
return 1
if memo[pos][flagX][flagY][flagZ] ... | L, R = list(map(int, input().split()))
MOD = 10**9 + 7
l = "{:060b}".format(L)[::-1]
r = "{:060b}".format(R)[::-1]
memo = [
[[[-1 for l in range(2)] for k in range(2)] for j in range(2)] for i in range(60)
]
def f(pos, flagX, flagY, flagZ):
if pos == -1:
return 1
if memo[pos][flagX][flagY][flagZ] ... | false | 0 | [
"- # x 0, y 0",
"- if flagX or l[pos] == \"0\":",
"- ret += f(pos - 1, flagX, 1 if r[pos] == \"1\" else flagY, flagZ)",
"- # x 0, y 1",
"- if (flagX or l[pos] == \"0\") and (flagY or r[pos] == \"1\") and flagZ:",
"+ # x 0 y 0",
"+ if l[pos] == \"0\" or flagX:",
"+ ret +... | false | 0.050684 | 0.045348 | 1.117661 | [
"s133482464",
"s294423377"
] |
u912237403 | p00037 | python | s605459127 | s846591592 | 20 | 10 | 4,300 | 4,288 | Accepted | Accepted | 50 | wx=[]
wy=[]
def readdata():
z=[]
try:
while True:
z.append(input())
except: return z
def nextpath(p, dir0):
for e in [3,0,1,2]:
dp = ispath(p, (dir0+e)%4)
if dp!=[]: break
return dp
def ispath(p, dir1):
y,x = p
dp = []
if dir1==... | wx=[]
wy=[]
def readdata():
z=[]
try:
while True:
z.append(input())
except: return z
def nextpath(p,dir0):
for e in [3,0,1,2]:
d = (dir0+e)%4
if ispath(p,d): return d
return None
def ispath(p,d):
y,x = p
f=""
try:
if d=... | 42 | 43 | 906 | 837 | wx = []
wy = []
def readdata():
z = []
try:
while True:
z.append(input())
except:
return z
def nextpath(p, dir0):
for e in [3, 0, 1, 2]:
dp = ispath(p, (dir0 + e) % 4)
if dp != []:
break
return dp
def ispath(p, dir1):
y, x = p
dp ... | wx = []
wy = []
def readdata():
z = []
try:
while True:
z.append(input())
except:
return z
def nextpath(p, dir0):
for e in [3, 0, 1, 2]:
d = (dir0 + e) % 4
if ispath(p, d):
return d
return None
def ispath(p, d):
y, x = p
f = ""
... | false | 2.325581 | [
"- dp = ispath(p, (dir0 + e) % 4)",
"- if dp != []:",
"- break",
"- return dp",
"+ d = (dir0 + e) % 4",
"+ if ispath(p, d):",
"+ return d",
"+ return None",
"-def ispath(p, dir1):",
"+def ispath(p, d):",
"- dp = []",
"- if dir1 == 0... | false | 0.048147 | 0.047515 | 1.01331 | [
"s605459127",
"s846591592"
] |
u006883624 | p03162 | python | s958552089 | s780357990 | 507 | 396 | 24,308 | 20,536 | Accepted | Accepted | 21.89 | n = int(eval(input()))
table = []
for _ in range(n):
table.append([int(v) for v in input().split()])
dp = [0] * 3
for i in range(n):
dp_n = [0] * 3
a, b, c = table[i]
a0 = dp[0]
b0 = dp[1]
c0 = dp[2]
dp_n[0] = max(b0, c0) + a
dp_n[1] = max(c0, a0) + b
dp_n[2]... | def main():
N = int(eval(input()))
table = []
for _ in range(N):
a, b, c = list(map(int, input().split()))
table.append((a, b, c))
dp = [0] * 3
for i in range(N):
a, b, c = table[i]
a0 = dp[0]
b0 = dp[1]
c0 = dp[2]
dp[0] =... | 24 | 24 | 368 | 423 | n = int(eval(input()))
table = []
for _ in range(n):
table.append([int(v) for v in input().split()])
dp = [0] * 3
for i in range(n):
dp_n = [0] * 3
a, b, c = table[i]
a0 = dp[0]
b0 = dp[1]
c0 = dp[2]
dp_n[0] = max(b0, c0) + a
dp_n[1] = max(c0, a0) + b
dp_n[2] = max(a0, b0) + c
dp... | def main():
N = int(eval(input()))
table = []
for _ in range(N):
a, b, c = list(map(int, input().split()))
table.append((a, b, c))
dp = [0] * 3
for i in range(N):
a, b, c = table[i]
a0 = dp[0]
b0 = dp[1]
c0 = dp[2]
dp[0] = max(b0, c0) + a
... | false | 0 | [
"-n = int(eval(input()))",
"-table = []",
"-for _ in range(n):",
"- table.append([int(v) for v in input().split()])",
"-dp = [0] * 3",
"-for i in range(n):",
"- dp_n = [0] * 3",
"- a, b, c = table[i]",
"- a0 = dp[0]",
"- b0 = dp[1]",
"- c0 = dp[2]",
"- dp_n[0] = max(b0, c0... | false | 0.099067 | 0.082737 | 1.19738 | [
"s958552089",
"s780357990"
] |
u186838327 | p03197 | python | s868440326 | s723536671 | 195 | 177 | 3,060 | 76,152 | Accepted | Accepted | 9.23 | n = int(eval(input()))
for i in range(n):
a = int(eval(input()))
if a%2 == 1:
print('first')
exit()
else:
print('second')
| n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
for a in A:
if a != 1:
break
else:
print('first')
exit()
cnt = 0
for a in A:
if a%2 == 0:
cnt += 1
if cnt == n:
print('second')
else:
print('first')
| 8 | 18 | 145 | 262 | n = int(eval(input()))
for i in range(n):
a = int(eval(input()))
if a % 2 == 1:
print("first")
exit()
else:
print("second")
| n = int(eval(input()))
A = [int(eval(input())) for _ in range(n)]
for a in A:
if a != 1:
break
else:
print("first")
exit()
cnt = 0
for a in A:
if a % 2 == 0:
cnt += 1
if cnt == n:
print("second")
else:
print("first")
| false | 55.555556 | [
"-for i in range(n):",
"- a = int(eval(input()))",
"- if a % 2 == 1:",
"- print(\"first\")",
"- exit()",
"+A = [int(eval(input())) for _ in range(n)]",
"+for a in A:",
"+ if a != 1:",
"+ break",
"+ print(\"first\")",
"+ exit()",
"+cnt = 0",
"+for a in A:",... | false | 0.048141 | 0.09372 | 0.513671 | [
"s868440326",
"s723536671"
] |
u581022379 | p02598 | python | s777606831 | s587396667 | 1,453 | 993 | 30,880 | 30,856 | Accepted | Accepted | 31.66 | N, K = list(map(int, input().split()))
tree = list(map(int, input().split()))
left = 0
right = 2*(10**9)
treeLen = len(tree)
while right - left > 1:
cnt = 0
mid = (right + left) // 2
for i in range(treeLen):
cnt += tree[i] // mid
if tree[i] % mid == 0:
cnt -= 1 # ちょ... | N, K = list(map(int, input().split()))
tree = list(map(int, input().split()))
left = 0
right = max(tree)
while right - left > 1:
cnt = 0
mid = (right + left) // 2
for i in tree:
cnt += i // mid
if i % mid == 0:
cnt -= 1 # ちょうどに切れるときは切り口が1減る
if K >= cnt:
... | 19 | 18 | 417 | 374 | N, K = list(map(int, input().split()))
tree = list(map(int, input().split()))
left = 0
right = 2 * (10**9)
treeLen = len(tree)
while right - left > 1:
cnt = 0
mid = (right + left) // 2
for i in range(treeLen):
cnt += tree[i] // mid
if tree[i] % mid == 0:
cnt -= 1 # ちょうどに切れるときは切り... | N, K = list(map(int, input().split()))
tree = list(map(int, input().split()))
left = 0
right = max(tree)
while right - left > 1:
cnt = 0
mid = (right + left) // 2
for i in tree:
cnt += i // mid
if i % mid == 0:
cnt -= 1 # ちょうどに切れるときは切り口が1減る
if K >= cnt:
right = mid
... | false | 5.263158 | [
"-right = 2 * (10**9)",
"-treeLen = len(tree)",
"+right = max(tree)",
"- for i in range(treeLen):",
"- cnt += tree[i] // mid",
"- if tree[i] % mid == 0:",
"+ for i in tree:",
"+ cnt += i // mid",
"+ if i % mid == 0:"
] | false | 0.039671 | 0.035961 | 1.103164 | [
"s777606831",
"s587396667"
] |
u991567869 | p03612 | python | s917263641 | s943638290 | 83 | 61 | 14,008 | 14,008 | Accepted | Accepted | 26.51 | n = int(eval(input()))
p = list(map(int, input().split())) + [0]
cnt = 0
j = False
for i in range(n):
if p[i] == i + 1:
cnt += 1
if p[i + 1] == i + 2:
if j == False:
cnt -= 1
j = True
else:
j = False
else:
... | n = int(eval(input()))
p = list(map(int, input().split())) + [0]
cnt = 0
i = 0
while i < n:
if p[i] == i + 1:
cnt += 1
i += 1
i += 1
print(cnt) | 17 | 12 | 341 | 174 | n = int(eval(input()))
p = list(map(int, input().split())) + [0]
cnt = 0
j = False
for i in range(n):
if p[i] == i + 1:
cnt += 1
if p[i + 1] == i + 2:
if j == False:
cnt -= 1
j = True
else:
j = False
else:
j = False
... | n = int(eval(input()))
p = list(map(int, input().split())) + [0]
cnt = 0
i = 0
while i < n:
if p[i] == i + 1:
cnt += 1
i += 1
i += 1
print(cnt)
| false | 29.411765 | [
"-j = False",
"-for i in range(n):",
"+i = 0",
"+while i < n:",
"- if p[i + 1] == i + 2:",
"- if j == False:",
"- cnt -= 1",
"- j = True",
"- else:",
"- j = False",
"- else:",
"- j = False",
"+ i += 1"... | false | 0.099526 | 0.05849 | 1.701601 | [
"s917263641",
"s943638290"
] |
u884323674 | p02630 | python | s653693675 | s195308458 | 530 | 196 | 21,904 | 20,500 | Accepted | Accepted | 63.02 | N = int(eval(input()))
A = {}
ans = 0
for a in input().split():
a = int(a)
if a not in A:
A[a] = 1
else:
A[a] += 1
ans += a
Q = int(eval(input()))
for i in range(Q):
B, C = list(map(int, input().split()))
if B in A:
ans += (C-B) * A[B]
if C no... | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [int(i) for i in input().split()]
count = [0] * 10**5
for i in range(N):
count[A[i]-1] += 1
Q = int(eval(input()))
ans = sum(A)
for i in range(Q):
B, C = list(map(int, input().split()))
ans += (C - B) * count[B-1]
pri... | 24 | 19 | 444 | 361 | N = int(eval(input()))
A = {}
ans = 0
for a in input().split():
a = int(a)
if a not in A:
A[a] = 1
else:
A[a] += 1
ans += a
Q = int(eval(input()))
for i in range(Q):
B, C = list(map(int, input().split()))
if B in A:
ans += (C - B) * A[B]
if C not in A:
... | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [int(i) for i in input().split()]
count = [0] * 10**5
for i in range(N):
count[A[i] - 1] += 1
Q = int(eval(input()))
ans = sum(A)
for i in range(Q):
B, C = list(map(int, input().split()))
ans += (C - B) * count[B - 1]
print(ans)
count... | false | 20.833333 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-A = {}",
"-ans = 0",
"-for a in input().split():",
"- a = int(a)",
"- if a not in A:",
"- A[a] = 1",
"- else:",
"- A[a] += 1",
"- ans += a",
"+A = [int(i) for i in input().split()]",
"+count = [0] * 10**5",
"+... | false | 0.07983 | 0.040601 | 1.966227 | [
"s653693675",
"s195308458"
] |
u606878291 | p02947 | python | s340718017 | s816722986 | 844 | 484 | 18,144 | 18,148 | Accepted | Accepted | 42.65 | from collections import Counter
from math import factorial
def nc2(n):
return factorial(n) // 2 // factorial(n - 2)
N = int(eval(input()))
counter = Counter()
for _ in range(N):
s = eval(input())
counter[''.join(sorted(s))] += 1
print((sum([nc2(count) for count in list(counter.values())... | from collections import Counter
def nc2(n):
return n * (n - 1) // 2
N = int(eval(input()))
counter = Counter()
for _ in range(N):
s = eval(input())
counter[''.join(sorted(s))] += 1
print((sum([nc2(count) for count in list(counter.values()) if count > 1])))
| 16 | 15 | 318 | 269 | from collections import Counter
from math import factorial
def nc2(n):
return factorial(n) // 2 // factorial(n - 2)
N = int(eval(input()))
counter = Counter()
for _ in range(N):
s = eval(input())
counter["".join(sorted(s))] += 1
print((sum([nc2(count) for count in list(counter.values()) if count > 1])))... | from collections import Counter
def nc2(n):
return n * (n - 1) // 2
N = int(eval(input()))
counter = Counter()
for _ in range(N):
s = eval(input())
counter["".join(sorted(s))] += 1
print((sum([nc2(count) for count in list(counter.values()) if count > 1])))
| false | 6.25 | [
"-from math import factorial",
"- return factorial(n) // 2 // factorial(n - 2)",
"+ return n * (n - 1) // 2"
] | false | 0.083007 | 0.037841 | 2.193559 | [
"s340718017",
"s816722986"
] |
u738322459 | p03037 | python | s965006889 | s636823144 | 312 | 285 | 11,048 | 3,060 | Accepted | Accepted | 8.65 |
def main():
n, m = list(map(int, input().split()))
A = []
B = []
for _ in range(m):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
l = max(A)
r = min(B)
#print(l, r)
if r >= l:
return r - l + 1
else:
... | n, m = list(map(int , input().split()))
# L = []
# R = []
l_max = 0
r_min = 10 ** 6
for _ in range(m):
l, r = list(map(int, input().split()))
if l_max < l:
l_max = l
if r < r_min:
r_min = r
if l_max <= r_min:
print((r_min - l_max + 1))
else:
print((0)) | 38 | 16 | 645 | 288 | def main():
n, m = list(map(int, input().split()))
A = []
B = []
for _ in range(m):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
l = max(A)
r = min(B)
# print(l, r)
if r >= l:
return r - l + 1
else:
return 0
if __name__ == "... | n, m = list(map(int, input().split()))
# L = []
# R = []
l_max = 0
r_min = 10**6
for _ in range(m):
l, r = list(map(int, input().split()))
if l_max < l:
l_max = l
if r < r_min:
r_min = r
if l_max <= r_min:
print((r_min - l_max + 1))
else:
print((0))
| false | 57.894737 | [
"-def main():",
"- n, m = list(map(int, input().split()))",
"- A = []",
"- B = []",
"- for _ in range(m):",
"- a, b = list(map(int, input().split()))",
"- A.append(a)",
"- B.append(b)",
"- l = max(A)",
"- r = min(B)",
"- # print(l, r)",
"- if r >= l... | false | 0.044599 | 0.043561 | 1.02383 | [
"s965006889",
"s636823144"
] |
u029000441 | p02971 | python | s284913320 | s538337713 | 340 | 311 | 14,448 | 93,196 | Accepted | Accepted | 8.53 | import sys
input = sys.stdin.readline
import math
import collections
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
n=I()
nums=[]
for i in range(n):
nums.append(int(eval(input())))
nms=sorted(nums,reverse=True)
for i... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
fro... | 18 | 73 | 397 | 2,410 | import sys
input = sys.stdin.readline
import math
import collections
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
n = I()
nums = []
for i in range(n):
nums.append(int(eval(input())))
nms = sorted(nums, rever... | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heap... | false | 75.342466 | [
"-import sys",
"+def main():",
"+ import sys",
"-input = sys.stdin.readline",
"-import math",
"-import collections",
"+ input = sys.stdin.readline",
"+ sys.setrecursionlimit(10**7)",
"+ from collections import Counter, deque",
"+ from collections import defaultdict",
"+ from it... | false | 0.006348 | 0.033535 | 0.189307 | [
"s284913320",
"s538337713"
] |
u073417656 | p02915 | python | s388044919 | s299181678 | 28 | 21 | 3,316 | 3,316 | Accepted | Accepted | 25 | N=int(eval(input()))
print((N**3)) | print((int(eval(input()))**3)) | 2 | 1 | 27 | 22 | N = int(eval(input()))
print((N**3))
| print((int(eval(input())) ** 3))
| false | 50 | [
"-N = int(eval(input()))",
"-print((N**3))",
"+print((int(eval(input())) ** 3))"
] | false | 0.037313 | 0.03595 | 1.037918 | [
"s388044919",
"s299181678"
] |
u378691508 | p03161 | python | s550842663 | s961183010 | 1,728 | 533 | 20,504 | 38,712 | Accepted | Accepted | 69.16 | N, K=list(map(int, input().split()))
h=list(map(int, input().split()))
dp=[float("inf")]*N
dp[0]=0
for i in range(1, N):
if i==1:
dp[i]=min(dp[i], abs(h[i]-h[i-1]))
else:
start=max(0, i-K)
dp[i]=min(dp[j]+abs(h[j]-h[i]) for j in range(start, i))
print((dp[-1])) | import numpy as np
N, K = list(map(int, input().split()))
H=np.array(list(map(int, input().split())) + [0] * K, dtype=np.int64)
dp=np.full(N+K, 1e+14, dtype=np.int64)
dp[0]=0
for i in range(1, N):
dp[i:i + K]=np.minimum(dp[i:i + K], np.abs(H[i:i + K]-H[i-1])+dp[i-1])
print((dp[N - 1])) | 14 | 10 | 277 | 292 | N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [float("inf")] * N
dp[0] = 0
for i in range(1, N):
if i == 1:
dp[i] = min(dp[i], abs(h[i] - h[i - 1]))
else:
start = max(0, i - K)
dp[i] = min(dp[j] + abs(h[j] - h[i]) for j in range(start, i))
print((dp[-1])... | import numpy as np
N, K = list(map(int, input().split()))
H = np.array(list(map(int, input().split())) + [0] * K, dtype=np.int64)
dp = np.full(N + K, 1e14, dtype=np.int64)
dp[0] = 0
for i in range(1, N):
dp[i : i + K] = np.minimum(
dp[i : i + K], np.abs(H[i : i + K] - H[i - 1]) + dp[i - 1]
)
print((dp[... | false | 28.571429 | [
"+import numpy as np",
"+",
"-h = list(map(int, input().split()))",
"-dp = [float(\"inf\")] * N",
"+H = np.array(list(map(int, input().split())) + [0] * K, dtype=np.int64)",
"+dp = np.full(N + K, 1e14, dtype=np.int64)",
"- if i == 1:",
"- dp[i] = min(dp[i], abs(h[i] - h[i - 1]))",
"- el... | false | 0.045016 | 0.304184 | 0.147989 | [
"s550842663",
"s961183010"
] |
u603234915 | p03416 | python | s564563051 | s169454191 | 52 | 45 | 2,940 | 2,940 | Accepted | Accepted | 13.46 | a,b = list(map(int,input().split()))
k = 0
for i in range(a,b+1):
s = str(i)
if s[0]==s[-1] and s[1] == s[-2]:
k += 1
print(('{}'.format(k)))
| A, B = list(map(int, input().split()))
ans = 0
for i in range(A, B+1):
moji = str(i)
if moji[0] == moji[4] and moji[1] == moji[3]:
ans += 1
print(ans) | 10 | 7 | 162 | 166 | a, b = list(map(int, input().split()))
k = 0
for i in range(a, b + 1):
s = str(i)
if s[0] == s[-1] and s[1] == s[-2]:
k += 1
print(("{}".format(k)))
| A, B = list(map(int, input().split()))
ans = 0
for i in range(A, B + 1):
moji = str(i)
if moji[0] == moji[4] and moji[1] == moji[3]:
ans += 1
print(ans)
| false | 30 | [
"-a, b = list(map(int, input().split()))",
"-k = 0",
"-for i in range(a, b + 1):",
"- s = str(i)",
"- if s[0] == s[-1] and s[1] == s[-2]:",
"- k += 1",
"-print((\"{}\".format(k)))",
"+A, B = list(map(int, input().split()))",
"+ans = 0",
"+for i in range(A, B + 1):",
"+ moji = str... | false | 0.040485 | 0.041238 | 0.981751 | [
"s564563051",
"s169454191"
] |
u814663076 | p03160 | python | s604318964 | s208642013 | 1,696 | 328 | 21,180 | 77,684 | Accepted | Accepted | 80.66 | import numpy as np
N = int(eval(input()))
h = np.array(input().split(), dtype='int32')
dp = np.zeros(N, dtype='int32')
dp[1] = np.abs(h[1]-h[0])
if N > 2:
for i in range(2, N):
dp[i] = np.min(dp[i-2:i] + np.abs(h[i]-h[i-2:i]))
print((dp[-1])) | # region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools impor... | 11 | 40 | 258 | 1,345 | import numpy as np
N = int(eval(input()))
h = np.array(input().split(), dtype="int32")
dp = np.zeros(N, dtype="int32")
dp[1] = np.abs(h[1] - h[0])
if N > 2:
for i in range(2, N):
dp[i] = np.min(dp[i - 2 : i] + np.abs(h[i] - h[i - 2 : i]))
print((dp[-1]))
| # region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import (
a... | false | 72.5 | [
"-import numpy as np",
"+# region header",
"+import sys",
"+import math",
"+from bisect import bisect_left, bisect_right, insort_left, insort_right",
"+from collections import defaultdict, deque, Counter",
"+from copy import deepcopy",
"+from fractions import gcd",
"+from functools import lru_cache,... | false | 0.299528 | 0.035518 | 8.433195 | [
"s604318964",
"s208642013"
] |
u165429863 | p02680 | python | s614435307 | s794429001 | 2,895 | 2,631 | 66,100 | 66,116 | Accepted | Accepted | 9.12 | #168 - F
import sys
import numpy as np
#from numba import njit
def main():
N, M = list(map(int, sys.stdin.buffer.readline().split()))
LineData = np.int64(sys.stdin.buffer.read().split())
INF = 10**9 + 1
LineData = LineData.reshape(-1, 3)
A, B, C = LineData[:N].T
D, E, F = LineD... | #168 - F
import sys
import numpy as np
#from numba import njit
def main():
N, M = list(map(int, sys.stdin.buffer.readline().split()))
LineData = np.int64(sys.stdin.buffer.read().split())
INF = 10**9 + 1
LineData = LineData.reshape(-1, 3)
A, B, C = LineData[:N].T
D, E, F = LineD... | 109 | 116 | 2,778 | 2,846 | # 168 - F
import sys
import numpy as np
# from numba import njit
def main():
N, M = list(map(int, sys.stdin.buffer.readline().split()))
LineData = np.int64(sys.stdin.buffer.read().split())
INF = 10**9 + 1
LineData = LineData.reshape(-1, 3)
A, B, C = LineData[:N].T
D, E, F = LineData[N:].T
#... | # 168 - F
import sys
import numpy as np
# from numba import njit
def main():
N, M = list(map(int, sys.stdin.buffer.readline().split()))
LineData = np.int64(sys.stdin.buffer.read().split())
INF = 10**9 + 1
LineData = LineData.reshape(-1, 3)
A, B, C = LineData[:N].T
D, E, F = LineData[N:].T
#... | false | 6.034483 | [
"- if not LineX[x][y] and not visit[x - 1][y]:",
"- visit[x - 1][y] = True",
"- queue.append((x - 1, y))",
"- if not LineY[x][y] and not visit[x][y - 1]:",
"- visit[x][y - 1] = True",
"- queue.append((x, y - 1))",
"- if not LineX[x + 1][y]... | false | 0.32859 | 0.189156 | 1.737136 | [
"s614435307",
"s794429001"
] |
u481550011 | p02712 | python | s664090721 | s462418532 | 145 | 47 | 9,164 | 9,200 | Accepted | Accepted | 67.59 | N=int(eval(input()))
ans=0
for i in range(1,N+1):
if not (i%3==0 or i%5==0):
ans+=i
print(ans) | N=int(eval(input()))
Fizz=list(range(3,N+1,3))
Buzz=list(range(5,N+1,5))
FizzBuzz=list(range(15,N+1,15))
ans=sum(range(1,N+1))-sum(Fizz)-sum(Buzz)+sum(FizzBuzz)
print(ans)
| 6 | 6 | 105 | 153 | N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
if not (i % 3 == 0 or i % 5 == 0):
ans += i
print(ans)
| N = int(eval(input()))
Fizz = list(range(3, N + 1, 3))
Buzz = list(range(5, N + 1, 5))
FizzBuzz = list(range(15, N + 1, 15))
ans = sum(range(1, N + 1)) - sum(Fizz) - sum(Buzz) + sum(FizzBuzz)
print(ans)
| false | 0 | [
"-ans = 0",
"-for i in range(1, N + 1):",
"- if not (i % 3 == 0 or i % 5 == 0):",
"- ans += i",
"+Fizz = list(range(3, N + 1, 3))",
"+Buzz = list(range(5, N + 1, 5))",
"+FizzBuzz = list(range(15, N + 1, 15))",
"+ans = sum(range(1, N + 1)) - sum(Fizz) - sum(Buzz) + sum(FizzBuzz)"
] | false | 0.194138 | 0.095312 | 2.036875 | [
"s664090721",
"s462418532"
] |
u453634104 | p02553 | python | s777600214 | s874783533 | 108 | 29 | 61,764 | 8,876 | Accepted | Accepted | 73.15 | a, b, c, d = list(map(int, input().split()))
print((max(a*c, a*d, b*c, b*d))) | a, b, c, d = list(map(int, input().split()))
ans = max(a*c, a*d, b*c, b*d)
print(ans)
| 2 | 3 | 70 | 82 | a, b, c, d = list(map(int, input().split()))
print((max(a * c, a * d, b * c, b * d)))
| a, b, c, d = list(map(int, input().split()))
ans = max(a * c, a * d, b * c, b * d)
print(ans)
| false | 33.333333 | [
"-print((max(a * c, a * d, b * c, b * d)))",
"+ans = max(a * c, a * d, b * c, b * d)",
"+print(ans)"
] | false | 0.035449 | 0.034788 | 1.019005 | [
"s777600214",
"s874783533"
] |
u273010357 | p02732 | python | s015458949 | s419840002 | 1,205 | 328 | 74,196 | 26,780 | Accepted | Accepted | 72.78 | MOD = 10**9
fact_inv, inv = [0]*10**6, [0]*10**6
def init_nCk():
fact_inv[0] = fact_inv[1] = 1
inv[1] = 1
for i in range(2,10**6):
inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
fact_inv[i] = fact_inv[i-1] * inv[i] % MOD
def nCk(n,k):
if n<k:
return 0
if n<0 or... | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
B = Counter(A)
ans = 0
for i in list(B.values()):
ans += i*(i-1)//2
for a in A:
k = B[a]
print((ans - (k-1))) | 34 | 12 | 701 | 211 | MOD = 10**9
fact_inv, inv = [0] * 10**6, [0] * 10**6
def init_nCk():
fact_inv[0] = fact_inv[1] = 1
inv[1] = 1
for i in range(2, 10**6):
inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD
def nCk(n, k):
if n < k:
return 0
if n < 0 o... | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
B = Counter(A)
ans = 0
for i in list(B.values()):
ans += i * (i - 1) // 2
for a in A:
k = B[a]
print((ans - (k - 1)))
| false | 64.705882 | [
"-MOD = 10**9",
"-fact_inv, inv = [0] * 10**6, [0] * 10**6",
"-",
"-",
"-def init_nCk():",
"- fact_inv[0] = fact_inv[1] = 1",
"- inv[1] = 1",
"- for i in range(2, 10**6):",
"- inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD",
"- fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD",
... | false | 1.206956 | 0.037185 | 32.458085 | [
"s015458949",
"s419840002"
] |
u813102292 | p03281 | python | s182762497 | s030836501 | 25 | 18 | 2,940 | 3,060 | Accepted | Accepted | 28 | N = int(eval(input()))
if N < 105:
print((0))
elif N < 135:
print((1))
elif N < 165:
print((2))
elif N < 189:
print((3))
elif N < 195:
print((4))
else:
print((5)) | N = int(eval(input()))
def yaku(n):
cnt = 0
for k in range(1,n+1):
if n%k==0:
cnt += 1
return cnt
cnt = 0
for n in range(1,N+1):
if n%2==1 and yaku(n)==8:
if yaku(n)==8:
cnt += 1
print(cnt) | 13 | 15 | 180 | 255 | N = int(eval(input()))
if N < 105:
print((0))
elif N < 135:
print((1))
elif N < 165:
print((2))
elif N < 189:
print((3))
elif N < 195:
print((4))
else:
print((5))
| N = int(eval(input()))
def yaku(n):
cnt = 0
for k in range(1, n + 1):
if n % k == 0:
cnt += 1
return cnt
cnt = 0
for n in range(1, N + 1):
if n % 2 == 1 and yaku(n) == 8:
if yaku(n) == 8:
cnt += 1
print(cnt)
| false | 13.333333 | [
"-if N < 105:",
"- print((0))",
"-elif N < 135:",
"- print((1))",
"-elif N < 165:",
"- print((2))",
"-elif N < 189:",
"- print((3))",
"-elif N < 195:",
"- print((4))",
"-else:",
"- print((5))",
"+",
"+",
"+def yaku(n):",
"+ cnt = 0",
"+ for k in range(1, n + 1... | false | 0.039952 | 0.043858 | 0.910934 | [
"s182762497",
"s030836501"
] |
u686036872 | p03495 | python | s544168593 | s608453002 | 328 | 210 | 59,568 | 53,680 | Accepted | Accepted | 35.98 | import collections
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
number = len(set(A))
c = collections.Counter(A)
values,counts=list(zip(*c.most_common()))
count = 0
for i in range(number):
if number <= K:
print(count)
break
count += counts[-(i+1)]
... | from collections import Counter
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
c = Counter(A)
d = c.most_common()[::-1]
ans = 0
for i in range(len(set(A))-K):
ans += d[i][1]
print(ans) | 16 | 13 | 322 | 226 | import collections
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
number = len(set(A))
c = collections.Counter(A)
values, counts = list(zip(*c.most_common()))
count = 0
for i in range(number):
if number <= K:
print(count)
break
count += counts[-(i + 1)]
number -=... | from collections import Counter
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
c = Counter(A)
d = c.most_common()[::-1]
ans = 0
for i in range(len(set(A)) - K):
ans += d[i][1]
print(ans)
| false | 18.75 | [
"-import collections",
"+from collections import Counter",
"-number = len(set(A))",
"-c = collections.Counter(A)",
"-values, counts = list(zip(*c.most_common()))",
"-count = 0",
"-for i in range(number):",
"- if number <= K:",
"- print(count)",
"- break",
"- count += counts[-... | false | 0.042632 | 0.04406 | 0.967592 | [
"s544168593",
"s608453002"
] |
u993622994 | p03672 | python | s034435137 | s112893872 | 22 | 18 | 3,060 | 2,940 | Accepted | Accepted | 18.18 | s = list(eval(input()))
for i in range(1,len(s)):
len_s = len(s) - 2 * i
for j in range(1,len(s)):
left = s[0:j]
right = s[j:len_s]
if left == right:
ans = len(left + right)
print(ans)
exit()
elif len(left) > len(right):
... | s = eval(input())
for i in range(len(s)//2):
s = s[:len(s)-2]
if s[:len(s)//2] == s[len(s)//2:]:
print((len(s)))
exit() | 13 | 7 | 321 | 142 | s = list(eval(input()))
for i in range(1, len(s)):
len_s = len(s) - 2 * i
for j in range(1, len(s)):
left = s[0:j]
right = s[j:len_s]
if left == right:
ans = len(left + right)
print(ans)
exit()
elif len(left) > len(right):
break
| s = eval(input())
for i in range(len(s) // 2):
s = s[: len(s) - 2]
if s[: len(s) // 2] == s[len(s) // 2 :]:
print((len(s)))
exit()
| false | 46.153846 | [
"-s = list(eval(input()))",
"-for i in range(1, len(s)):",
"- len_s = len(s) - 2 * i",
"- for j in range(1, len(s)):",
"- left = s[0:j]",
"- right = s[j:len_s]",
"- if left == right:",
"- ans = len(left + right)",
"- print(ans)",
"- exit(... | false | 0.043683 | 0.045488 | 0.960313 | [
"s034435137",
"s112893872"
] |
u587213169 | p03331 | python | s612453085 | s365379534 | 266 | 241 | 3,060 | 3,064 | Accepted | Accepted | 9.4 | x=int(eval(input()))
count=100000
suma=0
sumb=0
for a in range(1, x):
b = x-a
y = sum(map(int, str(a))) + sum(map(int, str(b)))
if y<count:
count=y
print(count) | x=int(eval(input()))
count=10000
for a in range(1, x):
suma=0
sumb=0
b=x-a
while (a > 0):
suma += a%10
a= a//10
while (b > 0):
sumb += b%10
b=b//10
count = min(count, suma+sumb)
print(count) | 10 | 14 | 183 | 253 | x = int(eval(input()))
count = 100000
suma = 0
sumb = 0
for a in range(1, x):
b = x - a
y = sum(map(int, str(a))) + sum(map(int, str(b)))
if y < count:
count = y
print(count)
| x = int(eval(input()))
count = 10000
for a in range(1, x):
suma = 0
sumb = 0
b = x - a
while a > 0:
suma += a % 10
a = a // 10
while b > 0:
sumb += b % 10
b = b // 10
count = min(count, suma + sumb)
print(count)
| false | 28.571429 | [
"-count = 100000",
"-suma = 0",
"-sumb = 0",
"+count = 10000",
"+ suma = 0",
"+ sumb = 0",
"- y = sum(map(int, str(a))) + sum(map(int, str(b)))",
"- if y < count:",
"- count = y",
"+ while a > 0:",
"+ suma += a % 10",
"+ a = a // 10",
"+ while b > 0:",
... | false | 0.110396 | 0.111366 | 0.991294 | [
"s612453085",
"s365379534"
] |
u020390084 | p03329 | python | s795640768 | s775831991 | 219 | 90 | 41,068 | 3,064 | Accepted | Accepted | 58.9 | N=int(eval(input()))
ans=N
for i in range(N+1):
cnt=0
t=i
while t>0:
cnt+=t%6
t//=6
s=N-i
while s>0:
cnt+=s%9
s//=9
ans=min(ans,cnt)
print(ans)
| #!/usr/bin/env python3
import sys
from itertools import product
def solve(N: int):
nine = [9**i for i in range(5,0,-1)]
six = [6**i for i in range(6,0,-1,)]
answer = 10**6
for six_bit in product([0,1,2,3,4,5],repeat = 6):
tmp = 0
for i in range(6):
tmp += six[i]... | 14 | 41 | 208 | 1,079 | N = int(eval(input()))
ans = N
for i in range(N + 1):
cnt = 0
t = i
while t > 0:
cnt += t % 6
t //= 6
s = N - i
while s > 0:
cnt += s % 9
s //= 9
ans = min(ans, cnt)
print(ans)
| #!/usr/bin/env python3
import sys
from itertools import product
def solve(N: int):
nine = [9**i for i in range(5, 0, -1)]
six = [
6**i
for i in range(
6,
0,
-1,
)
]
answer = 10**6
for six_bit in product([0, 1, 2, 3, 4, 5], repeat=6):
... | false | 65.853659 | [
"-N = int(eval(input()))",
"-ans = N",
"-for i in range(N + 1):",
"- cnt = 0",
"- t = i",
"- while t > 0:",
"- cnt += t % 6",
"- t //= 6",
"- s = N - i",
"- while s > 0:",
"- cnt += s % 9",
"- s //= 9",
"- ans = min(ans, cnt)",
"-print(ans)",
... | false | 0.061385 | 0.078596 | 0.781025 | [
"s795640768",
"s775831991"
] |
u312025627 | p03457 | python | s819805122 | s103328073 | 580 | 250 | 60,248 | 55,644 | Accepted | Accepted | 56.9 | def main():
N = int(input())
posi = [0, 0]
time = 0
txy = [[int(i) for i in input().split()] for _ in range(N)]
for t, x, y in txy:
move = abs(posi[0] - x) + abs(posi[1] - y)
if (t - time) < move or (t - time) % 2 != move % 2:
return print("No")
time = t
... | def main():
import sys
input = sys.stdin.buffer.readline
N = int(input())
TXY = [[int(i) for i in input().split()] for j in range(N)]
time, px, py = 0, 0, 0
for t, x, y in TXY:
move = abs(x-px) + abs(y-py)
# print(move, t-time)
if (t - time) % 2 != move % 2 or t ... | 16 | 17 | 405 | 461 | def main():
N = int(input())
posi = [0, 0]
time = 0
txy = [[int(i) for i in input().split()] for _ in range(N)]
for t, x, y in txy:
move = abs(posi[0] - x) + abs(posi[1] - y)
if (t - time) < move or (t - time) % 2 != move % 2:
return print("No")
time = t
p... | def main():
import sys
input = sys.stdin.buffer.readline
N = int(input())
TXY = [[int(i) for i in input().split()] for j in range(N)]
time, px, py = 0, 0, 0
for t, x, y in TXY:
move = abs(x - px) + abs(y - py)
# print(move, t-time)
if (t - time) % 2 != move % 2 or t - ti... | false | 5.882353 | [
"+ import sys",
"+",
"+ input = sys.stdin.buffer.readline",
"- posi = [0, 0]",
"- time = 0",
"- txy = [[int(i) for i in input().split()] for _ in range(N)]",
"- for t, x, y in txy:",
"- move = abs(posi[0] - x) + abs(posi[1] - y)",
"- if (t - time) < move or (t - time)... | false | 0.046881 | 0.037701 | 1.243467 | [
"s819805122",
"s103328073"
] |
u782098901 | p03212 | python | s249360067 | s772250443 | 92 | 70 | 2,940 | 4,980 | Accepted | Accepted | 23.91 | N = int(eval(input()))
def dfs(s):
if int(s) > N:
return 0
ret = 1 if all(s.count(c) > 0 for c in "753") else 0
for c in "753":
ret += dfs(s + c)
return ret
print((dfs("0"))) | import itertools
N = int(eval(input()))
ans = 0
for i in range(3, len(str(N)) + 1):
cand = list(["".join(x) for x in itertools.product("357", repeat=i)])
for c in cand:
if int(c) > N:
continue
elif all(c.count(s) > 0 for s in "357"):
ans += 1
print(ans)
| 12 | 14 | 212 | 317 | N = int(eval(input()))
def dfs(s):
if int(s) > N:
return 0
ret = 1 if all(s.count(c) > 0 for c in "753") else 0
for c in "753":
ret += dfs(s + c)
return ret
print((dfs("0")))
| import itertools
N = int(eval(input()))
ans = 0
for i in range(3, len(str(N)) + 1):
cand = list(["".join(x) for x in itertools.product("357", repeat=i)])
for c in cand:
if int(c) > N:
continue
elif all(c.count(s) > 0 for s in "357"):
ans += 1
print(ans)
| false | 14.285714 | [
"+import itertools",
"+",
"-",
"-",
"-def dfs(s):",
"- if int(s) > N:",
"- return 0",
"- ret = 1 if all(s.count(c) > 0 for c in \"753\") else 0",
"- for c in \"753\":",
"- ret += dfs(s + c)",
"- return ret",
"-",
"-",
"-print((dfs(\"0\")))",
"+ans = 0",
"+for ... | false | 0.203444 | 0.06407 | 3.175348 | [
"s249360067",
"s772250443"
] |
u072717685 | p03478 | python | s889423015 | s750279438 | 37 | 30 | 9,140 | 9,184 | Accepted | Accepted | 18.92 | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
n, a, b = list(map(int, input().split()))
r = 0
for i1 in range(1, n + 1):
i1sum = sum(tuple(map(int, str(i1))))
if a <= i1sum <= b:
r += i1
print(r)
if __name__ == '__main__':
main... | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
n, a, b = list(map(int, input().split()))
r = 0
for i1 in range(1, n + 1):
i1sum = 0
i1org = i1
while i1:
i1sum += i1 % 10
i1 = i1 // 10
if a <= i1sum <= b:
... | 14 | 18 | 316 | 388 | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
n, a, b = list(map(int, input().split()))
r = 0
for i1 in range(1, n + 1):
i1sum = sum(tuple(map(int, str(i1))))
if a <= i1sum <= b:
r += i1
print(r)
if __name__ == "__main__":
main()
| import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
n, a, b = list(map(int, input().split()))
r = 0
for i1 in range(1, n + 1):
i1sum = 0
i1org = i1
while i1:
i1sum += i1 % 10
i1 = i1 // 10
if a <= i1sum <= b:
r +... | false | 22.222222 | [
"- i1sum = sum(tuple(map(int, str(i1))))",
"+ i1sum = 0",
"+ i1org = i1",
"+ while i1:",
"+ i1sum += i1 % 10",
"+ i1 = i1 // 10",
"- r += i1",
"+ r += i1org"
] | false | 0.036373 | 0.081875 | 0.444252 | [
"s889423015",
"s750279438"
] |
u768896740 | p03111 | python | s746830059 | s138995468 | 606 | 373 | 3,064 | 9,188 | Accepted | Accepted | 38.45 | n, a, b, c = list(map(int, input().split()))
take = []
for i in range(n):
t = int(eval(input()))
take.append(t)
def Base_10_to_n(X, n):
X_dumy = X
out = ''
while X_dumy>0:
out = str(X_dumy%n)+out
X_dumy = int(X_dumy/n)
return out
def cal_cost(li, a):
if li ... | n, a, b, c = list(map(int, input().split()))
bamboos = []
for i in range(n):
bamboo = int(eval(input()))
bamboos.append(bamboo)
def Base_10_to_n(X, n):
X_dumy = X
out = ''
while X_dumy>0:
out = str(X_dumy%n)+out
X_dumy = int(X_dumy/n)
return out
def calc_score(gro... | 47 | 47 | 1,018 | 1,156 | n, a, b, c = list(map(int, input().split()))
take = []
for i in range(n):
t = int(eval(input()))
take.append(t)
def Base_10_to_n(X, n):
X_dumy = X
out = ""
while X_dumy > 0:
out = str(X_dumy % n) + out
X_dumy = int(X_dumy / n)
return out
def cal_cost(li, a):
if li == []:
... | n, a, b, c = list(map(int, input().split()))
bamboos = []
for i in range(n):
bamboo = int(eval(input()))
bamboos.append(bamboo)
def Base_10_to_n(X, n):
X_dumy = X
out = ""
while X_dumy > 0:
out = str(X_dumy % n) + out
X_dumy = int(X_dumy / n)
return out
def calc_score(group, ... | false | 0 | [
"-take = []",
"+bamboos = []",
"- t = int(eval(input()))",
"- take.append(t)",
"+ bamboo = int(eval(input()))",
"+ bamboos.append(bamboo)",
"-def cal_cost(li, a):",
"- if li == []:",
"- return 10**12",
"- co = 0",
"- if len(li) == 1:",
"- co += abs(li[0] - a)... | false | 0.854292 | 0.389607 | 2.1927 | [
"s746830059",
"s138995468"
] |
u353895424 | p03680 | python | s469641741 | s799593782 | 658 | 526 | 49,240 | 50,136 | Accepted | Accepted | 20.06 | n = int(eval(input()))
a = []
for i in range(n):
a.append(int(eval(input())) - 1)
# if not 1 in a:
# print(-1)
# hst = []
btn = 0
cnt = 0
while cnt <= 10**7:
# hst.append(btn)
btn = a[btn]
cnt += 1
if btn == 1:
print(cnt)
exit()
print((-1)) | n = int(eval(input()))
a = []
for i in range(n):
a.append(int(eval(input())) - 1)
hst = [0] * n
btn = 0
cnt = 0
while hst[btn] != 1:
hst[btn] = 1
btn = a[btn]
cnt += 1
if btn == 1:
print(cnt)
exit()
print((-1)) | 21 | 19 | 290 | 254 | n = int(eval(input()))
a = []
for i in range(n):
a.append(int(eval(input())) - 1)
# if not 1 in a:
# print(-1)
# hst = []
btn = 0
cnt = 0
while cnt <= 10**7:
# hst.append(btn)
btn = a[btn]
cnt += 1
if btn == 1:
print(cnt)
exit()
print((-1))
| n = int(eval(input()))
a = []
for i in range(n):
a.append(int(eval(input())) - 1)
hst = [0] * n
btn = 0
cnt = 0
while hst[btn] != 1:
hst[btn] = 1
btn = a[btn]
cnt += 1
if btn == 1:
print(cnt)
exit()
print((-1))
| false | 9.52381 | [
"-# if not 1 in a:",
"-# print(-1)",
"-# hst = []",
"+hst = [0] * n",
"-while cnt <= 10**7:",
"- # hst.append(btn)",
"+while hst[btn] != 1:",
"+ hst[btn] = 1"
] | false | 0.591909 | 0.037606 | 15.739785 | [
"s469641741",
"s799593782"
] |
u868628468 | p02684 | python | s851835811 | s410576933 | 474 | 134 | 225,804 | 110,644 | Accepted | Accepted | 71.73 | from sys import stdin
import math
n,k = list(map(int,stdin.readline().split()))
a = list(map(int,stdin.readline().split()))
d = math.floor(math.log2(k))
next = [[-1 for _ in range(n)] for _ in range(d+1)]
for i in range(n):
next[0][i] = a[i] - 1
for j in range(d):
for i in range(n):
if next[j]... | from sys import stdin
n,k = list(map(int,stdin.readline().split()))
a = list(map(int,stdin.readline().split()))
for i in range(n):
a[i] -= 1
d = {}
d[0] = 0
cur = 0
step = 0
while step < k:
cur = a[cur]
step += 1
if cur in d:
looplen = step - d[cur]
step += looplen * ((k-st... | 21 | 18 | 501 | 378 | from sys import stdin
import math
n, k = list(map(int, stdin.readline().split()))
a = list(map(int, stdin.readline().split()))
d = math.floor(math.log2(k))
next = [[-1 for _ in range(n)] for _ in range(d + 1)]
for i in range(n):
next[0][i] = a[i] - 1
for j in range(d):
for i in range(n):
if next[j][i] ... | from sys import stdin
n, k = list(map(int, stdin.readline().split()))
a = list(map(int, stdin.readline().split()))
for i in range(n):
a[i] -= 1
d = {}
d[0] = 0
cur = 0
step = 0
while step < k:
cur = a[cur]
step += 1
if cur in d:
looplen = step - d[cur]
step += looplen * ((k - step) // l... | false | 14.285714 | [
"-import math",
"-d = math.floor(math.log2(k))",
"-next = [[-1 for _ in range(n)] for _ in range(d + 1)]",
"- next[0][i] = a[i] - 1",
"-for j in range(d):",
"- for i in range(n):",
"- if next[j][i] == -1:",
"- continue",
"- next[j + 1][i] = next[j][next[j][i]]",
"+ ... | false | 0.041434 | 0.041938 | 0.98798 | [
"s851835811",
"s410576933"
] |
u460468647 | p02555 | python | s271905929 | s040867815 | 31 | 26 | 9,200 | 9,192 | Accepted | Accepted | 16.13 | s = int(eval(input()))
lst = [0,0,1]
num = 10**9 + 7
if s>= 4:
for i in range(4,s+1):
ans = (lst[i-2] + lst[i-4])%num
lst.append(ans)
print((lst[-1]%num))
if s == 3:
print((1))
if (s == 1) or (s == 2):
print((0)) | s = int(eval(input()))
lst = [0,0,1]
num = 10**9 + 7
if s>= 4:
for i in range(4,s+1):
ans = (lst[i-2] + lst[i-4])%num
lst.append(ans)
print((lst[-1]%num))
elif s == 3:
print((1))
else:
print((0)) | 12 | 12 | 227 | 210 | s = int(eval(input()))
lst = [0, 0, 1]
num = 10**9 + 7
if s >= 4:
for i in range(4, s + 1):
ans = (lst[i - 2] + lst[i - 4]) % num
lst.append(ans)
print((lst[-1] % num))
if s == 3:
print((1))
if (s == 1) or (s == 2):
print((0))
| s = int(eval(input()))
lst = [0, 0, 1]
num = 10**9 + 7
if s >= 4:
for i in range(4, s + 1):
ans = (lst[i - 2] + lst[i - 4]) % num
lst.append(ans)
print((lst[-1] % num))
elif s == 3:
print((1))
else:
print((0))
| false | 0 | [
"-if s == 3:",
"+elif s == 3:",
"-if (s == 1) or (s == 2):",
"+else:"
] | false | 0.067437 | 0.102073 | 0.660669 | [
"s271905929",
"s040867815"
] |
u314837274 | p02726 | python | s810994286 | s707896741 | 1,330 | 1,205 | 3,444 | 3,188 | Accepted | Accepted | 9.4 | n,x,y=map(int,input().split())
#a<b
def dis(a,b):
return min (b-a,abs(a-x)+1+abs(b-y))
# for k in range(1,n):
# count=0
# #i<j
# for i in range(1,n):
# for j in range(i+1,n+1):
# if dis(i,j)==k:
# count+=1
# print(count)
ans=[0]*(n-1)
#i<j
for i in range(1,n):
for j in r... | n,x,y=list(map(int,input().split()))
#a<b
def dis(a,b):
return min (b-a,abs(a-x)+1+abs(b-y))
# for k in range(1,n):
# count=0
# #i<j
# for i in range(1,n):
# for j in range(i+1,n+1):
# if dis(i,j)==k:
# count+=1
# print(count)
ans=[0]*(n-1)
#i<j
for i in range(1,n):
for ... | 19 | 20 | 380 | 413 | n, x, y = map(int, input().split())
# a<b
def dis(a, b):
return min(b - a, abs(a - x) + 1 + abs(b - y))
# for k in range(1,n):
# count=0
# #i<j
# for i in range(1,n):
# for j in range(i+1,n+1):
# if dis(i,j)==k:
# count+=1
# print(count)
ans = [0] * (n - 1)
# i<j
for i in range(1, n):
... | n, x, y = list(map(int, input().split()))
# a<b
def dis(a, b):
return min(b - a, abs(a - x) + 1 + abs(b - y))
# for k in range(1,n):
# count=0
# #i<j
# for i in range(1,n):
# for j in range(i+1,n+1):
# if dis(i,j)==k:
# count+=1
# print(count)
ans = [0] * (n - 1)
# i<j
for i in range(1, ... | false | 5 | [
"-n, x, y = map(int, input().split())",
"+n, x, y = list(map(int, input().split()))",
"-print(*ans, sep=\"\\n\")",
"+# print(*ans,sep=\"\\n\")",
"+print((\"\\n\".join(map(str, ans))))"
] | false | 0.05645 | 0.03869 | 1.459023 | [
"s810994286",
"s707896741"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.