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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u510829608 | p02241 | python | s866720650 | s178618514 | 50 | 30 | 9,620 | 7,952 | Accepted | Accepted | 40 | import array
import collections
import heapq
INF = 1e9
N = int(eval(input()))
AdjacentVertex = collections.namedtuple('AdjacentVertex', 'vertex cost')
adjacency_list = collections.defaultdict(set)
NO_VERTEX = -1
def compute_mst_prim(max_v, adj_list):
pred = collections.defaultdict(lambda: NO_VER... | INF = 1e9
n = int(eval(input()))
adj_matrix = [list(map(int, input().split())) for i in range(n)]
def prim(x):
isVisited = [False] * x
d = [INF] * x
d[0] = 0
p = [-1] * x
while True:
min_cost = INF
for i in range(x):
if isVisited[i] != T... | 46 | 33 | 1,347 | 751 | import array
import collections
import heapq
INF = 1e9
N = int(eval(input()))
AdjacentVertex = collections.namedtuple("AdjacentVertex", "vertex cost")
adjacency_list = collections.defaultdict(set)
NO_VERTEX = -1
def compute_mst_prim(max_v, adj_list):
pred = collections.defaultdict(lambda: NO_VERTEX)
key = co... | INF = 1e9
n = int(eval(input()))
adj_matrix = [list(map(int, input().split())) for i in range(n)]
def prim(x):
isVisited = [False] * x
d = [INF] * x
d[0] = 0
p = [-1] * x
while True:
min_cost = INF
for i in range(x):
if isVisited[i] != True and d[i] < min_cost:
... | false | 28.26087 | [
"-import array",
"-import collections",
"-import heapq",
"-",
"-N = int(eval(input()))",
"-AdjacentVertex = collections.namedtuple(\"AdjacentVertex\", \"vertex cost\")",
"-adjacency_list = collections.defaultdict(set)",
"-NO_VERTEX = -1",
"+n = int(eval(input()))",
"+adj_matrix = [list(map(int, in... | false | 0.202729 | 0.04396 | 4.611685 | [
"s866720650",
"s178618514"
] |
u888092736 | p02598 | python | s007245376 | s252770948 | 1,149 | 790 | 31,496 | 31,528 | Accepted | Accepted | 31.24 | def count_cuts(a, unit):
return (a + unit - 1) // unit - 1
def is_good(mid, key):
return sum(count_cuts(a, mid) for a in A) <= key
def binary_search(key):
bad, good = 0, 1_000_000_000
while good - bad > 1:
mid = (bad + good) // 2
if is_good(mid, key):
good = ... | def is_good(mid, key):
res = 0
for a in A:
res += (a + mid - 1) // mid
return res - N <= key
def binary_search(bad, good, key):
while good - bad > 1:
mid = (bad + good) // 2
if is_good(mid, key):
good = mid
else:
bad = mid
retur... | 21 | 19 | 453 | 419 | def count_cuts(a, unit):
return (a + unit - 1) // unit - 1
def is_good(mid, key):
return sum(count_cuts(a, mid) for a in A) <= key
def binary_search(key):
bad, good = 0, 1_000_000_000
while good - bad > 1:
mid = (bad + good) // 2
if is_good(mid, key):
good = mid
e... | def is_good(mid, key):
res = 0
for a in A:
res += (a + mid - 1) // mid
return res - N <= key
def binary_search(bad, good, key):
while good - bad > 1:
mid = (bad + good) // 2
if is_good(mid, key):
good = mid
else:
bad = mid
return good
N, K,... | false | 9.52381 | [
"-def count_cuts(a, unit):",
"- return (a + unit - 1) // unit - 1",
"+def is_good(mid, key):",
"+ res = 0",
"+ for a in A:",
"+ res += (a + mid - 1) // mid",
"+ return res - N <= key",
"-def is_good(mid, key):",
"- return sum(count_cuts(a, mid) for a in A) <= key",
"-",
"-"... | false | 0.038191 | 0.036564 | 1.044481 | [
"s007245376",
"s252770948"
] |
u585482323 | p03030 | python | s385965736 | s858087810 | 203 | 185 | 39,152 | 39,152 | Accepted | Accepted | 8.87 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline()... | 76 | 42 | 1,353 | 954 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(m... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(x) for x in sys.stdin... | false | 44.736842 | [
"-from collections import defaultdict",
"-from collections import deque",
"+from collections import defaultdict, deque",
"- return list(map(int, sys.stdin.readline().split()))",
"+ return [int(x) for x in sys.stdin.readline().split()]",
"- return list(map(list, sys.stdin.readline().split()))",
... | false | 0.073262 | 0.037835 | 1.936367 | [
"s385965736",
"s858087810"
] |
u133936772 | p03435 | python | s513545800 | s218381500 | 30 | 27 | 9,060 | 9,168 | Accepted | Accepted | 10 | g=[[*map(int,input().split())]for _ in range(3)]
for h in [0,1]:
for w in [0,1]:
if g[h][w]+g[h+1][w+1]!=g[h+1][w]+g[h][w+1]:
exit(print('No'))
print('Yes')
| m=lambda:list(map(int,input().split()))
a,b,c=m()
d,e,f=m()
g,h,i=m()
print((['No','Yes'][d-a==e-b==f-c and g-a==h-b==i-c])) | 6 | 5 | 174 | 120 | g = [[*map(int, input().split())] for _ in range(3)]
for h in [0, 1]:
for w in [0, 1]:
if g[h][w] + g[h + 1][w + 1] != g[h + 1][w] + g[h][w + 1]:
exit(print("No"))
print("Yes")
| m = lambda: list(map(int, input().split()))
a, b, c = m()
d, e, f = m()
g, h, i = m()
print((["No", "Yes"][d - a == e - b == f - c and g - a == h - b == i - c]))
| false | 16.666667 | [
"-g = [[*map(int, input().split())] for _ in range(3)]",
"-for h in [0, 1]:",
"- for w in [0, 1]:",
"- if g[h][w] + g[h + 1][w + 1] != g[h + 1][w] + g[h][w + 1]:",
"- exit(print(\"No\"))",
"-print(\"Yes\")",
"+m = lambda: list(map(int, input().split()))",
"+a, b, c = m()",
"+d, ... | false | 0.043067 | 0.044591 | 0.965812 | [
"s513545800",
"s218381500"
] |
u893063840 | p02892 | python | s412606353 | s260777410 | 1,082 | 369 | 4,464 | 23,560 | Accepted | Accepted | 65.9 | from queue import Queue
def main():
n = int(eval(input()))
S = [list(map(int, eval(input()))) for _ in range(n)]
def bfs(s):
WHITE = 0
GRAY = 1
BLACK = 2
color = [WHITE] * n
d = [-1] * n
q = Queue()
q.put(s)
color[s] = GRA... | import numpy as np
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
def main():
n = int(eval(input()))
s = [list(map(int, eval(input()))) for _ in range(n)]
s = np.array(s)
g = csgraph_from_dense(s)
dist_mat = floyd_warshall(g).astype(np.int32)
dist_max = d... | 41 | 27 | 873 | 566 | from queue import Queue
def main():
n = int(eval(input()))
S = [list(map(int, eval(input()))) for _ in range(n)]
def bfs(s):
WHITE = 0
GRAY = 1
BLACK = 2
color = [WHITE] * n
d = [-1] * n
q = Queue()
q.put(s)
color[s] = GRAY
d[s] = 0
... | import numpy as np
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
def main():
n = int(eval(input()))
s = [list(map(int, eval(input()))) for _ in range(n)]
s = np.array(s)
g = csgraph_from_dense(s)
dist_mat = floyd_warshall(g).astype(np.int32)
dist_max = dist_mat.max()
... | false | 34.146341 | [
"-from queue import Queue",
"+import numpy as np",
"+from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall",
"- S = [list(map(int, eval(input()))) for _ in range(n)]",
"-",
"- def bfs(s):",
"- WHITE = 0",
"- GRAY = 1",
"- BLACK = 2",
"- color = [WHIT... | false | 0.045511 | 0.640739 | 0.071028 | [
"s412606353",
"s260777410"
] |
u814986259 | p03660 | python | s708828133 | s958333868 | 784 | 655 | 54,936 | 43,316 | Accepted | Accepted | 16.45 | N=int(eval(input()))
import collections
import heapq
ab=[tuple(map(int,input().split())) for i in range(N-1)]
G=[set() for i in range(N)]
for a,b in ab:
a-=1
b-=1
G[a].add(b)
G[b].add(a)
q=collections.deque()
dis=[[-1]*N for i in range(2)]
dis[0][0]=0
q.append(0)
while(q):
x=q.popleft()
fo... | import collections
N = int(eval(input()))
G = [set() for i in range(N)]
for i in range(N-1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].add(b)
G[b].add(a)
F = [-1]*N
F[0] = 0
q = collections.deque()
q.append(0)
while(q):
x = q.popleft()
for y in G[x]:
... | 64 | 59 | 1,204 | 1,019 | N = int(eval(input()))
import collections
import heapq
ab = [tuple(map(int, input().split())) for i in range(N - 1)]
G = [set() for i in range(N)]
for a, b in ab:
a -= 1
b -= 1
G[a].add(b)
G[b].add(a)
q = collections.deque()
dis = [[-1] * N for i in range(2)]
dis[0][0] = 0
q.append(0)
while q:
x = ... | import collections
N = int(eval(input()))
G = [set() for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].add(b)
G[b].add(a)
F = [-1] * N
F[0] = 0
q = collections.deque()
q.append(0)
while q:
x = q.popleft()
for y in G[x]:
if F[y] < 0:
... | false | 7.8125 | [
"+import collections",
"+",
"-import collections",
"-import heapq",
"-",
"-ab = [tuple(map(int, input().split())) for i in range(N - 1)]",
"-for a, b in ab:",
"+for i in range(N - 1):",
"+ a, b = list(map(int, input().split()))",
"+F = [-1] * N",
"+F[0] = 0",
"-dis = [[-1] * N for i in rang... | false | 0.067028 | 0.045517 | 1.472582 | [
"s708828133",
"s958333868"
] |
u823290900 | p02713 | python | s526139634 | s864830246 | 1,902 | 1,442 | 9,112 | 9,052 | Accepted | Accepted | 24.19 | from math import gcd
K = int(eval(input()))
ans = 0
for i in range(1, K+1):
for j in range(1, K+1):
for k in range(1, K+1):
ans += gcd(gcd(i, j), k)
print(ans) | import sys
from math import gcd
def solve(K: int):
ans = 0
for i in range(1, K+1):
for j in range(1, K+1):
for k in range(1, K+1):
ans += gcd(gcd(i, j), k)
print(ans)
return
def main():
def iterate_tokens():
for line in sys.stdin:... | 12 | 28 | 192 | 515 | from math import gcd
K = int(eval(input()))
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for k in range(1, K + 1):
ans += gcd(gcd(i, j), k)
print(ans)
| import sys
from math import gcd
def solve(K: int):
ans = 0
for i in range(1, K + 1):
for j in range(1, K + 1):
for k in range(1, K + 1):
ans += gcd(gcd(i, j), k)
print(ans)
return
def main():
def iterate_tokens():
for line in sys.stdin:
for... | false | 57.142857 | [
"+import sys",
"-K = int(eval(input()))",
"-ans = 0",
"-for i in range(1, K + 1):",
"- for j in range(1, K + 1):",
"- for k in range(1, K + 1):",
"- ans += gcd(gcd(i, j), k)",
"-print(ans)",
"+",
"+def solve(K: int):",
"+ ans = 0",
"+ for i in range(1, K + 1):",
"+... | false | 0.204518 | 0.155831 | 1.312436 | [
"s526139634",
"s864830246"
] |
u020390084 | p02913 | python | s262669049 | s581154448 | 677 | 104 | 48,476 | 9,636 | Accepted | Accepted | 84.64 | #!/usr/bin/env python3
import sys
def z_algo(S):
N = len(S)
LCPs = [0]*N
i = 1 ## iから何文字一致してるか調べる
j = 0
LCPs[0] = N
while i < N:
while i+j < N and S[j] == S[i+j]:
j += 1
if j == 0:
i += 1
continue
LCPs[i] = j
k ... | N = int(eval(input()))
S = eval(input())
mod = 10**9+7
base = 1234
power = [1]*(N+1)
for i in range(1, N+1):
power[i] = power[i-1]*base%mod
def check(m):
dic = {}
for i in range(N-m+1):
s = S[i:i+m]
if s in list(dic.keys()):
if dic[s]+m<=i:
return Tru... | 48 | 27 | 1,037 | 496 | #!/usr/bin/env python3
import sys
def z_algo(S):
N = len(S)
LCPs = [0] * N
i = 1 ## iから何文字一致してるか調べる
j = 0
LCPs[0] = N
while i < N:
while i + j < N and S[j] == S[i + j]:
j += 1
if j == 0:
i += 1
continue
LCPs[i] = j
k = 1
... | N = int(eval(input()))
S = eval(input())
mod = 10**9 + 7
base = 1234
power = [1] * (N + 1)
for i in range(1, N + 1):
power[i] = power[i - 1] * base % mod
def check(m):
dic = {}
for i in range(N - m + 1):
s = S[i : i + m]
if s in list(dic.keys()):
if dic[s] + m <= i:
... | false | 43.75 | [
"-#!/usr/bin/env python3",
"-import sys",
"+N = int(eval(input()))",
"+S = eval(input())",
"+mod = 10**9 + 7",
"+base = 1234",
"+power = [1] * (N + 1)",
"+for i in range(1, N + 1):",
"+ power[i] = power[i - 1] * base % mod",
"-def z_algo(S):",
"- N = len(S)",
"- LCPs = [0] * N",
"- ... | false | 0.037222 | 0.07488 | 0.497094 | [
"s262669049",
"s581154448"
] |
u600402037 | p02972 | python | s806161323 | s265766849 | 205 | 178 | 14,140 | 14,136 | Accepted | Accepted | 13.17 | def main(A,N):
A = [0] + A
for a in range(N-1,0,-1):
#print(inds[ind::ind+1])
if sum(A[a::a]) %2== 0:
A[a] = 0
else:
A[a] = 1
res = [x for x in range(0,N+1) if A[x]]
print((len(res)))
print((*res))
N = int(eval(input()))
A = [in... | def main(A,N):
A = [0] + A
for a in range(N//2,0,-1):
#print(inds[ind::ind+1])
if sum(A[a::a]) %2== 0:
A[a] = 0
else:
A[a] = 1
res = [x for x in range(0,N+1) if A[x]]
print((len(res)))
print((*res))
N = int(eval(input()))
A = [i... | 17 | 17 | 357 | 359 | def main(A, N):
A = [0] + A
for a in range(N - 1, 0, -1):
# print(inds[ind::ind+1])
if sum(A[a::a]) % 2 == 0:
A[a] = 0
else:
A[a] = 1
res = [x for x in range(0, N + 1) if A[x]]
print((len(res)))
print((*res))
N = int(eval(input()))
A = [int(x) for x ... | def main(A, N):
A = [0] + A
for a in range(N // 2, 0, -1):
# print(inds[ind::ind+1])
if sum(A[a::a]) % 2 == 0:
A[a] = 0
else:
A[a] = 1
res = [x for x in range(0, N + 1) if A[x]]
print((len(res)))
print((*res))
N = int(eval(input()))
A = [int(x) for x... | false | 0 | [
"- for a in range(N - 1, 0, -1):",
"+ for a in range(N // 2, 0, -1):"
] | false | 0.047424 | 0.112182 | 0.422738 | [
"s806161323",
"s265766849"
] |
u941407962 | p02763 | python | s205605071 | s598990040 | 920 | 739 | 164,952 | 172,228 | Accepted | Accepted | 19.67 | import sys
input = sys.stdin.readline
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
if i == 0:
return 0
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
... | import sys
input = sys.stdin.readline
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
... | 49 | 44 | 1,107 | 1,062 | import sys
input = sys.stdin.readline
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
if i == 0:
return 0
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(sel... | import sys
input = sys.stdin.readline
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self.size:
... | false | 10.204082 | [
"- if i == 0:",
"- return 0",
"-aas = \"abcdefghijklmnopqrstuvwxyz\"",
"-N = int(input().strip())",
"-S = [\" \"] + list(input().strip())",
"-Q = int(input().strip())",
"-cbt = dict()",
"-for c in aas:",
"- cbt[c] = Bit(N)",
"- for i, a in enumerate(S):",
"- if i =... | false | 0.116716 | 0.037492 | 3.113138 | [
"s205605071",
"s598990040"
] |
u098012509 | p02585 | python | s747428058 | s195937136 | 1,021 | 779 | 74,196 | 74,004 | Accepted | Accepted | 23.7 | import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
N, K = [int(x) for x in input().split()]
P = [int(x) - 1 for x in input().split()]
C = [int(x) for x in input().split()]
ans = max(C)
for i in range(N):
next = P[i]
cnt = 0
t... | import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
N, K = [int(x) for x in input().split()]
P = [int(x) - 1 for x in input().split()]
C = [int(x) for x in input().split()]
ans = max(C)
for i in range(N):
next = P[i]
cnt = 0
c... | 49 | 40 | 997 | 840 | import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
N, K = [int(x) for x in input().split()]
P = [int(x) - 1 for x in input().split()]
C = [int(x) for x in input().split()]
ans = max(C)
for i in range(N):
next = P[i]
cnt = 0
tmp = 0
while... | import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
N, K = [int(x) for x in input().split()]
P = [int(x) - 1 for x in input().split()]
C = [int(x) for x in input().split()]
ans = max(C)
for i in range(N):
next = P[i]
cnt = 0
cycle_value = 0
... | false | 18.367347 | [
"+ cycle_value = 0",
"+ while True:",
"+ cycle_value += C[next]",
"+ cnt += 1",
"+ if next == i:",
"+ break",
"+ next = P[next]",
"+ j = 0",
"+ next = P[i]",
"- ans = max(ans, tmp)",
"- c... | false | 0.039451 | 0.036986 | 1.066644 | [
"s747428058",
"s195937136"
] |
u089032001 | p03241 | python | s957257180 | s886426608 | 23 | 21 | 3,064 | 3,060 | Accepted | Accepted | 8.7 | from itertools import product
N, M = list(map(int, input().split()))
max_ans = M // N
ans = 1
tmp = 2
tmpM = M
max_prime = int(M ** 0.5)
all_list = []
i = -1
k = 0
div = 2
while tmpM != 1:
if tmpM % div == 0:
tmpM = tmpM // div
if k == 0:
i += 1
all_list... | N, M = list(map(int, input().split()))
max_ans = M // N
ans = 1
for n in range(1, int(M ** 0.5) + 1):
if M % n != 0:
continue
if n <= max_ans:
ans = max(ans, n)
if M // n <= max_ans:
ans = max(ans, M // n)
print(ans) | 51 | 16 | 875 | 266 | from itertools import product
N, M = list(map(int, input().split()))
max_ans = M // N
ans = 1
tmp = 2
tmpM = M
max_prime = int(M**0.5)
all_list = []
i = -1
k = 0
div = 2
while tmpM != 1:
if tmpM % div == 0:
tmpM = tmpM // div
if k == 0:
i += 1
all_list.append(set())
... | N, M = list(map(int, input().split()))
max_ans = M // N
ans = 1
for n in range(1, int(M**0.5) + 1):
if M % n != 0:
continue
if n <= max_ans:
ans = max(ans, n)
if M // n <= max_ans:
ans = max(ans, M // n)
print(ans)
| false | 68.627451 | [
"-from itertools import product",
"-",
"-tmp = 2",
"-tmpM = M",
"-max_prime = int(M**0.5)",
"-all_list = []",
"-i = -1",
"-k = 0",
"-div = 2",
"-while tmpM != 1:",
"- if tmpM % div == 0:",
"- tmpM = tmpM // div",
"- if k == 0:",
"- i += 1",
"- all_l... | false | 0.043203 | 0.045253 | 0.954682 | [
"s957257180",
"s886426608"
] |
u543954314 | p02647 | python | s825995352 | s155077452 | 1,173 | 881 | 125,696 | 129,840 | Accepted | Accepted | 24.89 | import sys
from itertools import accumulate
from numba import njit
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, ... | import sys
from numba import njit
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')
@njit(cache=True)
de... | 35 | 37 | 830 | 865 | import sys
from itertools import accumulate
from numba import njit
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep="\n")
... | import sys
from numba import njit
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep="\n")
@njit(cache=True)
def solve(n, ... | false | 5.405405 | [
"-from itertools import accumulate",
"-@njit",
"+@njit(cache=True)",
"+ if k == 0:",
"+ return a",
"+solve(0, 0, [0, 1, 2])"
] | false | 0.139842 | 0.089991 | 1.553957 | [
"s825995352",
"s155077452"
] |
u820839927 | p03035 | python | s515780514 | s215401891 | 174 | 22 | 38,256 | 3,316 | Accepted | Accepted | 87.36 | import os, sys, re, math
A,B = [int(s) for s in input().split(' ')]
if A < 6:
print((0))
elif 6 <= A and A <= 12:
print((int(B/2)))
else:
print(B)
| import os, sys, re, math
A,B = list(map(int,input().split(' ')))
if A >= 13:
print(B)
elif A >= 6:
print((B // 2))
else:
print((0)) | 10 | 9 | 166 | 139 | import os, sys, re, math
A, B = [int(s) for s in input().split(" ")]
if A < 6:
print((0))
elif 6 <= A and A <= 12:
print((int(B / 2)))
else:
print(B)
| import os, sys, re, math
A, B = list(map(int, input().split(" ")))
if A >= 13:
print(B)
elif A >= 6:
print((B // 2))
else:
print((0))
| false | 10 | [
"-A, B = [int(s) for s in input().split(\" \")]",
"-if A < 6:",
"+A, B = list(map(int, input().split(\" \")))",
"+if A >= 13:",
"+ print(B)",
"+elif A >= 6:",
"+ print((B // 2))",
"+else:",
"-elif 6 <= A and A <= 12:",
"- print((int(B / 2)))",
"-else:",
"- print(B)"
] | false | 0.037894 | 0.045218 | 0.838027 | [
"s515780514",
"s215401891"
] |
u564589929 | p03087 | python | s716641543 | s523548165 | 356 | 276 | 53,068 | 6,380 | Accepted | Accepted | 22.47 | import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): return ... | import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): return ... | 36 | 36 | 823 | 826 | import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split()))
def LI1... | import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def MI1():
return list(map(int1, input().split()))
def LI():
return list(map(int, input().split()))
def LI1... | false | 0 | [
"- ats = [0]",
"+ ats = [0] * n",
"- ats.append(cnt)",
"+ ats[i + 1] = cnt"
] | false | 0.044529 | 0.092631 | 0.480716 | [
"s716641543",
"s523548165"
] |
u072717685 | p02596 | python | s348978984 | s547630275 | 193 | 140 | 9,048 | 9,124 | Accepted | Accepted | 27.46 | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
k = int(eval(input()))
if k % 2 == 0 or k % 5 == 0:
print((-1))
sys.exit()
p = 7 # '7,77,777…'のmod kをいれる変数
plus = 7 # '70,700,7000…'のmod kをいれる変数
r = 1 # カウント
while (p % k) != 0:... | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
k = int(eval(input()))
if k % 2 == 0 or k % 5 == 0:
print((-1))
sys.exit()
if k % 7 == 0:
l = k * 9 // 7
else:
l = k * 9
r = 1 # カウント
p = 10 ** r
while (p % l) != ... | 20 | 21 | 548 | 413 | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
k = int(eval(input()))
if k % 2 == 0 or k % 5 == 0:
print((-1))
sys.exit()
p = 7 # '7,77,777…'のmod kをいれる変数
plus = 7 # '70,700,7000…'のmod kをいれる変数
r = 1 # カウント
while (p % k) != 0: # kで割り切れるかチェック
... | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
k = int(eval(input()))
if k % 2 == 0 or k % 5 == 0:
print((-1))
sys.exit()
if k % 7 == 0:
l = k * 9 // 7
else:
l = k * 9
r = 1 # カウント
p = 10**r
while (p % l) != 1:
p = (p ... | false | 4.761905 | [
"- p = 7 # '7,77,777…'のmod kをいれる変数",
"- plus = 7 # '70,700,7000…'のmod kをいれる変数",
"+ if k % 7 == 0:",
"+ l = k * 9 // 7",
"+ else:",
"+ l = k * 9",
"- while (p % k) != 0: # kで割り切れるかチェック",
"- plus = (plus * 10) % k # pに足すもう1桁のmod kを計算。",
"- p += plus # pに... | false | 0.11339 | 0.097437 | 1.163726 | [
"s348978984",
"s547630275"
] |
u347600233 | p02689 | python | s539190357 | s152705799 | 486 | 405 | 46,136 | 29,480 | Accepted | Accepted | 16.67 | n, m = list(map(int, input().split()))
h = [int(i) for i in input().split()]
path = [[] for i in range(n)]
set_path = set()
for i in range(m):
a, b = list(map(int, input().split()))
path[a - 1].append(b - 1)
path[b - 1].append(a - 1)
set_path |= set((a - 1, b - 1))
cnt = n - len(set_path)
path... | n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
to = [[] for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
to[a - 1] += [b - 1]
to[b - 1] += [a - 1]
print((sum(to[j] == [] or h[j] > max(h[i] for i in to[j]) for j in range(n)))) | 15 | 8 | 433 | 286 | n, m = list(map(int, input().split()))
h = [int(i) for i in input().split()]
path = [[] for i in range(n)]
set_path = set()
for i in range(m):
a, b = list(map(int, input().split()))
path[a - 1].append(b - 1)
path[b - 1].append(a - 1)
set_path |= set((a - 1, b - 1))
cnt = n - len(set_path)
path_ = {int(i... | n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
to = [[] for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
to[a - 1] += [b - 1]
to[b - 1] += [a - 1]
print((sum(to[j] == [] or h[j] > max(h[i] for i in to[j]) for j in range(n))))
| false | 46.666667 | [
"-h = [int(i) for i in input().split()]",
"-path = [[] for i in range(n)]",
"-set_path = set()",
"+h = list(map(int, input().split()))",
"+to = [[] for i in range(n)]",
"- path[a - 1].append(b - 1)",
"- path[b - 1].append(a - 1)",
"- set_path |= set((a - 1, b - 1))",
"-cnt = n - len(set_pat... | false | 0.05026 | 0.045605 | 1.102053 | [
"s539190357",
"s152705799"
] |
u576398884 | p02257 | python | s820151179 | s294118303 | 3,000 | 40 | 7,776 | 7,704 | Accepted | Accepted | 98.67 | import math
ans = 0
N = int(eval(input()))
for i in range(N):
a = int(eval(input()))
if a != 2 and a%2 == 0:
continue
b = True
for j in range(3, int(math.sqrt(a))+1, 2):
if a%j == 0:
b = False
if b:
ans += 1
print(ans) | ans = 0
N = int(eval(input()))
for i in range(N):
a = int(eval(input()))
if a == 2:
ans += 1
elif a%2 == 0:
continue
else:
if pow(2, a-1, a) == 1:
ans += 1
print(ans) | 16 | 13 | 279 | 219 | import math
ans = 0
N = int(eval(input()))
for i in range(N):
a = int(eval(input()))
if a != 2 and a % 2 == 0:
continue
b = True
for j in range(3, int(math.sqrt(a)) + 1, 2):
if a % j == 0:
b = False
if b:
ans += 1
print(ans)
| ans = 0
N = int(eval(input()))
for i in range(N):
a = int(eval(input()))
if a == 2:
ans += 1
elif a % 2 == 0:
continue
else:
if pow(2, a - 1, a) == 1:
ans += 1
print(ans)
| false | 18.75 | [
"-import math",
"-",
"- if a != 2 and a % 2 == 0:",
"+ if a == 2:",
"+ ans += 1",
"+ elif a % 2 == 0:",
"- b = True",
"- for j in range(3, int(math.sqrt(a)) + 1, 2):",
"- if a % j == 0:",
"- b = False",
"- if b:",
"- ans += 1",
"+ else:",
... | false | 0.064082 | 0.063001 | 1.017146 | [
"s820151179",
"s294118303"
] |
u226155577 | p03083 | python | s487825930 | s229337428 | 641 | 592 | 70,008 | 65,912 | Accepted | Accepted | 7.64 | import sys
B, W = list(map(int, sys.stdin.readline().split()))
MOD = 10**9 + 7
L = B+W
fact = [1]*(L+1)
rfact = [1]*(L+1)
for i in range(L):
fact[i+1] = r = fact[i] * (i+1) % MOD
rfact[i+1] = pow(r, MOD-2, MOD)
rev2 = pow(2, MOD-2, MOD)
p = q = 0
base = 1
ans = ["%d\n" % rev2]
for i in rang... | import sys
B, W = list(map(int, sys.stdin.readline().split()))
MOD = 10**9 + 7
L = B+W
fact = [1]*(L+1)
rfact = [1]*(L+1)
for i in range(L):
fact[i+1] = r = fact[i] * (i+1) % MOD
rfact[i+1] = pow(r, MOD-2, MOD)
rev2 = pow(2, MOD-2, MOD)
p = q = 0
base = 1
ans = ["%d\n" % rev2]
for i in rang... | 25 | 25 | 617 | 633 | import sys
B, W = list(map(int, sys.stdin.readline().split()))
MOD = 10**9 + 7
L = B + W
fact = [1] * (L + 1)
rfact = [1] * (L + 1)
for i in range(L):
fact[i + 1] = r = fact[i] * (i + 1) % MOD
rfact[i + 1] = pow(r, MOD - 2, MOD)
rev2 = pow(2, MOD - 2, MOD)
p = q = 0
base = 1
ans = ["%d\n" % rev2]
for i in rang... | import sys
B, W = list(map(int, sys.stdin.readline().split()))
MOD = 10**9 + 7
L = B + W
fact = [1] * (L + 1)
rfact = [1] * (L + 1)
for i in range(L):
fact[i + 1] = r = fact[i] * (i + 1) % MOD
rfact[i + 1] = pow(r, MOD - 2, MOD)
rev2 = pow(2, MOD - 2, MOD)
p = q = 0
base = 1
ans = ["%d\n" % rev2]
for i in rang... | false | 0 | [
"- p = (p + (fact[i - 1] * rfact[B - 1] * rfact[i - B] % MOD) * base % MOD) % MOD",
"+ p = (",
"+ p + ((fact[i - 1] * rfact[B - 1] % MOD) * rfact[i - B] % MOD) * base % MOD",
"+ ) % MOD",
"- q = (q + (fact[i - 1] * rfact[W - 1] * rfact[i - W] % MOD) * base % MOD) % MOD... | false | 0.058631 | 0.099996 | 0.586331 | [
"s487825930",
"s229337428"
] |
u197300773 | p03476 | python | s737327748 | s167896180 | 858 | 242 | 5,144 | 5,460 | Accepted | Accepted | 71.79 | import math
def sieve(n):
if n < 2:
is_prime = [False for _ in range(n+1)]
return is_prime
is_prime = [True for _ in range(n+1)]
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5)+1):
if is_prime[i]:
for j in range(i*2, n+1, i):
... | import sys
def sieve(n):
if n < 2:
is_prime = [False for _ in range(n+1)]
return is_prime
is_prime = [True for _ in range(n+1)]
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5)+1):
if is_prime[i]:
for j in range(i*2, n+1, i):
... | 28 | 37 | 615 | 816 | import math
def sieve(n):
if n < 2:
is_prime = [False for _ in range(n + 1)]
return is_prime
is_prime = [True for _ in range(n + 1)]
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if is_prime[i]:
for j in range(i * 2, n + 1, i):
... | import sys
def sieve(n):
if n < 2:
is_prime = [False for _ in range(n + 1)]
return is_prime
is_prime = [True for _ in range(n + 1)]
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if is_prime[i]:
for j in range(i * 2, n + 1, i):
... | false | 24.324324 | [
"-import math",
"+import sys",
"-N = 10**5",
"-prime = sieve(N)",
"-a = [0 for i in range(N + 1)]",
"-for i in range(3, N):",
"- if prime[i] and prime[(i + 1) // 2]:",
"- a[i] = a[i - 1] + 1",
"- else:",
"- a[i] = a[i - 1]",
"-Q = int(eval(input()))",
"-for i in range(Q):",... | false | 0.482191 | 0.068064 | 7.084394 | [
"s737327748",
"s167896180"
] |
u729133443 | p02783 | python | s015672400 | s455901674 | 183 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.71 | print((-eval(input().replace(' ','//-')))) | a,b=list(map(int,input().split()))
print((0--a//b)) | 1 | 2 | 40 | 44 | print((-eval(input().replace(" ", "//-"))))
| a, b = list(map(int, input().split()))
print((0 - -a // b))
| false | 50 | [
"-print((-eval(input().replace(\" \", \"//-\"))))",
"+a, b = list(map(int, input().split()))",
"+print((0 - -a // b))"
] | false | 0.042593 | 0.03905 | 1.090729 | [
"s015672400",
"s455901674"
] |
u644907318 | p04030 | python | s758390486 | s853178423 | 163 | 69 | 38,256 | 61,608 | Accepted | Accepted | 57.67 | s = input().strip()
x = ""
for i in range(len(s)):
a = s[i]
if a!="B":
x += s[i]
elif len(x)>0:
x = x[:-1]
print(x) | s = input().strip()
x = ""
cur = 0
for i in range(len(s)):
if s[i]=="0":
x += "0"
cur += 1
elif s[i]=="1":
x += "1"
cur += 1
else:
if cur>0:
x = x[:-1]
cur -= 1
print(x) | 9 | 15 | 151 | 259 | s = input().strip()
x = ""
for i in range(len(s)):
a = s[i]
if a != "B":
x += s[i]
elif len(x) > 0:
x = x[:-1]
print(x)
| s = input().strip()
x = ""
cur = 0
for i in range(len(s)):
if s[i] == "0":
x += "0"
cur += 1
elif s[i] == "1":
x += "1"
cur += 1
else:
if cur > 0:
x = x[:-1]
cur -= 1
print(x)
| false | 40 | [
"+cur = 0",
"- a = s[i]",
"- if a != \"B\":",
"- x += s[i]",
"- elif len(x) > 0:",
"- x = x[:-1]",
"+ if s[i] == \"0\":",
"+ x += \"0\"",
"+ cur += 1",
"+ elif s[i] == \"1\":",
"+ x += \"1\"",
"+ cur += 1",
"+ else:",
"+ if... | false | 0.148567 | 0.078798 | 1.885399 | [
"s758390486",
"s853178423"
] |
u645250356 | p02936 | python | s555420915 | s934299313 | 1,971 | 959 | 237,760 | 122,000 | Accepted | Accepted | 51.34 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.rea... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
... | 33 | 32 | 841 | 752 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, pprint, fractions
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
mod2 = 998244353
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(in... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.read... | false | 3.030303 | [
"-import sys, bisect, math, itertools, pprint, fractions",
"+import sys, bisect, math, itertools, fractions, pprint",
"-mod2 = 998244353",
"-def inpln(n):",
"- return list(int(sys.stdin.readline()) for i in range(n))",
"-",
"-",
"-g = [[] for i in range(n)]",
"-c = [0 for i in range(n)]",
"-see... | false | 0.03608 | 0.036835 | 0.97952 | [
"s555420915",
"s934299313"
] |
u159117533 | p02819 | python | s992484236 | s305853026 | 369 | 251 | 10,868 | 10,868 | Accepted | Accepted | 31.98 | X = int(eval(input()))
LEN = int(1e6)
p = [True] * LEN
p[0] = False
p[1] = False
for i in range(LEN):
if p[i]:
for j in range(i * 2, LEN, i):
p[j] = False
for i in range(X, LEN):
if p[i]:
print(i)
exit()
| X = int(eval(input()))
LEN = int(1e6)
p = [True] * LEN
p[0] = False
p[1] = False
for i in range(LEN):
if p[i]:
if i >= X:
print(i)
exit()
for j in range(i * 2, LEN, i):
p[j] = False
| 16 | 16 | 238 | 229 | X = int(eval(input()))
LEN = int(1e6)
p = [True] * LEN
p[0] = False
p[1] = False
for i in range(LEN):
if p[i]:
for j in range(i * 2, LEN, i):
p[j] = False
for i in range(X, LEN):
if p[i]:
print(i)
exit()
| X = int(eval(input()))
LEN = int(1e6)
p = [True] * LEN
p[0] = False
p[1] = False
for i in range(LEN):
if p[i]:
if i >= X:
print(i)
exit()
for j in range(i * 2, LEN, i):
p[j] = False
| false | 0 | [
"+ if i >= X:",
"+ print(i)",
"+ exit()",
"-for i in range(X, LEN):",
"- if p[i]:",
"- print(i)",
"- exit()"
] | false | 0.715583 | 0.529426 | 1.351619 | [
"s992484236",
"s305853026"
] |
u045793300 | p03844 | python | s652860729 | s796372858 | 27 | 24 | 8,980 | 8,916 | Accepted | Accepted | 11.11 | a, op, b = input().split()
a,b = int(a), int(b)
print((a+b if op == '+' else a-b)) | s = eval(input())
print((eval(s))) | 3 | 2 | 82 | 27 | a, op, b = input().split()
a, b = int(a), int(b)
print((a + b if op == "+" else a - b))
| s = eval(input())
print((eval(s)))
| false | 33.333333 | [
"-a, op, b = input().split()",
"-a, b = int(a), int(b)",
"-print((a + b if op == \"+\" else a - b))",
"+s = eval(input())",
"+print((eval(s)))"
] | false | 0.079062 | 0.035805 | 2.20811 | [
"s652860729",
"s796372858"
] |
u183840468 | p02813 | python | s221424640 | s859697236 | 36 | 27 | 8,308 | 8,052 | Accepted | Accepted | 25 | import itertools
n = int(eval(input()))
l = sorted(list(itertools.permutations([i for i in range(1,n+1)])))
al = tuple([int(i) for i in input().split()])
bl = tuple([int(i) for i in input().split()])
a,b = 0,0
if al == bl:
print((0))
else:
for idx,i in enumerate(l):
if i == al:
... | import itertools
n = int(eval(input()))
pl = tuple([int(i) for i in input().split()])
ql = tuple([int(i) for i in input().split()])
all_list = list(itertools.permutations(list(range(1,n+1))))
print((abs(all_list.index(pl) - all_list.index(ql))))
| 24 | 9 | 437 | 243 | import itertools
n = int(eval(input()))
l = sorted(list(itertools.permutations([i for i in range(1, n + 1)])))
al = tuple([int(i) for i in input().split()])
bl = tuple([int(i) for i in input().split()])
a, b = 0, 0
if al == bl:
print((0))
else:
for idx, i in enumerate(l):
if i == al:
a = id... | import itertools
n = int(eval(input()))
pl = tuple([int(i) for i in input().split()])
ql = tuple([int(i) for i in input().split()])
all_list = list(itertools.permutations(list(range(1, n + 1))))
print((abs(all_list.index(pl) - all_list.index(ql))))
| false | 62.5 | [
"-l = sorted(list(itertools.permutations([i for i in range(1, n + 1)])))",
"-al = tuple([int(i) for i in input().split()])",
"-bl = tuple([int(i) for i in input().split()])",
"-a, b = 0, 0",
"-if al == bl:",
"- print((0))",
"-else:",
"- for idx, i in enumerate(l):",
"- if i == al:",
"... | false | 0.050181 | 0.049827 | 1.007095 | [
"s221424640",
"s859697236"
] |
u648315264 | p03281 | python | s807241553 | s458721161 | 75 | 68 | 62,772 | 63,060 | Accepted | Accepted | 9.33 | import sys
input=sys.stdin.readline
def main():
cnt = 0
n = int(eval(input()))
for i in range(1,n+1):
if i % 2 == 1: # 奇数判定
k = 0
for m in range(1,i+1):
if i % m == 0:
k += 1
if k == 8:
cnt += 1
... | import sys
input=sys.stdin.readline
def main():
cnt = 0
n = int(eval(input()))
for i in range(1,n+1,2): # 奇数だけ繰り返す
k = 0
for m in range(1,i+1):
if i % m == 0:
k += 1
if k == 8:
cnt += 1
print(cnt)
if __name__=="__main__":
... | 18 | 17 | 367 | 325 | import sys
input = sys.stdin.readline
def main():
cnt = 0
n = int(eval(input()))
for i in range(1, n + 1):
if i % 2 == 1: # 奇数判定
k = 0
for m in range(1, i + 1):
if i % m == 0:
k += 1
if k == 8:
cnt += 1
p... | import sys
input = sys.stdin.readline
def main():
cnt = 0
n = int(eval(input()))
for i in range(1, n + 1, 2): # 奇数だけ繰り返す
k = 0
for m in range(1, i + 1):
if i % m == 0:
k += 1
if k == 8:
cnt += 1
print(cnt)
if __name__ == "__main__":
... | false | 5.555556 | [
"- for i in range(1, n + 1):",
"- if i % 2 == 1: # 奇数判定",
"- k = 0",
"- for m in range(1, i + 1):",
"- if i % m == 0:",
"- k += 1",
"- if k == 8:",
"- cnt += 1",
"+ for i in range(1, n + 1, 2): # 奇数だけ繰り返... | false | 0.042922 | 0.047366 | 0.906185 | [
"s807241553",
"s458721161"
] |
u775681539 | p02888 | python | s067029999 | s519593500 | 960 | 511 | 3,188 | 213,936 | Accepted | Accepted | 46.77 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from itertools import combinations
from bisect import bisect_left
def main():
N = int(readline())
L = [int(i) for i in readline().split()]
L.sort()
sig = 0
for i in range(N... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from itertools import combinations
def main():
N = int(readline())
L = [int(i) for i in readline().split()]
#ソートしておく
L.sort()
#最長以外の二辺を先に決める
#インデックスで二辺を選ぶ。最長の辺はjよりイ... | 18 | 39 | 486 | 922 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from itertools import combinations
from bisect import bisect_left
def main():
N = int(readline())
L = [int(i) for i in readline().split()]
L.sort()
sig = 0
for i in range(N):
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from itertools import combinations
def main():
N = int(readline())
L = [int(i) for i in readline().split()]
# ソートしておく
L.sort()
# 最長以外の二辺を先に決める
# インデックスで二辺を選ぶ。最長の辺はjよりインデックスが大きいも... | false | 53.846154 | [
"-from bisect import bisect_left",
"+ # ソートしておく",
"- sig = 0",
"- for i in range(N):",
"- for j in range(i + 1, N):",
"- l = bisect_left(L, L[i] + L[j], j + 1)",
"- sig += l - j - 1",
"- print(sig)",
"+ # 最長以外の二辺を先に決める",
"+ # インデックスで二辺を選ぶ。最長の辺はjよりインデッ... | false | 0.237003 | 0.078422 | 3.022154 | [
"s067029999",
"s519593500"
] |
u432805419 | p04011 | python | s529432151 | s537647990 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | a = [int(eval(input())) for i in range(4)]
if a[0] <= a[1]:
print((a[0]*a[2]))
else:
print((a[1]*a[2] + (a[0]-a[1])*a[3])) | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
if a > b:
print((b*c+(a-b)*d))
else:
print((a*c)) | 5 | 9 | 120 | 126 | a = [int(eval(input())) for i in range(4)]
if a[0] <= a[1]:
print((a[0] * a[2]))
else:
print((a[1] * a[2] + (a[0] - a[1]) * a[3]))
| a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
if a > b:
print((b * c + (a - b) * d))
else:
print((a * c))
| false | 44.444444 | [
"-a = [int(eval(input())) for i in range(4)]",
"-if a[0] <= a[1]:",
"- print((a[0] * a[2]))",
"+a = int(eval(input()))",
"+b = int(eval(input()))",
"+c = int(eval(input()))",
"+d = int(eval(input()))",
"+if a > b:",
"+ print((b * c + (a - b) * d))",
"- print((a[1] * a[2] + (a[0] - a[1]) *... | false | 0.038086 | 0.072597 | 0.524626 | [
"s529432151",
"s537647990"
] |
u747602774 | p04029 | python | s173571243 | s236209051 | 164 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.63 | N=int(eval(input()))
S=(N+1)*N//2
print(S) | n = int(eval(input()))
print((n*(n+1)//2)) | 3 | 2 | 38 | 35 | N = int(eval(input()))
S = (N + 1) * N // 2
print(S)
| n = int(eval(input()))
print((n * (n + 1) // 2))
| false | 33.333333 | [
"-N = int(eval(input()))",
"-S = (N + 1) * N // 2",
"-print(S)",
"+n = int(eval(input()))",
"+print((n * (n + 1) // 2))"
] | false | 0.036708 | 0.080466 | 0.456195 | [
"s173571243",
"s236209051"
] |
u604839890 | p02658 | python | s402321287 | s883236267 | 105 | 86 | 89,772 | 21,608 | Accepted | Accepted | 18.1 | n = int(eval(input()))
a = list(map(int, input().split()))
b = sorted(a)
ans = 1
for val in b:
ans *= val
if ans > 10**18:
print((-1))
exit()
print(ans) | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
a.sort()
if a[0] == 0:
print((0))
exit()
for i in a:
ans *= i
if ans > 10**18:
print((-1))
exit()
print(ans) | 10 | 13 | 165 | 209 | n = int(eval(input()))
a = list(map(int, input().split()))
b = sorted(a)
ans = 1
for val in b:
ans *= val
if ans > 10**18:
print((-1))
exit()
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
a.sort()
if a[0] == 0:
print((0))
exit()
for i in a:
ans *= i
if ans > 10**18:
print((-1))
exit()
print(ans)
| false | 23.076923 | [
"-b = sorted(a)",
"-for val in b:",
"- ans *= val",
"+a.sort()",
"+if a[0] == 0:",
"+ print((0))",
"+ exit()",
"+for i in a:",
"+ ans *= i"
] | false | 0.049128 | 0.050214 | 0.97836 | [
"s402321287",
"s883236267"
] |
u767797498 | p02642 | python | s072335535 | s195682181 | 891 | 546 | 86,548 | 32,056 | Accepted | Accepted | 38.72 | n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
# 小さい側から処理する。a[i]について、10**6 以下のすべての倍数をset()として持つ。
# ただし、set内に存在しない==初出の約数のみ倍数計算をしてカウントする。
# 例えば、2,6,... となった場合、(6の倍数セットは2の倍数セットの下位集合となるため計算不要)
s=set()
cnt=0
for i,aa in enumerate(a):
if aa not in s:
# 同値が複数ある場合、カウントしない。sortしているため、同値は並ぶ
... | # 30分ぐらい?で溶けた!計算量は直感だよりだったが。
# → エラトステネスの篩 に相当する実装らしい。
# リスト内の倍数・約数関係を判定し、カウントする。
# 二重ループで判定するとTLEになるため、小さい値の可能な倍数を計算して保存するようにした。
# メモを set() ではなく 配列 で実装するテスト
n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
# 小さい側から処理する。a[i]について、10**6 以下のすべての倍数をset()として持つ。
# ただし、set内に存在しない==初出の約数のみ倍数計算をしてカ... | 24 | 32 | 493 | 646 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
# 小さい側から処理する。a[i]について、10**6 以下のすべての倍数をset()として持つ。
# ただし、set内に存在しない==初出の約数のみ倍数計算をしてカウントする。
# 例えば、2,6,... となった場合、(6の倍数セットは2の倍数セットの下位集合となるため計算不要)
s = set()
cnt = 0
for i, aa in enumerate(a):
if aa not in s:
# 同値が複数ある場合、カウントしない。sortしているため、同値は並ぶ... | # 30分ぐらい?で溶けた!計算量は直感だよりだったが。
# → エラトステネスの篩 に相当する実装らしい。
# リスト内の倍数・約数関係を判定し、カウントする。
# 二重ループで判定するとTLEになるため、小さい値の可能な倍数を計算して保存するようにした。
# メモを set() ではなく 配列 で実装するテスト
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
# 小さい側から処理する。a[i]について、10**6 以下のすべての倍数をset()として持つ。
# ただし、set内に存在しない==初出の約数のみ倍数計算をしてカウントする。
# 例... | false | 25 | [
"+# 30分ぐらい?で溶けた!計算量は直感だよりだったが。",
"+# → エラトステネスの篩 に相当する実装らしい。",
"+# リスト内の倍数・約数関係を判定し、カウントする。",
"+# 二重ループで判定するとTLEになるため、小さい値の可能な倍数を計算して保存するようにした。",
"+# メモを set() ではなく 配列 で実装するテスト",
"-s = set()",
"+s = [False] * (10**6 + 1)",
"- if aa not in s:",
"- # 同値が複数ある場合、カウントしない。sortしているため、同値は並ぶ",
"-... | false | 0.240182 | 0.395694 | 0.606988 | [
"s072335535",
"s195682181"
] |
u777283665 | p03695 | python | s344445872 | s702286988 | 168 | 18 | 38,256 | 3,064 | Accepted | Accepted | 89.29 | from bisect import bisect_right
n = int(eval(input()))
a = list(map(int, input().split()))
r = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
c = [0] * 9
for score in a:
i = bisect_right(r, score)
c[i] += 1
ans = 8 - c[:-1].count(0)
print((max(1, ans), ans + c[8])) | n = int(eval(input()))
a = list(map(int, input().split()))
r = [0] * 9
for i in a:
temp = i // 400
if temp <= 8:
r[temp] += 1
else:
r[8] += 1
c = sum([1 for i in r[:-1] if i != 0])
t = r[-1]
if c == 0:
print((1, t))
else:
print((c, c+t)) | 15 | 17 | 278 | 281 | from bisect import bisect_right
n = int(eval(input()))
a = list(map(int, input().split()))
r = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
c = [0] * 9
for score in a:
i = bisect_right(r, score)
c[i] += 1
ans = 8 - c[:-1].count(0)
print((max(1, ans), ans + c[8]))
| n = int(eval(input()))
a = list(map(int, input().split()))
r = [0] * 9
for i in a:
temp = i // 400
if temp <= 8:
r[temp] += 1
else:
r[8] += 1
c = sum([1 for i in r[:-1] if i != 0])
t = r[-1]
if c == 0:
print((1, t))
else:
print((c, c + t))
| false | 11.764706 | [
"-from bisect import bisect_right",
"-",
"-r = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]",
"-c = [0] * 9",
"-for score in a:",
"- i = bisect_right(r, score)",
"- c[i] += 1",
"-ans = 8 - c[:-1].count(0)",
"-print((max(1, ans), ans + c[8]))",
"+r = [0] * 9",
"+for i in a:",
"+ temp... | false | 0.055423 | 0.035634 | 1.555359 | [
"s344445872",
"s702286988"
] |
u021019433 | p02928 | python | s267571073 | s058641375 | 638 | 319 | 3,564 | 3,564 | Accepted | Accepted | 50 | from collections import Counter
R = lambda: list(map(int, input().split()))
n, k = R()
a = list(R())
r = k * sum(a[i] < a[j] for i in range(n) for j in range(i))
r = n*(n-1)//2 - sum(x*(x-1)//2 for x in list(Counter(a).values()))
r = r * k*(k-1)//2 + k * sum(a[i] < a[j] for i in range(n) for j in range(i))
print... | from collections import Counter
R = lambda: list(map(int, input().split()))
n, k = R()
a = list(R())
r = k * sum(a[i] < a[j] for i in range(n) for j in range(i))
r += k*(k-1)//2 * (n*(n-1)//2 - sum(x*(x-1)//2 for x in list(Counter(a).values())))
print((r % (10**9 + 7)))
| 8 | 7 | 326 | 263 | from collections import Counter
R = lambda: list(map(int, input().split()))
n, k = R()
a = list(R())
r = k * sum(a[i] < a[j] for i in range(n) for j in range(i))
r = n * (n - 1) // 2 - sum(x * (x - 1) // 2 for x in list(Counter(a).values()))
r = r * k * (k - 1) // 2 + k * sum(a[i] < a[j] for i in range(n) for j in ran... | from collections import Counter
R = lambda: list(map(int, input().split()))
n, k = R()
a = list(R())
r = k * sum(a[i] < a[j] for i in range(n) for j in range(i))
r += (
k
* (k - 1)
// 2
* (n * (n - 1) // 2 - sum(x * (x - 1) // 2 for x in list(Counter(a).values())))
)
print((r % (10**9 + 7)))
| false | 12.5 | [
"-r = n * (n - 1) // 2 - sum(x * (x - 1) // 2 for x in list(Counter(a).values()))",
"-r = r * k * (k - 1) // 2 + k * sum(a[i] < a[j] for i in range(n) for j in range(i))",
"+r += (",
"+ k",
"+ * (k - 1)",
"+ // 2",
"+ * (n * (n - 1) // 2 - sum(x * (x - 1) // 2 for x in list(Counter(a).values... | false | 0.035101 | 0.035791 | 0.980724 | [
"s267571073",
"s058641375"
] |
u367701763 | p02936 | python | s340603653 | s757543752 | 1,208 | 501 | 282,652 | 164,272 | Accepted | Accepted | 58.53 | # https://atcoder.jp/contests/abc138/tasks/abc138_d
import sys
input = sys.stdin.readline
from copy import deepcopy
class Graph:
def __init__(self, n, dictated=False, decrement=True, edge=[]):
self.n = n
self.dictated = dictated
self.decrement = decrement
self.edge = [... | # https://atcoder.jp/contests/abc138/tasks/abc138_d
import sys
input = sys.stdin.readline
from copy import deepcopy
class Graph:
def __init__(self, n, dictated=False, decrement=True, edge=[]):
self.n = n
self.dictated = dictated
self.decrement = decrement
self.edge = [... | 101 | 103 | 2,890 | 2,943 | # https://atcoder.jp/contests/abc138/tasks/abc138_d
import sys
input = sys.stdin.readline
from copy import deepcopy
class Graph:
def __init__(self, n, dictated=False, decrement=True, edge=[]):
self.n = n
self.dictated = dictated
self.decrement = decrement
self.edge = [set() for _ ... | # https://atcoder.jp/contests/abc138/tasks/abc138_d
import sys
input = sys.stdin.readline
from copy import deepcopy
class Graph:
def __init__(self, n, dictated=False, decrement=True, edge=[]):
self.n = n
self.dictated = dictated
self.decrement = decrement
self.edge = [set() for _ ... | false | 1.941748 | [
"- if not save:",
"- self.parent = [-1] * self.n",
"- edge2 = deepcopy(self.edge)",
"+ # if not save:",
"+ # self.parent = [-1] * self.n",
"+ #",
"+ # edge2 = deepcopy(self.edge)",
"+ edge2 = self.edge"
] | false | 0.178405 | 0.041495 | 4.299395 | [
"s340603653",
"s757543752"
] |
u983918956 | p03600 | python | s994536180 | s542600266 | 879 | 534 | 46,816 | 44,764 | Accepted | Accepted | 39.25 | N = int(eval(input()))
A = [list(map(int,input().split())) for _ in range(N)]
flag = [[0] * N for _ in range(N)]
dist = [line[:] for line in A]
for k in range(N):
for i in range(N):
for j in range(N):
if i == j or j == k or k == i:
continue
if dist[i][j] ... | N = int(eval(input()))
A = [list(map(int,input().split())) for _ in range(N)]
flag = [[True] * N for _ in range(N)]
for i in range(N):
for j in range(i+1, N):
for k in range(N):
if k == i or k == j:
continue
if A[i][j] > A[i][k] + A[k][j]:
... | 28 | 24 | 666 | 560 | N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(N)]
flag = [[0] * N for _ in range(N)]
dist = [line[:] for line in A]
for k in range(N):
for i in range(N):
for j in range(N):
if i == j or j == k or k == i:
continue
if dist[i][j] > dist[i][k]... | N = int(eval(input()))
A = [list(map(int, input().split())) for _ in range(N)]
flag = [[True] * N for _ in range(N)]
for i in range(N):
for j in range(i + 1, N):
for k in range(N):
if k == i or k == j:
continue
if A[i][j] > A[i][k] + A[k][j]:
print((-1... | false | 14.285714 | [
"-flag = [[0] * N for _ in range(N)]",
"-dist = [line[:] for line in A]",
"-for k in range(N):",
"- for i in range(N):",
"- for j in range(N):",
"- if i == j or j == k or k == i:",
"+flag = [[True] * N for _ in range(N)]",
"+for i in range(N):",
"+ for j in range(i + 1, N):",... | false | 0.109854 | 0.122282 | 0.898365 | [
"s994536180",
"s542600266"
] |
u536600145 | p03166 | python | s335113130 | s262540731 | 1,164 | 371 | 154,060 | 56,368 | Accepted | Accepted | 68.13 | import sys
N, M = list(map(int, input().split()))
sys.setrecursionlimit(10**9)
vertices = [[] for i in range(N+1)]
dp = [-1] * (N+1)
for _ in range(M):
fro, to = list(map(int, input().split()))
vertices[fro].append(to)
def dfs(i):
if dp[i] != -1:
return dp[i]
temp ... | import sys
import collections
# input処理を高速化する
input = sys.stdin.readline
def main():
# 入力
N, M = list(map(int, input().split()))
# 隣接関係は隣接リストで管理する
lst_edge = [[] for _ in range(N)]
# 各頂点の入力辺の本数
deg = [0] * N
for _ in range(M):
x, y = list(map(int, input().split()))
... | 28 | 38 | 489 | 1,131 | import sys
N, M = list(map(int, input().split()))
sys.setrecursionlimit(10**9)
vertices = [[] for i in range(N + 1)]
dp = [-1] * (N + 1)
for _ in range(M):
fro, to = list(map(int, input().split()))
vertices[fro].append(to)
def dfs(i):
if dp[i] != -1:
return dp[i]
temp = 0
for vertex in ve... | import sys
import collections
# input処理を高速化する
input = sys.stdin.readline
def main():
# 入力
N, M = list(map(int, input().split()))
# 隣接関係は隣接リストで管理する
lst_edge = [[] for _ in range(N)]
# 各頂点の入力辺の本数
deg = [0] * N
for _ in range(M):
x, y = list(map(int, input().split()))
# 最初のin... | false | 26.315789 | [
"+import collections",
"-N, M = list(map(int, input().split()))",
"-sys.setrecursionlimit(10**9)",
"-vertices = [[] for i in range(N + 1)]",
"-dp = [-1] * (N + 1)",
"-for _ in range(M):",
"- fro, to = list(map(int, input().split()))",
"- vertices[fro].append(to)",
"+# input処理を高速化する",
"+input... | false | 0.06415 | 0.071792 | 0.893559 | [
"s335113130",
"s262540731"
] |
u191874006 | p03290 | python | s856474463 | s401097798 | 1,613 | 191 | 41,964 | 41,200 | Accepted | Accepted | 88.16 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 39 | 46 | 1,079 | 1,206 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 15.217391 | [
"-for i in permutations(list(range(d))):",
"+for i in range(1 << d):",
"+ tmp = -1",
"+ count = 0",
"- count = 0",
"- for j in list(i):",
"- p, c = pc[j]",
"- if score + p * (j + 1) * 100 + c < g:",
"- score += p * (j + 1) * 100 + c",
"- count += p",... | false | 0.038776 | 0.118641 | 0.326834 | [
"s856474463",
"s401097798"
] |
u203211107 | p03037 | python | s863489795 | s352704828 | 323 | 289 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | #C - Prison(ABC127)
N,M=list(map(int, input().split()))
l,r=list(map(int, input().split()))
for i in range(M-1):
L,R=list(map(int,input().split()))
l=max(L,l)
r=min(r,R)
if r-l+1>0:
print((r-l+1))
else:
print((0)) | #C - Prison(ABC127)
N,M=list(map(int, input().split()))
l,r=list(map(int, input().split()))
for i in range(M-1):
L,R=list(map(int,input().split()))
if l<L:
l=L
if r>R:
r=R
if r-l+1>0:
print((r-l+1))
else:
print((0)) | 11 | 13 | 221 | 241 | # C - Prison(ABC127)
N, M = list(map(int, input().split()))
l, r = list(map(int, input().split()))
for i in range(M - 1):
L, R = list(map(int, input().split()))
l = max(L, l)
r = min(r, R)
if r - l + 1 > 0:
print((r - l + 1))
else:
print((0))
| # C - Prison(ABC127)
N, M = list(map(int, input().split()))
l, r = list(map(int, input().split()))
for i in range(M - 1):
L, R = list(map(int, input().split()))
if l < L:
l = L
if r > R:
r = R
if r - l + 1 > 0:
print((r - l + 1))
else:
print((0))
| false | 15.384615 | [
"- l = max(L, l)",
"- r = min(r, R)",
"+ if l < L:",
"+ l = L",
"+ if r > R:",
"+ r = R"
] | false | 0.041517 | 0.047311 | 0.877529 | [
"s863489795",
"s352704828"
] |
u218834617 | p03013 | python | s019552519 | s048931274 | 583 | 127 | 468,380 | 17,264 | Accepted | Accepted | 78.22 | N,M=list(map(int,input().split()))
dp=[0]*(N+1)
dp[0]=1
for _ in range(M):
a=int(eval(input()))
dp[a]=-1
for i in range(1,N+1):
if dp[i]==-1:
continue
if dp[i-1]!=-1:
dp[i]+=dp[i-1]
if i>1 and dp[i-2]!=-1:
dp[i]+=dp[i-2]
if dp[-1]==-1:
print((0))
else... | import sys
N,M=list(map(int,input().split()))
S=set(map(int,sys.stdin))
a,b=0,1
for i in range(1,N+1):
if i in S:
a,b=b,0
else:
a,b=b,a+b
print((b%(10**9+7)))
| 20 | 12 | 337 | 188 | N, M = list(map(int, input().split()))
dp = [0] * (N + 1)
dp[0] = 1
for _ in range(M):
a = int(eval(input()))
dp[a] = -1
for i in range(1, N + 1):
if dp[i] == -1:
continue
if dp[i - 1] != -1:
dp[i] += dp[i - 1]
if i > 1 and dp[i - 2] != -1:
dp[i] += dp[i - 2]
if dp[-1] == -1:... | import sys
N, M = list(map(int, input().split()))
S = set(map(int, sys.stdin))
a, b = 0, 1
for i in range(1, N + 1):
if i in S:
a, b = b, 0
else:
a, b = b, a + b
print((b % (10**9 + 7)))
| false | 40 | [
"+import sys",
"+",
"-dp = [0] * (N + 1)",
"-dp[0] = 1",
"-for _ in range(M):",
"- a = int(eval(input()))",
"- dp[a] = -1",
"+S = set(map(int, sys.stdin))",
"+a, b = 0, 1",
"- if dp[i] == -1:",
"- continue",
"- if dp[i - 1] != -1:",
"- dp[i] += dp[i - 1]",
"- i... | false | 0.03587 | 0.036917 | 0.97162 | [
"s019552519",
"s048931274"
] |
u513081876 | p04045 | python | s075289270 | s613137257 | 106 | 91 | 2,940 | 68,292 | Accepted | Accepted | 14.15 | N, K = list(map(int, input().split()))
D = [int(i) for i in input().split()]
num = N
flag = True
while flag:
for i in D:
if str(i) in str(num):
num += 1
break
else:
print(num)
flag = False
| N, K = list(map(int, input().split()))
D = [str(i) for i in input().split()]
ans = N
for i in range(N, 100001):
if set(list(str(i))) & set(D):
gg = 1
else:
print(i)
break | 14 | 10 | 254 | 206 | N, K = list(map(int, input().split()))
D = [int(i) for i in input().split()]
num = N
flag = True
while flag:
for i in D:
if str(i) in str(num):
num += 1
break
else:
print(num)
flag = False
| N, K = list(map(int, input().split()))
D = [str(i) for i in input().split()]
ans = N
for i in range(N, 100001):
if set(list(str(i))) & set(D):
gg = 1
else:
print(i)
break
| false | 28.571429 | [
"-D = [int(i) for i in input().split()]",
"-num = N",
"-flag = True",
"-while flag:",
"- for i in D:",
"- if str(i) in str(num):",
"- num += 1",
"- break",
"+D = [str(i) for i in input().split()]",
"+ans = N",
"+for i in range(N, 100001):",
"+ if set(list(str... | false | 0.042767 | 0.043263 | 0.988524 | [
"s075289270",
"s613137257"
] |
u729133443 | p02841 | python | s721245955 | s731969378 | 70 | 28 | 61,404 | 9,052 | Accepted | Accepted | 60 | print((1//int([*open(0)][1][2:]))) | print((+(' 1\n'in[*open(0)][1]))) | 1 | 1 | 32 | 31 | print((1 // int([*open(0)][1][2:])))
| print((+(" 1\n" in [*open(0)][1])))
| false | 0 | [
"-print((1 // int([*open(0)][1][2:])))",
"+print((+(\" 1\\n\" in [*open(0)][1])))"
] | false | 0.03872 | 0.073671 | 0.52558 | [
"s721245955",
"s731969378"
] |
u932465688 | p03363 | python | s045807987 | s730347646 | 270 | 244 | 26,136 | 26,136 | Accepted | Accepted | 9.63 | N = int(eval(input()))
L = list(map(int,input().split()))
S = [0]
c = 0
for i in range(N):
c = S[i] + L[i]
S.append(c)
S.sort()
S.append(S[N]+1)
k = 0
p = 1
ans = 0
while k <= N:
if S[k] == S[k+1]:
p += 1
k += 1
else:
ans += p*(p-1)//2
p = 1
k += 1
print(ans) | N = int(eval(input()))
A = list(map(int,input().split()))
R = [0] #Rは累積和を格納するリストです
for i in range(N):
R.append(R[i]+A[i]) #累積和を入れます
R.sort()
R.append(10**18) #カウントを止めます(番兵)
cnt = 1
ans = 0
cur = R[0] #curは今見ている累積和を表します
for i in range(1,N+2): #番兵の所で止まるように、N+1まで数えます
if cur == R[i]:
... | 21 | 18 | 301 | 491 | N = int(eval(input()))
L = list(map(int, input().split()))
S = [0]
c = 0
for i in range(N):
c = S[i] + L[i]
S.append(c)
S.sort()
S.append(S[N] + 1)
k = 0
p = 1
ans = 0
while k <= N:
if S[k] == S[k + 1]:
p += 1
k += 1
else:
ans += p * (p - 1) // 2
p = 1
k += 1
prin... | N = int(eval(input()))
A = list(map(int, input().split()))
R = [0] # Rは累積和を格納するリストです
for i in range(N):
R.append(R[i] + A[i]) # 累積和を入れます
R.sort()
R.append(10**18) # カウントを止めます(番兵)
cnt = 1
ans = 0
cur = R[0] # curは今見ている累積和を表します
for i in range(1, N + 2): # 番兵の所で止まるように、N+1まで数えます
if cur == R[i]:
cnt += ... | false | 14.285714 | [
"-L = list(map(int, input().split()))",
"-S = [0]",
"-c = 0",
"+A = list(map(int, input().split()))",
"+R = [0] # Rは累積和を格納するリストです",
"- c = S[i] + L[i]",
"- S.append(c)",
"-S.sort()",
"-S.append(S[N] + 1)",
"-k = 0",
"-p = 1",
"+ R.append(R[i] + A[i]) # 累積和を入れます",
"+R.sort()",
"+... | false | 0.068465 | 0.035569 | 1.924874 | [
"s045807987",
"s730347646"
] |
u514401521 | p02720 | python | s886689320 | s728428856 | 202 | 84 | 40,816 | 11,228 | Accepted | Accepted | 58.42 | from collections import deque
K = int(eval(input()))
d = deque()
for i in range(1, 10):
d.append(i)
cnt = 0
while d:
tmp = d.popleft()
cnt += 1
if cnt == K:
print(tmp)
break
r = tmp % 10
if r != 0:
d.append(tmp * 10 + r - 1)
d.append(tmp * 10 + r)
... | K = int(eval(input()))
import copy
present = [1,2,3,4,5,6,7,8,9]
while K >= len(present):
K -= len(present)
next = []
for i in range(len(present)):
tmp = present[i]
r = tmp % 10
if r != 0:
next.append(tmp * 10 + r -1)
next.append(tmp * 10 + r)
... | 20 | 18 | 364 | 411 | from collections import deque
K = int(eval(input()))
d = deque()
for i in range(1, 10):
d.append(i)
cnt = 0
while d:
tmp = d.popleft()
cnt += 1
if cnt == K:
print(tmp)
break
r = tmp % 10
if r != 0:
d.append(tmp * 10 + r - 1)
d.append(tmp * 10 + r)
if r != 9:
... | K = int(eval(input()))
import copy
present = [1, 2, 3, 4, 5, 6, 7, 8, 9]
while K >= len(present):
K -= len(present)
next = []
for i in range(len(present)):
tmp = present[i]
r = tmp % 10
if r != 0:
next.append(tmp * 10 + r - 1)
next.append(tmp * 10 + r)
if... | false | 10 | [
"-from collections import deque",
"+K = int(eval(input()))",
"+import copy",
"-K = int(eval(input()))",
"-d = deque()",
"-for i in range(1, 10):",
"- d.append(i)",
"-cnt = 0",
"-while d:",
"- tmp = d.popleft()",
"- cnt += 1",
"- if cnt == K:",
"- print(tmp)",
"- b... | false | 0.042899 | 0.039371 | 1.089602 | [
"s886689320",
"s728428856"
] |
u670961163 | p03011 | python | s923405258 | s186295055 | 63 | 27 | 61,692 | 8,964 | Accepted | Accepted | 57.14 | p, q, r = list(map(int, input().split()))
print((p + q+ r - max(p, q, r))) | a, b, c= list(map(int, input().split()))
print(( a+b+c- max(a, b, c)))
| 2 | 2 | 67 | 64 | p, q, r = list(map(int, input().split()))
print((p + q + r - max(p, q, r)))
| a, b, c = list(map(int, input().split()))
print((a + b + c - max(a, b, c)))
| false | 0 | [
"-p, q, r = list(map(int, input().split()))",
"-print((p + q + r - max(p, q, r)))",
"+a, b, c = list(map(int, input().split()))",
"+print((a + b + c - max(a, b, c)))"
] | false | 0.133487 | 0.039853 | 3.349513 | [
"s923405258",
"s186295055"
] |
u401452016 | p03164 | python | s438278322 | s401116659 | 678 | 560 | 286,344 | 205,064 | Accepted | Accepted | 17.4 | #EDP-E
import sys
from collections import defaultdict
n, W = list(map(int, sys.stdin.readline().split()))
dp = [defaultdict(int) for _ in range(n)]
w, v = list(map(int, sys.stdin.readline().split()))
dp[0][v] = w
for i in range(1, n):
w, v = list(map(int, sys.stdin.readline().split()))
for vb, wb i... | #DP-E
def main():
import sys, copy
N, W = list(map(int, sys.stdin.readline().split()))
L = tuple([tuple(map(int, sys.stdin.readline().split())) for _ in range(N)])
#print(L)
#価値テーブルを作成
dp =[[10**11+1 for _ in range(10**5+1)] for _ in range(N)]
dp[0][L[0][1]] = L[0][0] #初期設定
#pri... | 20 | 34 | 568 | 904 | # EDP-E
import sys
from collections import defaultdict
n, W = list(map(int, sys.stdin.readline().split()))
dp = [defaultdict(int) for _ in range(n)]
w, v = list(map(int, sys.stdin.readline().split()))
dp[0][v] = w
for i in range(1, n):
w, v = list(map(int, sys.stdin.readline().split()))
for vb, wb in list(dp[i... | # DP-E
def main():
import sys, copy
N, W = list(map(int, sys.stdin.readline().split()))
L = tuple([tuple(map(int, sys.stdin.readline().split())) for _ in range(N)])
# print(L)
# 価値テーブルを作成
dp = [[10**11 + 1 for _ in range(10**5 + 1)] for _ in range(N)]
dp[0][L[0][1]] = L[0][0] # 初期設定
# ... | false | 41.176471 | [
"-# EDP-E",
"-import sys",
"-from collections import defaultdict",
"+# DP-E",
"+def main():",
"+ import sys, copy",
"-n, W = list(map(int, sys.stdin.readline().split()))",
"-dp = [defaultdict(int) for _ in range(n)]",
"-w, v = list(map(int, sys.stdin.readline().split()))",
"-dp[0][v] = w",
"-... | false | 0.071051 | 0.591303 | 0.12016 | [
"s438278322",
"s401116659"
] |
u285891772 | p03487 | python | s539106466 | s543306709 | 126 | 98 | 19,852 | 19,848 | Accepted | Accepted | 22.22 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy... | 36 | 36 | 1,039 | 1,063 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians # , log2
from itertools import (
accumulate,
permutations,
combinations,
combinations_with_replacement,
product,
groupby,
)
from operator import itemgetter, mu... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians # , log2
from itertools import (
accumulate,
permutations,
combinations,
combinations_with_replacement,
product,
groupby,
)
from operator import itemgetter, mu... | false | 0 | [
"-for x in A:",
"- if x > A[x]:",
"- ans += A[x]",
"+for key, value in list(A.items()):",
"+ if key > value:",
"+ ans += value",
"- ans += A[x] - x",
"+ ans += value - key"
] | false | 0.041801 | 0.041193 | 1.014763 | [
"s539106466",
"s543306709"
] |
u844005364 | p03854 | python | s308201680 | s020371199 | 25 | 19 | 9,588 | 3,188 | Accepted | Accepted | 24 | import re
s = eval(input())
print(("YES" if re.match("^(eraser?|dream(er)?)*$", s) else "NO")) | s = eval(input())
if s.replace("eraser"," ").replace("erase"," ").replace("dreamer"," ").replace("dream"," ").replace(" ", ""):
print("NO")
else:
print("YES") | 3 | 5 | 88 | 164 | import re
s = eval(input())
print(("YES" if re.match("^(eraser?|dream(er)?)*$", s) else "NO"))
| s = eval(input())
if (
s.replace("eraser", " ")
.replace("erase", " ")
.replace("dreamer", " ")
.replace("dream", " ")
.replace(" ", "")
):
print("NO")
else:
print("YES")
| false | 40 | [
"-import re",
"-",
"-print((\"YES\" if re.match(\"^(eraser?|dream(er)?)*$\", s) else \"NO\"))",
"+if (",
"+ s.replace(\"eraser\", \" \")",
"+ .replace(\"erase\", \" \")",
"+ .replace(\"dreamer\", \" \")",
"+ .replace(\"dream\", \" \")",
"+ .replace(\" \", \"\")",
"+):",
"+ prin... | false | 0.041324 | 0.038633 | 1.069672 | [
"s308201680",
"s020371199"
] |
u644907318 | p03252 | python | s521647527 | s694474702 | 541 | 202 | 3,632 | 41,840 | Accepted | Accepted | 62.66 | S = input().strip()
T = input().strip()
F = {}
flag = 0
for i in range(len(S)):
a = S[i]
b = T[i]
if a not in F:
F[a] = b
if F[a] != b:
flag = 1
break
for c in F:
if c!=a and F[c]==b:
flag = 1
break
if flag==1:
print("No")
... | A = {chr(i):0 for i in range(97,123)}
S = input().strip()
T = input().strip()
N = len(S)
G = {}
for i in range(N):
a = S[i]
if a not in G:
G[a]=[]
b = T[i]
if b not in G[a]:
G[a].append(b)
flag = 0
cnt = 0
for a in G:
cnt += 1
if len(G[a])>1:
flag = 1
... | 20 | 33 | 345 | 564 | S = input().strip()
T = input().strip()
F = {}
flag = 0
for i in range(len(S)):
a = S[i]
b = T[i]
if a not in F:
F[a] = b
if F[a] != b:
flag = 1
break
for c in F:
if c != a and F[c] == b:
flag = 1
break
if flag == 1:
print("No")
else:
p... | A = {chr(i): 0 for i in range(97, 123)}
S = input().strip()
T = input().strip()
N = len(S)
G = {}
for i in range(N):
a = S[i]
if a not in G:
G[a] = []
b = T[i]
if b not in G[a]:
G[a].append(b)
flag = 0
cnt = 0
for a in G:
cnt += 1
if len(G[a]) > 1:
flag = 1
break
... | false | 39.393939 | [
"+A = {chr(i): 0 for i in range(97, 123)}",
"-F = {}",
"+N = len(S)",
"+G = {}",
"+for i in range(N):",
"+ a = S[i]",
"+ if a not in G:",
"+ G[a] = []",
"+ b = T[i]",
"+ if b not in G[a]:",
"+ G[a].append(b)",
"-for i in range(len(S)):",
"- a = S[i]",
"- b =... | false | 0.112004 | 0.042156 | 2.656909 | [
"s521647527",
"s694474702"
] |
u523087093 | p02813 | python | s130407657 | s818421307 | 42 | 38 | 9,128 | 9,092 | Accepted | Accepted | 9.52 | import itertools
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
count = 1
for p in itertools.permutations(list(range(1, N+1))):
if p == P:
count_P = count
if p == Q:
count_Q = count
count += 1
ans = abs(count_P - count_Q)... | import itertools
N = int(eval(input()))
P = list(map(int, input().split()))
tuple_P = tuple(P)
sorted_P = sorted(P)
Q = list(map(int, input().split()))
tuple_Q = tuple(Q)
sorted_Q = sorted(Q)
count_P = 1
for perm_P in itertools.permutations(sorted_P):
if tuple_P == perm_P:
break
count_P ... | 18 | 24 | 320 | 492 | import itertools
N = int(eval(input()))
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
count = 1
for p in itertools.permutations(list(range(1, N + 1))):
if p == P:
count_P = count
if p == Q:
count_Q = count
count += 1
ans = abs(count_P - count_Q)
print(ans)
| import itertools
N = int(eval(input()))
P = list(map(int, input().split()))
tuple_P = tuple(P)
sorted_P = sorted(P)
Q = list(map(int, input().split()))
tuple_Q = tuple(Q)
sorted_Q = sorted(Q)
count_P = 1
for perm_P in itertools.permutations(sorted_P):
if tuple_P == perm_P:
break
count_P += 1
count_Q = ... | false | 25 | [
"-P = tuple(map(int, input().split()))",
"-Q = tuple(map(int, input().split()))",
"-count = 1",
"-for p in itertools.permutations(list(range(1, N + 1))):",
"- if p == P:",
"- count_P = count",
"- if p == Q:",
"- count_Q = count",
"- count += 1",
"-ans = abs(count_P - count_Q... | false | 0.047854 | 0.04667 | 1.025372 | [
"s130407657",
"s818421307"
] |
u498487134 | p02832 | python | s781427464 | s152112070 | 250 | 105 | 77,516 | 100,700 | Accepted | Accepted | 58 | N = int(eval(input()))
A = list(map(int, input().split()))
se = 1
for i in range(N):
if A[i]==se:
se+=1
ans=N-se+1
if se==1:
ans=-1
print(ans) | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N=I()
A=LI()
cnt=0
now=1
for i in range(N):
if A[i]==now:
... | 12 | 26 | 165 | 432 | N = int(eval(input()))
A = list(map(int, input().split()))
se = 1
for i in range(N):
if A[i] == se:
se += 1
ans = N - se + 1
if se == 1:
ans = -1
print(ans)
| import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N = I()
A = LI()
cnt = 0
now = 1
for i in range(N):
if A[i] == now:
... | false | 53.846154 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-se = 1",
"-for i in range(N):",
"- if A[i] == se:",
"- se += 1",
"-ans = N - se + 1",
"-if se == 1:",
"- ans = -1",
"-print(ans)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"+def I():",... | false | 0.034256 | 0.033443 | 1.024334 | [
"s781427464",
"s152112070"
] |
u255317651 | p02314 | python | s758627570 | s200415606 | 480 | 360 | 7,500 | 7,264 | Accepted | Accepted | 25 | # -*- coding: utf-8 -*-
"""
Created on Sat May 26 12:16:54 2018
DPL-1A Rec Call Revised
@author: maezawa
"""
n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
c.sort()
dp = [float('inf') for _ in range(n+1)]
dp[0] = 0
#print(n,m)
#print(c)
#print(*dp, sep='\n')
for j in range(... | n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
dp = [0] * (n+1)
for i in range(1, n+1):
dp[i] = min([dp[i - c[j]]+1 for j in range(m) if i-c[j]>=0])
print((dp[n]))
| 26 | 9 | 504 | 209 | # -*- coding: utf-8 -*-
"""
Created on Sat May 26 12:16:54 2018
DPL-1A Rec Call Revised
@author: maezawa
"""
n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
c.sort()
dp = [float("inf") for _ in range(n + 1)]
dp[0] = 0
# print(n,m)
# print(c)
# print(*dp, sep='\n')
for j in range(1, n + 1):
... | n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
dp = [0] * (n + 1)
for i in range(1, n + 1):
dp[i] = min([dp[i - c[j]] + 1 for j in range(m) if i - c[j] >= 0])
print((dp[n]))
| false | 65.384615 | [
"-# -*- coding: utf-8 -*-",
"-\"\"\"",
"-Created on Sat May 26 12:16:54 2018",
"-DPL-1A Rec Call Revised",
"-@author: maezawa",
"-\"\"\"",
"-c.sort()",
"-dp = [float(\"inf\") for _ in range(n + 1)]",
"-dp[0] = 0",
"-# print(n,m)",
"-# print(c)",
"-# print(*dp, sep='\\n')",
"-for j in range(1... | false | 0.073441 | 0.04264 | 1.722354 | [
"s758627570",
"s200415606"
] |
u999893056 | p03292 | python | s450205849 | s585221327 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | *a,=list(map(int,input().split()))
print((max(a)-min(a))) | a = list(map(int, input().split()))
print((max(a)-min(a))) | 2 | 3 | 50 | 59 | (*a,) = list(map(int, input().split()))
print((max(a) - min(a)))
| a = list(map(int, input().split()))
print((max(a) - min(a)))
| false | 33.333333 | [
"-(*a,) = list(map(int, input().split()))",
"+a = list(map(int, input().split()))"
] | false | 0.040146 | 0.041277 | 0.972595 | [
"s450205849",
"s585221327"
] |
u454524105 | p02678 | python | s469502809 | s504034478 | 1,768 | 1,476 | 74,488 | 66,572 | Accepted | Accepted | 16.52 | from collections import deque
INF = 10**9 + 7
n, m = list(map(int, input().split()))
g = [[] for _ in range(n+1)]
for _ in range(m):
a, b = list(map(int, input().split()))
g[a].append([a, b])
g[b].append([b, a])
res = [[0, INF] for _ in range(n+1)]
res[1][1] = 0
q = deque(g[1])
while q:
q_ =... | from collections import deque
INF = 10**9 + 7
n, m = list(map(int, input().split()))
g = [[] for _ in range(n+1)]
for _ in range(m):
a, b = list(map(int, input().split()))
g[a].append([a, b])
g[b].append([b, a])
res = [INF for _ in range(n+1)]
res[1] = 0
q = deque(g[1])
while q:
q_ = q.pople... | 19 | 18 | 511 | 451 | from collections import deque
INF = 10**9 + 7
n, m = list(map(int, input().split()))
g = [[] for _ in range(n + 1)]
for _ in range(m):
a, b = list(map(int, input().split()))
g[a].append([a, b])
g[b].append([b, a])
res = [[0, INF] for _ in range(n + 1)]
res[1][1] = 0
q = deque(g[1])
while q:
q_ = q.popl... | from collections import deque
INF = 10**9 + 7
n, m = list(map(int, input().split()))
g = [[] for _ in range(n + 1)]
for _ in range(m):
a, b = list(map(int, input().split()))
g[a].append([a, b])
g[b].append([b, a])
res = [INF for _ in range(n + 1)]
res[1] = 0
q = deque(g[1])
while q:
q_ = q.popleft()
... | false | 5.263158 | [
"-res = [[0, INF] for _ in range(n + 1)]",
"-res[1][1] = 0",
"+res = [INF for _ in range(n + 1)]",
"+res[1] = 0",
"- if res[q_[1]][1] == INF:",
"+ if res[q_[1]] == INF:",
"- res[q_[1]][0] = q_[0]",
"- res[q_[1]][1] = res[q_[0]][1] + 1",
"+ res[q_[1]] = q_[0]",
"- prin... | false | 0.049419 | 0.044874 | 1.101297 | [
"s469502809",
"s504034478"
] |
u623231048 | p03111 | python | s895357787 | s691341526 | 355 | 68 | 3,064 | 3,064 | Accepted | Accepted | 80.85 | n,a,b,c = list(map(int,input().split()))
takelist = [a,b,c]
li = [int(eval(input())) for _ in range(n)]
li2 = [0 for _ in range(n)]
min = 10**100
def movelist(li,n):
for i in range(n):
if li[i] != 3:
li[i] += 1
break
else:
li[i] = 0
for i in rang... | n,A,B,C = list(map(int,input().split()))
li = [int(eval(input())) for _ in range(n)]
def searchans(count,a,b,c):
if count == n:
if not 0 in [a,b,c]:
return abs(A-a) + abs(B-b) + abs(C-c) - 30
else:
return 10**100
else:
ret0 = searchans(count+1,a,b,c)
... | 30 | 17 | 682 | 546 | n, a, b, c = list(map(int, input().split()))
takelist = [a, b, c]
li = [int(eval(input())) for _ in range(n)]
li2 = [0 for _ in range(n)]
min = 10**100
def movelist(li, n):
for i in range(n):
if li[i] != 3:
li[i] += 1
break
else:
li[i] = 0
for i in range(4**n)... | n, A, B, C = list(map(int, input().split()))
li = [int(eval(input())) for _ in range(n)]
def searchans(count, a, b, c):
if count == n:
if not 0 in [a, b, c]:
return abs(A - a) + abs(B - b) + abs(C - c) - 30
else:
return 10**100
else:
ret0 = searchans(count + 1, ... | false | 43.333333 | [
"-n, a, b, c = list(map(int, input().split()))",
"-takelist = [a, b, c]",
"+n, A, B, C = list(map(int, input().split()))",
"-li2 = [0 for _ in range(n)]",
"-min = 10**100",
"-def movelist(li, n):",
"- for i in range(n):",
"- if li[i] != 3:",
"- li[i] += 1",
"- break... | false | 0.256567 | 0.064056 | 4.005345 | [
"s895357787",
"s691341526"
] |
u556589653 | p02712 | python | s900381292 | s896415932 | 180 | 152 | 9,164 | 9,064 | Accepted | Accepted | 15.56 | N = int(eval(input()))
ans = 0
for i in range(1,N+1):
if i%3 == 0 or i%5 == 0:
ans += 0
else:
ans += i
print(ans) | N = int(eval(input()))
ans = 0
for i in range(1,N+1):
if i%3 == 0 or i%5 == 0:
continue
else:
ans += i
print(ans) | 8 | 8 | 138 | 126 | N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
if i % 3 == 0 or i % 5 == 0:
ans += 0
else:
ans += i
print(ans)
| N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
if i % 3 == 0 or i % 5 == 0:
continue
else:
ans += i
print(ans)
| false | 0 | [
"- ans += 0",
"+ continue"
] | false | 0.150384 | 0.152433 | 0.986554 | [
"s900381292",
"s896415932"
] |
u540762794 | p02844 | python | s072611556 | s208215268 | 646 | 36 | 9,340 | 9,172 | Accepted | Accepted | 94.43 | # -*- coding: utf-8 -*-
N = int(eval(input()))
S = list(eval(input()))
ans = 0
for i in range(1000):
pw = list("{0:03d}".format(i))
if pw[0] in S:
w1 = S.index(pw[0])
if pw[1] in S[w1+1:]:
w2 = w1+1 + S[w1+1:].index(pw[1])
if pw[2] in S[w2+1:]:
... | # -*- coding: utf-8 -*-
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1000):
pw = list("{0:03d}".format(i))
if pw[0] in S:
w1 = S.index(pw[0])
if pw[1] in S[w1+1:]:
w2 = w1+1 + S[w1+1:].index(pw[1])
if pw[2] in S[w2+1:]:
... | 17 | 17 | 337 | 331 | # -*- coding: utf-8 -*-
N = int(eval(input()))
S = list(eval(input()))
ans = 0
for i in range(1000):
pw = list("{0:03d}".format(i))
if pw[0] in S:
w1 = S.index(pw[0])
if pw[1] in S[w1 + 1 :]:
w2 = w1 + 1 + S[w1 + 1 :].index(pw[1])
if pw[2] in S[w2 + 1 :]:
... | # -*- coding: utf-8 -*-
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1000):
pw = list("{0:03d}".format(i))
if pw[0] in S:
w1 = S.index(pw[0])
if pw[1] in S[w1 + 1 :]:
w2 = w1 + 1 + S[w1 + 1 :].index(pw[1])
if pw[2] in S[w2 + 1 :]:
ans +=... | false | 0 | [
"-S = list(eval(input()))",
"+S = eval(input())"
] | false | 0.072933 | 0.03521 | 2.071356 | [
"s072611556",
"s208215268"
] |
u046187684 | p03013 | python | s620307324 | s975270573 | 160 | 49 | 15,592 | 11,884 | Accepted | Accepted | 69.38 | def solve(string):
n, m, *a = list(map(int, string.split()))
ans = [0] * (n + 1)
a = set(a)
ans[0] = 1
ans[1] = 0 if 1 in a else 1
num = 1000000007
for i in range(2, n + 1):
if i in a:
continue
ans[i] = (ans[i - 2] + ans[i - 1]) % num
return str(ans... | import sys
mod = 10**9+7
def main():
n,m=list(map(int,input().split(' ')))
if m > 0:
aaa = set(map(int,sys.stdin))
else:
aaa = set()
dp = [0] * (n+1)
dp[0] = 1
dp[1] = 1 if 1 not in aaa else 0
for i in range(2,n+1):
if i in aaa:
continue
... | 17 | 20 | 473 | 380 | def solve(string):
n, m, *a = list(map(int, string.split()))
ans = [0] * (n + 1)
a = set(a)
ans[0] = 1
ans[1] = 0 if 1 in a else 1
num = 1000000007
for i in range(2, n + 1):
if i in a:
continue
ans[i] = (ans[i - 2] + ans[i - 1]) % num
return str(ans[-1])
if ... | import sys
mod = 10**9 + 7
def main():
n, m = list(map(int, input().split(" ")))
if m > 0:
aaa = set(map(int, sys.stdin))
else:
aaa = set()
dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 1 if 1 not in aaa else 0
for i in range(2, n + 1):
if i in aaa:
continue
... | false | 15 | [
"-def solve(string):",
"- n, m, *a = list(map(int, string.split()))",
"- ans = [0] * (n + 1)",
"- a = set(a)",
"- ans[0] = 1",
"- ans[1] = 0 if 1 in a else 1",
"- num = 1000000007",
"- for i in range(2, n + 1):",
"- if i in a:",
"- continue",
"- ans[... | false | 0.036333 | 0.047471 | 0.765369 | [
"s620307324",
"s975270573"
] |
u130900604 | p02990 | python | s955219571 | s327980043 | 876 | 34 | 14,336 | 4,852 | Accepted | Accepted | 96.12 | mod=10**9+7
n,k=list(map(int,input().split()))
from scipy.misc import comb
for i in range(1,k+1):
print((comb(n-k+1,i,exact=True)*comb(k-1,i-1,exact=True)%mod)) | # coding: utf-8
# Your code here!
def MI():return list(map(int,input().split()))
def LI():return list(MI())
N,K=list(map(int,open(0).read().split()))
# from juppyさん
mod = 10**9+7
MAX_N = 20020
fact = [1]
fact_inv = [0]*(MAX_N+4)
for i in range(MAX_N+3):
fact.append(fact[-1]*(i+1)%mod)
fact_inv... | 7 | 31 | 162 | 655 | mod = 10**9 + 7
n, k = list(map(int, input().split()))
from scipy.misc import comb
for i in range(1, k + 1):
print((comb(n - k + 1, i, exact=True) * comb(k - 1, i - 1, exact=True) % mod))
| # coding: utf-8
# Your code here!
def MI():
return list(map(int, input().split()))
def LI():
return list(MI())
N, K = list(map(int, open(0).read().split()))
# from juppyさん
mod = 10**9 + 7
MAX_N = 20020
fact = [1]
fact_inv = [0] * (MAX_N + 4)
for i in range(MAX_N + 3):
fact.append(fact[-1] * (i + 1) % mo... | false | 77.419355 | [
"+# coding: utf-8",
"+# Your code here!",
"+def MI():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+def LI():",
"+ return list(MI())",
"+",
"+",
"+N, K = list(map(int, open(0).read().split()))",
"+# from juppyさん",
"-n, k = list(map(int, input().split()))",
"-from scipy.mi... | false | 0.480062 | 0.056526 | 8.492795 | [
"s955219571",
"s327980043"
] |
u287132915 | p02973 | python | s858125628 | s210859468 | 223 | 194 | 8,592 | 85,964 | Accepted | Accepted | 13 | # 広義最長部分増加数列の長さを求めるdef
# 配列LIS自体は広義最長部分増加文字列ではない
import bisect
def lis(seq):
LIS = [seq[0]]
for i in range(1, len(seq)):
if seq[i] >= LIS[-1]:
LIS.append(seq[i])
else:
LIS[bisect.bisect_right(LIS, seq[i])] = seq[i]
return(len(LIS))
n = int(eval(input()))
... | n = int(eval(input()))
a = []
for i in range(n):
ai = int(eval(input()))
a.append(ai)
lst = [a[0]]
for i in range(1, n):
ai = a[i]
left = -1
right = len(lst)
while left+1 < right:
mid = (left + right) // 2
if lst[mid] < ai:
right = mid
else:
... | 19 | 22 | 401 | 433 | # 広義最長部分増加数列の長さを求めるdef
# 配列LIS自体は広義最長部分増加文字列ではない
import bisect
def lis(seq):
LIS = [seq[0]]
for i in range(1, len(seq)):
if seq[i] >= LIS[-1]:
LIS.append(seq[i])
else:
LIS[bisect.bisect_right(LIS, seq[i])] = seq[i]
return len(LIS)
n = int(eval(input()))
a = [0] * ... | n = int(eval(input()))
a = []
for i in range(n):
ai = int(eval(input()))
a.append(ai)
lst = [a[0]]
for i in range(1, n):
ai = a[i]
left = -1
right = len(lst)
while left + 1 < right:
mid = (left + right) // 2
if lst[mid] < ai:
right = mid
else:
left... | false | 13.636364 | [
"-# 広義最長部分増加数列の長さを求めるdef",
"-# 配列LIS自体は広義最長部分増加文字列ではない",
"-import bisect",
"-",
"-",
"-def lis(seq):",
"- LIS = [seq[0]]",
"- for i in range(1, len(seq)):",
"- if seq[i] >= LIS[-1]:",
"- LIS.append(seq[i])",
"+n = int(eval(input()))",
"+a = []",
"+for i in range(n):",... | false | 0.041067 | 0.038041 | 1.079537 | [
"s858125628",
"s210859468"
] |
u368249389 | p02742 | python | s111501850 | s441584107 | 193 | 17 | 38,256 | 2,940 | Accepted | Accepted | 91.19 |
H, W = list(map(int, input().split()))
if H==1 or W==1:
print((1))
else:
if H%2==0:
print((H*W//2))
else:
if W%2==0:
print((H*W//2))
else:
print((H*W//2+1))
| # Problem B - Bishop
import math
# input
H, W = list(map(int, input().split()))
# check
if H==1 or W==1:
print((1))
else:
ans = math.ceil(H * W / 2)
print(ans)
| 13 | 13 | 217 | 179 | H, W = list(map(int, input().split()))
if H == 1 or W == 1:
print((1))
else:
if H % 2 == 0:
print((H * W // 2))
else:
if W % 2 == 0:
print((H * W // 2))
else:
print((H * W // 2 + 1))
| # Problem B - Bishop
import math
# input
H, W = list(map(int, input().split()))
# check
if H == 1 or W == 1:
print((1))
else:
ans = math.ceil(H * W / 2)
print(ans)
| false | 0 | [
"+# Problem B - Bishop",
"+import math",
"+",
"+# input",
"+# check",
"- if H % 2 == 0:",
"- print((H * W // 2))",
"- else:",
"- if W % 2 == 0:",
"- print((H * W // 2))",
"- else:",
"- print((H * W // 2 + 1))",
"+ ans = math.ceil(H * W / 2)... | false | 0.045954 | 0.046561 | 0.986956 | [
"s111501850",
"s441584107"
] |
u353919145 | p03264 | python | s653231059 | s058102442 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | k=int(eval(input()))
count=0
for i in range (2,k+1,1):
for j in range (k+1):
if i%2==0 and j%2==1:
count+=1
print(count) | n=eval(input())
O=0
E=0
for i in range (0,int(n)):
if i%2==0 :
E+=1
else:
O+=1
print((O*E)) | 8 | 9 | 146 | 116 | k = int(eval(input()))
count = 0
for i in range(2, k + 1, 1):
for j in range(k + 1):
if i % 2 == 0 and j % 2 == 1:
count += 1
print(count)
| n = eval(input())
O = 0
E = 0
for i in range(0, int(n)):
if i % 2 == 0:
E += 1
else:
O += 1
print((O * E))
| false | 11.111111 | [
"-k = int(eval(input()))",
"-count = 0",
"-for i in range(2, k + 1, 1):",
"- for j in range(k + 1):",
"- if i % 2 == 0 and j % 2 == 1:",
"- count += 1",
"-print(count)",
"+n = eval(input())",
"+O = 0",
"+E = 0",
"+for i in range(0, int(n)):",
"+ if i % 2 == 0:",
"+ ... | false | 0.045647 | 0.049412 | 0.923811 | [
"s653231059",
"s058102442"
] |
u588341295 | p03166 | python | s866196057 | s866926359 | 1,127 | 646 | 50,968 | 74,516 | Accepted | Accepted | 42.68 | # -*- coding: utf-8 -*-
"""
参考:https://qiita.com/drken/items/03c7db44ccd27820ea0d
・自力AC
・トポロジカルソート
・解説読んで、DPする位置をちょっと変えてみた。
"""
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import... | # -*- coding: utf-8 -*-
"""
参考:https://qiita.com/drken/items/03c7db44ccd27820ea0d
・メモ化再帰でもやってみる。
"""
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions im... | 85 | 60 | 2,421 | 1,730 | # -*- coding: utf-8 -*-
"""
参考:https://qiita.com/drken/items/03c7db44ccd27820ea0d
・自力AC
・トポロジカルソート
・解説読んで、DPする位置をちょっと変えてみた。
"""
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5:
from math import gcd
else... | # -*- coding: utf-8 -*-
"""
参考:https://qiita.com/drken/items/03c7db44ccd27820ea0d
・メモ化再帰でもやってみる。
"""
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5:
from math import gcd
else:
from fractions import... | false | 29.411765 | [
"-・自力AC",
"-・トポロジカルソート",
"-・解説読んで、DPする位置をちょっと変えてみた。",
"+・メモ化再帰でもやってみる。",
"-",
"-",
"-def topological_sort(N, dag):",
"- # ここからトポロジカルソート準備",
"- incnts = [0] * N",
"- outnodes = [[] for i in range(N)]",
"- for i in range(len(dag)):",
"- # 流入するノード数",
"- incnts[dag[i][1... | false | 0.064701 | 0.03654 | 1.770693 | [
"s866196057",
"s866926359"
] |
u677121387 | p02639 | python | s713674642 | s465831235 | 59 | 23 | 61,636 | 9,164 | Accepted | Accepted | 61.02 | x = [int(i) for i in input().split()]
for i in range(5):
if x[i] == 0:
print((i+1))
break | x = [int(i) for i in input().split()]
print((x.index(0)+1)) | 5 | 2 | 111 | 58 | x = [int(i) for i in input().split()]
for i in range(5):
if x[i] == 0:
print((i + 1))
break
| x = [int(i) for i in input().split()]
print((x.index(0) + 1))
| false | 60 | [
"-for i in range(5):",
"- if x[i] == 0:",
"- print((i + 1))",
"- break",
"+print((x.index(0) + 1))"
] | false | 0.080709 | 0.07195 | 1.121741 | [
"s713674642",
"s465831235"
] |
u897329068 | p03611 | python | s190400024 | s499904685 | 324 | 96 | 37,624 | 13,964 | Accepted | Accepted | 70.37 | N = int(eval(input()))
A = list(map(int,input().split()))
afters = []
for ai in range(N):
for sign in [-1,0,1]:
afters.append(A[ai]+sign)
uniq = set(afters)
countDic = {}
sas = sorted(afters)
for a in sas:
if a in list(countDic.keys()):
countDic[a] += 1
else:
countDic[a] = 1
print((max... | N = int(eval(input()))
src = list(map(int, input().split()))
MAX = 10**5
counts = [0 for i in range(MAX+2)]
for a in src:
a += 1
counts[a-1] += 1
counts[a] += 1
counts[a+1] += 1
print((max(counts[1:-2]))) | 19 | 13 | 327 | 218 | N = int(eval(input()))
A = list(map(int, input().split()))
afters = []
for ai in range(N):
for sign in [-1, 0, 1]:
afters.append(A[ai] + sign)
uniq = set(afters)
countDic = {}
sas = sorted(afters)
for a in sas:
if a in list(countDic.keys()):
countDic[a] += 1
else:
countDic[a] = 1
pri... | N = int(eval(input()))
src = list(map(int, input().split()))
MAX = 10**5
counts = [0 for i in range(MAX + 2)]
for a in src:
a += 1
counts[a - 1] += 1
counts[a] += 1
counts[a + 1] += 1
print((max(counts[1:-2])))
| false | 31.578947 | [
"-A = list(map(int, input().split()))",
"-afters = []",
"-for ai in range(N):",
"- for sign in [-1, 0, 1]:",
"- afters.append(A[ai] + sign)",
"-uniq = set(afters)",
"-countDic = {}",
"-sas = sorted(afters)",
"-for a in sas:",
"- if a in list(countDic.keys()):",
"- countDic[a]... | false | 0.04036 | 0.052983 | 0.761748 | [
"s190400024",
"s499904685"
] |
u426108351 | p03163 | python | s608968451 | s369611823 | 635 | 553 | 173,448 | 121,708 | Accepted | Accepted | 12.91 | N, W = list(map(int, input().split()))
dp = [[0 for i in range(W + 1)] for j in range(N+1)]
for j in range(N):
w, v = list(map(int, input().split()))
for k in range(W + 1):
if k >= w:
dp[j+1][k] = max(dp[j][k-w] + v, dp[j][k])
else:
dp[j+1][k] = dp[j][k]
prin... | N, W = list(map(int, input().split()))
dp = [[0]*(W+1) for i in range(N+1)]
for i in range(N):
w, v = list(map(int, input().split()))
for j in range(W+1):
if w + j <= W:
dp[i+1][j+w] = max(dp[i][j+w], dp[i][j]+v)
dp[i+1][j] = max(dp[i][j], dp[i+1][j])
else:
... | 12 | 12 | 320 | 375 | N, W = list(map(int, input().split()))
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]
for j in range(N):
w, v = list(map(int, input().split()))
for k in range(W + 1):
if k >= w:
dp[j + 1][k] = max(dp[j][k - w] + v, dp[j][k])
else:
dp[j + 1][k] = dp[j][k]
print((dp... | N, W = list(map(int, input().split()))
dp = [[0] * (W + 1) for i in range(N + 1)]
for i in range(N):
w, v = list(map(int, input().split()))
for j in range(W + 1):
if w + j <= W:
dp[i + 1][j + w] = max(dp[i][j + w], dp[i][j] + v)
dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])
... | false | 0 | [
"-dp = [[0 for i in range(W + 1)] for j in range(N + 1)]",
"-for j in range(N):",
"+dp = [[0] * (W + 1) for i in range(N + 1)]",
"+for i in range(N):",
"- for k in range(W + 1):",
"- if k >= w:",
"- dp[j + 1][k] = max(dp[j][k - w] + v, dp[j][k])",
"+ for j in range(W + 1):",
... | false | 0.037764 | 0.049687 | 0.760041 | [
"s608968451",
"s369611823"
] |
u373499377 | p04044 | python | s762151112 | s969150092 | 20 | 18 | 3,064 | 3,060 | Accepted | Accepted | 10 | def main():
n, l = list(map(int, input().split()))
words = []
for i in range(n):
words.append(eval(input()))
words.sort()
print((''.join(words)))
if __name__ == "__main__":
main()
| def main():
n, l = list(map(int, input().split()))
words = [eval(input()) for i in range(n)]
# words = []
# for i in range(n):
# words.append(input())
words.sort()
print((''.join(words)))
if __name__ == "__main__":
main()
| 13 | 14 | 214 | 261 | def main():
n, l = list(map(int, input().split()))
words = []
for i in range(n):
words.append(eval(input()))
words.sort()
print(("".join(words)))
if __name__ == "__main__":
main()
| def main():
n, l = list(map(int, input().split()))
words = [eval(input()) for i in range(n)]
# words = []
# for i in range(n):
# words.append(input())
words.sort()
print(("".join(words)))
if __name__ == "__main__":
main()
| false | 7.142857 | [
"- words = []",
"- for i in range(n):",
"- words.append(eval(input()))",
"+ words = [eval(input()) for i in range(n)]",
"+ # words = []",
"+ # for i in range(n):",
"+ # words.append(input())"
] | false | 0.036488 | 0.036154 | 1.00925 | [
"s762151112",
"s969150092"
] |
u268793453 | p03846 | python | s795377665 | s990639740 | 105 | 85 | 14,820 | 14,820 | Accepted | Accepted | 19.05 | from collections import defaultdict
n = int(eval(input()))
A = [int(i) for i in input().split()]
p = 10 ** 9 + 7
m = n % 2 == 0
cnt = defaultdict(int)
for a in A:
if (a % 2 == 0) == m:
print((0))
exit()
cnt[a] += 1
if cnt[a] > 2 or cnt[0] > 1:
print((0))
ex... | from collections import defaultdict
n = int(eval(input()))
A = [int(i) for i in input().split()]
p = 10 ** 9 + 7
m = n % 2 == 0
cnt = defaultdict(int)
for a in A:
if (a % 2 == 0) == m:
print((0))
exit()
cnt[a] += 1
if cnt[0] > 1:
print((0))
exit(0)
del cnt[0]
f... | 19 | 27 | 342 | 410 | from collections import defaultdict
n = int(eval(input()))
A = [int(i) for i in input().split()]
p = 10**9 + 7
m = n % 2 == 0
cnt = defaultdict(int)
for a in A:
if (a % 2 == 0) == m:
print((0))
exit()
cnt[a] += 1
if cnt[a] > 2 or cnt[0] > 1:
print((0))
exit()
print((pow(2, (... | from collections import defaultdict
n = int(eval(input()))
A = [int(i) for i in input().split()]
p = 10**9 + 7
m = n % 2 == 0
cnt = defaultdict(int)
for a in A:
if (a % 2 == 0) == m:
print((0))
exit()
cnt[a] += 1
if cnt[0] > 1:
print((0))
exit(0)
del cnt[0]
for c in list(cnt.values()):
... | false | 29.62963 | [
"- if cnt[a] > 2 or cnt[0] > 1:",
"+if cnt[0] > 1:",
"+ print((0))",
"+ exit(0)",
"+del cnt[0]",
"+for c in list(cnt.values()):",
"+ if c != 2:",
"- exit()",
"+ exit(0)"
] | false | 0.047859 | 0.048639 | 0.983968 | [
"s795377665",
"s990639740"
] |
u118772524 | p02676 | python | s504758819 | s944015194 | 26 | 23 | 8,928 | 9,164 | Accepted | Accepted | 11.54 |
k= int(eval(input()))
s= eval(input())
a=len(s)
if k >= a:
print(s)
else :
print((s[:k]+"..."))
| k= int(eval(input()))
s= str(eval(input()))
a=len(s)
if k >= a:
print(s)
else :
print((s[:k]+"...")) | 12 | 10 | 103 | 102 | k = int(eval(input()))
s = eval(input())
a = len(s)
if k >= a:
print(s)
else:
print((s[:k] + "..."))
| k = int(eval(input()))
s = str(eval(input()))
a = len(s)
if k >= a:
print(s)
else:
print((s[:k] + "..."))
| false | 16.666667 | [
"-s = eval(input())",
"+s = str(eval(input()))"
] | false | 0.03565 | 0.044418 | 0.802604 | [
"s504758819",
"s944015194"
] |
u440566786 | p02913 | python | s648540674 | s617333947 | 955 | 217 | 53,636 | 43,376 | Accepted | Accepted | 77.28 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
class SuffixArray(object):
"""
construct:
suffix array: O(N(logN)^2)
lcp array: O(N)
sparse table: O(NlogN)
query:
lcp: O(1)
"""
def __i... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def bisect(l,r,f,discrete=True,left=True):
"""
l,r: l<r int if discrete else float
f: function defined on [l,...,r] to {False,True}
if discrete: f defined on Z; else: R
if ... | 93 | 103 | 2,510 | 3,065 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
class SuffixArray(object):
"""
construct:
suffix array: O(N(logN)^2)
lcp array: O(N)
sparse table: O(NlogN)
query:
lcp: O(1)
"""
def __ini... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def bisect(l, r, f, discrete=True, left=True):
"""
l,r: l<r int if discrete else float
f: function defined on [l,...,r] to {False,True}
if discrete: f defined on Z; else: R
... | false | 9.708738 | [
"-class SuffixArray(object):",
"+def bisect(l, r, f, discrete=True, left=True):",
"- construct:",
"- suffix array: O(N(logN)^2)",
"- lcp array: O(N)",
"- sparse table: O(NlogN)",
"+ l,r: l<r int if discrete else float",
"+ f: function defined on [l,...,r] to {False,True}"... | false | 0.047361 | 0.039476 | 1.199752 | [
"s648540674",
"s617333947"
] |
u347600233 | p02762 | python | s480795128 | s760949693 | 1,117 | 656 | 13,420 | 18,324 | Accepted | Accepted | 41.27 | # UnionFind: https://note.nkmk.me/python-union-find/
n, m, k = list(map(int, input().split()))
class UnionFind():
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
def find(self, x):
if self.root[x] < 0:
return x
else:
self.r... | # UnionFind: https://note.nkmk.me/python-union-find/
class UnionFind():
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
def find(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.find(self.root[x])
... | 45 | 43 | 1,210 | 1,175 | # UnionFind: https://note.nkmk.me/python-union-find/
n, m, k = list(map(int, input().split()))
class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
def find(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.find(... | # UnionFind: https://note.nkmk.me/python-union-find/
class UnionFind:
def __init__(self, n):
self.n = n
self.root = [-1] * (n + 1)
def find(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.find(self.root[x])
return self.root[x... | false | 4.444444 | [
"-n, m, k = list(map(int, input().split()))",
"-",
"-",
"-candidate = [-1] * (n + 1)",
"-f_ship = UnionFind(n)",
"-for _ in range(m):",
"+n, m, k = list(map(int, input().split()))",
"+friends = UnionFind(n)",
"+f_or_b = [1] * (n + 1)",
"+for i in range(m):",
"- candidate[a] -= 1",
"- can... | false | 0.042843 | 0.103307 | 0.414714 | [
"s480795128",
"s760949693"
] |
u189023301 | p02972 | python | s352987963 | s087492539 | 238 | 212 | 13,108 | 13,088 | Accepted | Accepted | 10.92 | n = int(input())
lis = list(map(int, input().split()))
val = [0] * n
for i in range(n, 0, -1):
if n // i == 1:
val[i - 1] = lis[i - 1]
else:
a = sum(val[i - 1::i])
if a % 2 == lis[i - 1]:
val[i - 1] = 0
else:
val[i - 1] = 1
print(sum(val))
... | import sys
input = sys.stdin.readline
def main():
n = int(input())
lis = list(map(int, input().split()))
val = [0] * n
for i in range(n, 0, -1):
if n // i == 1:
val[i - 1] = lis[i - 1]
else:
a = sum(val[i - 1::i])
if a % 2 != lis[i - 1]:... | 16 | 21 | 379 | 485 | n = int(input())
lis = list(map(int, input().split()))
val = [0] * n
for i in range(n, 0, -1):
if n // i == 1:
val[i - 1] = lis[i - 1]
else:
a = sum(val[i - 1 :: i])
if a % 2 == lis[i - 1]:
val[i - 1] = 0
else:
val[i - 1] = 1
print(sum(val))
print(*[i + 1 ... | import sys
input = sys.stdin.readline
def main():
n = int(input())
lis = list(map(int, input().split()))
val = [0] * n
for i in range(n, 0, -1):
if n // i == 1:
val[i - 1] = lis[i - 1]
else:
a = sum(val[i - 1 :: i])
if a % 2 != lis[i - 1]:
... | false | 23.809524 | [
"-n = int(input())",
"-lis = list(map(int, input().split()))",
"-val = [0] * n",
"-for i in range(n, 0, -1):",
"- if n // i == 1:",
"- val[i - 1] = lis[i - 1]",
"- else:",
"- a = sum(val[i - 1 :: i])",
"- if a % 2 == lis[i - 1]:",
"- val[i - 1] = 0",
"+impor... | false | 0.04156 | 0.080027 | 0.519324 | [
"s352987963",
"s087492539"
] |
u780025254 | p02392 | python | s780595058 | s281751180 | 30 | 20 | 7,712 | 5,588 | Accepted | Accepted | 33.33 | nums = input().split()
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])
if a < b < c:
print('Yes')
else:
print('No') | a, b, c = list(map(int, input().split()))
if a < b < c:
print("Yes")
else:
print("No")
| 9 | 6 | 135 | 95 | nums = input().split()
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])
if a < b < c:
print("Yes")
else:
print("No")
| a, b, c = list(map(int, input().split()))
if a < b < c:
print("Yes")
else:
print("No")
| false | 33.333333 | [
"-nums = input().split()",
"-a = int(nums[0])",
"-b = int(nums[1])",
"-c = int(nums[2])",
"+a, b, c = list(map(int, input().split()))"
] | false | 0.062281 | 0.035111 | 1.773826 | [
"s780595058",
"s281751180"
] |
u775681539 | p02996 | python | s733256196 | s719085549 | 704 | 412 | 31,992 | 31,828 | Accepted | Accepted | 41.48 | #python3
from operator import itemgetter
from itertools import accumulate
def main():
n = int(eval(input()))
d = []
for _ in range(n):
x, y = list(map(int, input().split()))
d.append((x, y))
d.sort(key=itemgetter(1))
acc = 0
f = True
for i in range(n):
a... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from operator import itemgetter
def main():
N = int(readline())
tasks = []
for _ in range(N):
a, b = list(map(int, readline().split()))
tasks.append((a, b))
t... | 21 | 22 | 449 | 527 | # python3
from operator import itemgetter
from itertools import accumulate
def main():
n = int(eval(input()))
d = []
for _ in range(n):
x, y = list(map(int, input().split()))
d.append((x, y))
d.sort(key=itemgetter(1))
acc = 0
f = True
for i in range(n):
acc = acc + ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from operator import itemgetter
def main():
N = int(readline())
tasks = []
for _ in range(N):
a, b = list(map(int, readline().split()))
tasks.append((a, b))
tasks.sort(k... | false | 4.545455 | [
"-# python3",
"+import sys",
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"-from itertools import accumulate",
"- n = int(eval(input()))",
"- d = []",
"- for _ in range(n):",
"- x, y = list(map(int, inpu... | false | 0.068257 | 0.038176 | 1.787967 | [
"s733256196",
"s719085549"
] |
u237513745 | p02947 | python | s652803763 | s535735299 | 531 | 438 | 21,988 | 23,644 | Accepted | Accepted | 17.51 | n = int(eval(input()))
dict = {}
ans = 0
for i in range(n):
s = str(sorted(eval(input())))
if s in list(dict.keys()):
ans += dict[s]
dict[s] += 1
else:
dict[s] = 1
print(ans)
| n = int(eval(input()))
dict = {}
ans = 0
for i in range(n):
s = tuple(sorted(eval(input())))
if s in list(dict.keys()):
ans += dict[s]
dict[s] += 1
else:
dict[s] = 1
print(ans) | 12 | 12 | 205 | 206 | n = int(eval(input()))
dict = {}
ans = 0
for i in range(n):
s = str(sorted(eval(input())))
if s in list(dict.keys()):
ans += dict[s]
dict[s] += 1
else:
dict[s] = 1
print(ans)
| n = int(eval(input()))
dict = {}
ans = 0
for i in range(n):
s = tuple(sorted(eval(input())))
if s in list(dict.keys()):
ans += dict[s]
dict[s] += 1
else:
dict[s] = 1
print(ans)
| false | 0 | [
"- s = str(sorted(eval(input())))",
"+ s = tuple(sorted(eval(input())))"
] | false | 0.048737 | 0.048215 | 1.010818 | [
"s652803763",
"s535735299"
] |
u156815136 | p03673 | python | s933601231 | s292691481 | 211 | 165 | 26,020 | 32,356 | Accepted | Accepted | 21.8 | #
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
r_ = n / m
if (r_ - (n // m)) > 0:
return (n//m) + 1
else:
return (n//m)"""
""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counte... | 78 | 37 | 1,427 | 822 | #
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
# import math
# mod = 10**9+7
# import itertools
# import fractions
# import numpy as np
# mod = 10**4 + 7
"""def kiri(n,m):
r_ = n / m
if (r_ - (n // m)) > 0:
return (n//m) + 1
else:
return (n//m)"""
""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate # (string,3) 3回
# from collections import deque
from collections import deque, defaultdict, Co... | false | 52.564103 | [
"+# from statistics import median",
"+# import collections",
"+# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]",
"+from fractions import gcd",
"+from itertools import combinations, permutations, accumulate # (string,3) 3回",
"+",
"+# from collections import deque",
... | false | 0.082144 | 0.041246 | 1.991572 | [
"s933601231",
"s292691481"
] |
u571969099 | p02862 | python | s438165395 | s821525620 | 231 | 191 | 3,188 | 38,640 | Accepted | Accepted | 17.32 | x, y = [int(i) for i in input().split()]
if (x + y) % 3 != 0:
print((0))
exit()
z = (x + y) // 3
x -= z
y -= z
p = 10**9+7
def kai(x, p):
a = 1
for i in range(1, x + 1):
a *= i
a %= p
return a
def comb(a, b, p):
if a < 0 or b < 0:
return 0
e... | x, y = [int(i) for i in input().split()]
def kai(x, p):
a = 1
for i in range(1, x + 1):
a *= i
a %= p
return a
def comb(a, b, p):
if a < 0 or b < 0:
return 0
elif a < b:
return 0
c = 1
c *= kai(a, p)
c *= pow(kai(b, p), p - 2, p)
c *... | 32 | 27 | 498 | 494 | x, y = [int(i) for i in input().split()]
if (x + y) % 3 != 0:
print((0))
exit()
z = (x + y) // 3
x -= z
y -= z
p = 10**9 + 7
def kai(x, p):
a = 1
for i in range(1, x + 1):
a *= i
a %= p
return a
def comb(a, b, p):
if a < 0 or b < 0:
return 0
elif a < b:
re... | x, y = [int(i) for i in input().split()]
def kai(x, p):
a = 1
for i in range(1, x + 1):
a *= i
a %= p
return a
def comb(a, b, p):
if a < 0 or b < 0:
return 0
elif a < b:
return 0
c = 1
c *= kai(a, p)
c *= pow(kai(b, p), p - 2, p)
c *= pow(kai(a - b... | false | 15.625 | [
"-if (x + y) % 3 != 0:",
"- print((0))",
"- exit()",
"-z = (x + y) // 3",
"-x -= z",
"-y -= z",
"-p = 10**9 + 7",
"-print((comb(x + y, x, p)))",
"+if (x + y) % 3 != 0:",
"+ print((0))",
"+ exit()",
"+z = (x + y) // 3",
"+p = 10**9 + 7",
"+print((comb(x + y - 2 * z, x - z, p)))"... | false | 0.345959 | 0.097329 | 3.554537 | [
"s438165395",
"s821525620"
] |
u196746947 | p02647 | python | s378828408 | s198772790 | 317 | 262 | 153,116 | 127,788 | Accepted | Accepted | 17.35 | import sys
input=sys.stdin.readline
def main():
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
zeros=[0]*n
if min(a)==n:
print((*a))
exit()
for i in range(k):
x=zeros.copy()
for j in range(n):
if a[j]==0:
... | import sys
input=sys.stdin.readline
def main():
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
zeros=[0]*n
if min(a)==n:
print((*a))
exit()
for i in range(k):
x=zeros.copy()
for j in range(n):
l=max(0,j-a[j]... | 46 | 38 | 1,090 | 810 | import sys
input = sys.stdin.readline
def main():
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
zeros = [0] * n
if min(a) == n:
print((*a))
exit()
for i in range(k):
x = zeros.copy()
for j in range(n):
if a[j] == 0:
... | import sys
input = sys.stdin.readline
def main():
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
zeros = [0] * n
if min(a) == n:
print((*a))
exit()
for i in range(k):
x = zeros.copy()
for j in range(n):
l = max(0, j - a[j])
... | false | 17.391304 | [
"- if a[j] == 0:",
"- l = j",
"- r = min(j + 1, n)",
"- # print(l,r)",
"- x[l] += 1",
"- if r != n:",
"- # print(r)",
"- x[r] += -1",
"- # print(x)",
"- ... | false | 0.039474 | 0.046126 | 0.855797 | [
"s378828408",
"s198772790"
] |
u230621983 | p02726 | python | s267383883 | s582519778 | 1,986 | 1,736 | 3,444 | 3,444 | Accepted | Accepted | 12.59 | n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
ans_l = [0]*n
for i in range(n):
for j in range(i, n):
k = min(abs(j-i), abs(x-i)+1+abs(y-j), abs(x-j)+1+abs(y-i))
ans_l[k] += 1
for ans in ans_l[1:]:
print(ans) | n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
ans_l = [0]*n
def min_dist(a,b):
return min(b-a, abs(x-a)+1+abs(y-b), abs(x-b)+1+abs(y-a))
for i in range(n):
for j in range(i, n):
k = min_dist(i,j)
ans_l[k] += 1
for ans in ans_l[1:]:
print(ans) | 10 | 13 | 244 | 287 | n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
ans_l = [0] * n
for i in range(n):
for j in range(i, n):
k = min(abs(j - i), abs(x - i) + 1 + abs(y - j), abs(x - j) + 1 + abs(y - i))
ans_l[k] += 1
for ans in ans_l[1:]:
print(ans)
| n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
ans_l = [0] * n
def min_dist(a, b):
return min(b - a, abs(x - a) + 1 + abs(y - b), abs(x - b) + 1 + abs(y - a))
for i in range(n):
for j in range(i, n):
k = min_dist(i, j)
ans_l[k] += 1
for ans in ans_l[1:]:
print(ans)
| false | 23.076923 | [
"+",
"+",
"+def min_dist(a, b):",
"+ return min(b - a, abs(x - a) + 1 + abs(y - b), abs(x - b) + 1 + abs(y - a))",
"+",
"+",
"- k = min(abs(j - i), abs(x - i) + 1 + abs(y - j), abs(x - j) + 1 + abs(y - i))",
"+ k = min_dist(i, j)"
] | false | 0.039773 | 0.039627 | 1.00368 | [
"s267383883",
"s582519778"
] |
u145950990 | p02995 | python | s857654535 | s277373307 | 38 | 35 | 5,344 | 5,076 | Accepted | Accepted | 7.89 | import fractions
a,b,c,d = list(map(int,input().split()))
e = c*d//fractions.gcd(c,d)
cnt = b-a+1
c_cnt = b//c-(a-1)//c
d_cnt = b//d-(a-1)//d
e_cnt = b//e-(a-1)//e
print((cnt-c_cnt-d_cnt+e_cnt)) | import fractions
def div_cnt(x):
return b//x-(a-1)//x
a,b,c,d = list(map(int,input().split()))
e = c*d//fractions.gcd(c,d)
cnt = b-a+1
c_cnt = div_cnt(c)
d_cnt = div_cnt(d)
e_cnt = div_cnt(e)
print((cnt-c_cnt-d_cnt+e_cnt)) | 8 | 11 | 193 | 229 | import fractions
a, b, c, d = list(map(int, input().split()))
e = c * d // fractions.gcd(c, d)
cnt = b - a + 1
c_cnt = b // c - (a - 1) // c
d_cnt = b // d - (a - 1) // d
e_cnt = b // e - (a - 1) // e
print((cnt - c_cnt - d_cnt + e_cnt))
| import fractions
def div_cnt(x):
return b // x - (a - 1) // x
a, b, c, d = list(map(int, input().split()))
e = c * d // fractions.gcd(c, d)
cnt = b - a + 1
c_cnt = div_cnt(c)
d_cnt = div_cnt(d)
e_cnt = div_cnt(e)
print((cnt - c_cnt - d_cnt + e_cnt))
| false | 27.272727 | [
"+",
"+",
"+def div_cnt(x):",
"+ return b // x - (a - 1) // x",
"+",
"-c_cnt = b // c - (a - 1) // c",
"-d_cnt = b // d - (a - 1) // d",
"-e_cnt = b // e - (a - 1) // e",
"+c_cnt = div_cnt(c)",
"+d_cnt = div_cnt(d)",
"+e_cnt = div_cnt(e)"
] | false | 0.058375 | 0.058056 | 1.005492 | [
"s857654535",
"s277373307"
] |
u541055501 | p03431 | python | s759867080 | s058122089 | 1,191 | 1,083 | 28,728 | 28,876 | Accepted | Accepted | 9.07 | n,k=list(map(int,input().split()))
p=998244353
r=range
f=[1]
for i in r(k):f+=[-~i*f[i]%p]
a=0
for i in r(n-1,k):a+=f[k-1]*pow(f[i]*f[k-1-i],-1,p)
print((a%p)) | n,k=list(map(int,input().split()))
p=998244353
r=range
f=[1]
for i in r(k):f+=[-~i*f[i]%p]
print((sum(f[k-1]*pow(f[i]*f[k-1-i],-1,p)for i in r(n-1,k))%p)) | 8 | 6 | 158 | 151 | n, k = list(map(int, input().split()))
p = 998244353
r = range
f = [1]
for i in r(k):
f += [-~i * f[i] % p]
a = 0
for i in r(n - 1, k):
a += f[k - 1] * pow(f[i] * f[k - 1 - i], -1, p)
print((a % p))
| n, k = list(map(int, input().split()))
p = 998244353
r = range
f = [1]
for i in r(k):
f += [-~i * f[i] % p]
print((sum(f[k - 1] * pow(f[i] * f[k - 1 - i], -1, p) for i in r(n - 1, k)) % p))
| false | 25 | [
"-a = 0",
"-for i in r(n - 1, k):",
"- a += f[k - 1] * pow(f[i] * f[k - 1 - i], -1, p)",
"-print((a % p))",
"+print((sum(f[k - 1] * pow(f[i] * f[k - 1 - i], -1, p) for i in r(n - 1, k)) % p))"
] | false | 0.426228 | 0.135645 | 3.142241 | [
"s759867080",
"s058122089"
] |
u790012205 | p03805 | python | s746574429 | s279237252 | 212 | 25 | 42,716 | 3,064 | Accepted | Accepted | 88.21 | N, M = list(map(int, input().split()))
R = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
R[a - 1].append(b - 1)
R[b - 1].append(a - 1)
Parents = [[] for i in range(N)]
C = 0
def func(x, c):
global C
c += 1
last = True
for r in R[x]:
i... | import sys
sys.setrecursionlimit(10 ** 9)
N, M = list(map(int, input().split()))
G = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
D = [0] * N
D[0] = 1
C = 0
def dfs(n):
global C
if not 0 in D:
C... | 30 | 26 | 704 | 466 | N, M = list(map(int, input().split()))
R = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
R[a - 1].append(b - 1)
R[b - 1].append(a - 1)
Parents = [[] for i in range(N)]
C = 0
def func(x, c):
global C
c += 1
last = True
for r in R[x]:
if r in Parent... | import sys
sys.setrecursionlimit(10**9)
N, M = list(map(int, input().split()))
G = [[] for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
D = [0] * N
D[0] = 1
C = 0
def dfs(n):
global C
if not 0 in D:
C += 1
r... | false | 13.333333 | [
"+import sys",
"+",
"+sys.setrecursionlimit(10**9)",
"-R = [[] for i in range(N)]",
"-for i in range(M):",
"+G = [[] for _ in range(N)]",
"+for _ in range(M):",
"- R[a - 1].append(b - 1)",
"- R[b - 1].append(a - 1)",
"-Parents = [[] for i in range(N)]",
"+ G[a - 1].append(b - 1)",
"+ ... | false | 0.203761 | 0.074662 | 2.72911 | [
"s746574429",
"s279237252"
] |
u631277801 | p03472 | python | s477655142 | s619564256 | 350 | 217 | 17,400 | 11,600 | Accepted | Accepted | 38 | from itertools import accumulate
from bisect import bisect_left
from math import ceil
N,H = list(map(int, input().split()))
A = []
B = []
for _ in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
# 最も強いaを探す
a_max = max(A)
# それ以上のbを探す
b_strong = []
for b in 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.rea... | 35 | 42 | 655 | 845 | from itertools import accumulate
from bisect import bisect_left
from math import ceil
N, H = list(map(int, input().split()))
A = []
B = []
for _ in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
# 最も強いaを探す
a_max = max(A)
# それ以上のbを探す
b_strong = []
for b in B:
if b >= a_max:
... | 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 | 16.666667 | [
"-from itertools import accumulate",
"-from bisect import bisect_left",
"-from math import ceil",
"+import sys",
"-N, H = list(map(int, input().split()))",
"-A = []",
"-B = []",
"-for _ in range(N):",
"- a, b = list(map(int, input().split()))",
"- A.append(a)",
"- B.append(b)",
"-# 最も... | false | 0.039656 | 0.046833 | 0.846755 | [
"s477655142",
"s619564256"
] |
u578953945 | p03386 | python | s757323011 | s157453529 | 180 | 162 | 38,384 | 38,256 | Accepted | Accepted | 10 | a,b,k=list(map(int,input().split()))
s=list(range(a,b+1))
for i in sorted(set(s[:k]) | set(s[-k:])):
print(i) | a,b,k=list(map(int,input().split()))
l=list(range(a,b+1))
la= set(l[:k]) | set(l[-k:])
for i in (sorted(la)):
print(i) | 4 | 5 | 104 | 112 | a, b, k = list(map(int, input().split()))
s = list(range(a, b + 1))
for i in sorted(set(s[:k]) | set(s[-k:])):
print(i)
| a, b, k = list(map(int, input().split()))
l = list(range(a, b + 1))
la = set(l[:k]) | set(l[-k:])
for i in sorted(la):
print(i)
| false | 20 | [
"-s = list(range(a, b + 1))",
"-for i in sorted(set(s[:k]) | set(s[-k:])):",
"+l = list(range(a, b + 1))",
"+la = set(l[:k]) | set(l[-k:])",
"+for i in sorted(la):"
] | false | 0.040727 | 0.044082 | 0.923901 | [
"s757323011",
"s157453529"
] |
u186838327 | p02887 | python | s361403871 | s604999777 | 50 | 41 | 3,316 | 3,316 | Accepted | Accepted | 18 | n = int(eval(input()))
s = str(eval(input()))
ans = 0
for i in range(n):
if i == 0:
ans += 1
else:
if s[i-1] == s[i]:
continue
else:
ans += 1
print(ans) | n = int(eval(input()))
s = str(eval(input()))
ans = 1
for i in range(1, n):
if s[i] != s[i-1]:
ans += 1
print(ans) | 13 | 8 | 181 | 122 | n = int(eval(input()))
s = str(eval(input()))
ans = 0
for i in range(n):
if i == 0:
ans += 1
else:
if s[i - 1] == s[i]:
continue
else:
ans += 1
print(ans)
| n = int(eval(input()))
s = str(eval(input()))
ans = 1
for i in range(1, n):
if s[i] != s[i - 1]:
ans += 1
print(ans)
| false | 38.461538 | [
"-ans = 0",
"-for i in range(n):",
"- if i == 0:",
"+ans = 1",
"+for i in range(1, n):",
"+ if s[i] != s[i - 1]:",
"- else:",
"- if s[i - 1] == s[i]:",
"- continue",
"- else:",
"- ans += 1"
] | false | 0.068215 | 0.064061 | 1.064847 | [
"s361403871",
"s604999777"
] |
u677523557 | p02851 | python | s827499356 | s325747354 | 573 | 470 | 59,496 | 166,780 | Accepted | Accepted | 17.98 | from bisect import bisect_right
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(N):
A[i] = (A[i]-1)%K
B = [0]
for a in A:
B.append((B[-1]+a)%K)
dic = {}
for i, b in enumerate(B):
if not b in list(dic.keys()):
dic[b] = [i]
else:
... | import sys
input = sys.stdin.readline
from collections import deque
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [0]
for a in A:
b = (B[-1] + (a-1)) % K
B.append(b)
ans = 0
dic = {}
for i, b in enumerate(B):
if b in dic:
dic[b].append(i)
else... | 27 | 27 | 505 | 496 | from bisect import bisect_right
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(N):
A[i] = (A[i] - 1) % K
B = [0]
for a in A:
B.append((B[-1] + a) % K)
dic = {}
for i, b in enumerate(B):
if not b in list(dic.keys()):
dic[b] = [i]
else:
dic[b].ap... | import sys
input = sys.stdin.readline
from collections import deque
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [0]
for a in A:
b = (B[-1] + (a - 1)) % K
B.append(b)
ans = 0
dic = {}
for i, b in enumerate(B):
if b in dic:
dic[b].append(i)
else:
dic[b]... | false | 0 | [
"-from bisect import bisect_right",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+from collections import deque",
"-for i in range(N):",
"- A[i] = (A[i] - 1) % K",
"- B.append((B[-1] + a) % K)",
"+ b = (B[-1] + (a - 1)) % K",
"+ B.append(b)",
"+ans = 0",
"- if not b in li... | false | 0.034646 | 0.035821 | 0.967211 | [
"s827499356",
"s325747354"
] |
u888092736 | p02796 | python | s139574180 | s405427146 | 310 | 223 | 32,100 | 25,876 | Accepted | Accepted | 28.06 | (N,), *XL = [list(map(int, s.split())) for s in open(0)]
XL.sort(key=lambda x: x[0] + x[1])
curr = -float("inf")
ans = 0
for x, l in XL:
if x - l >= curr:
curr = x + l
ans += 1
print(ans)
| N, *XL = list(map(int, open(0).read().split()))
XL = sorted((x + l, x - l) for x, l in zip(*[iter(XL)] * 2))
curr = -float("inf")
ans = 0
for right, left in XL:
if left >= curr:
curr = right
ans += 1
print(ans)
| 9 | 10 | 216 | 235 | (N,), *XL = [list(map(int, s.split())) for s in open(0)]
XL.sort(key=lambda x: x[0] + x[1])
curr = -float("inf")
ans = 0
for x, l in XL:
if x - l >= curr:
curr = x + l
ans += 1
print(ans)
| N, *XL = list(map(int, open(0).read().split()))
XL = sorted((x + l, x - l) for x, l in zip(*[iter(XL)] * 2))
curr = -float("inf")
ans = 0
for right, left in XL:
if left >= curr:
curr = right
ans += 1
print(ans)
| false | 10 | [
"-(N,), *XL = [list(map(int, s.split())) for s in open(0)]",
"-XL.sort(key=lambda x: x[0] + x[1])",
"+N, *XL = list(map(int, open(0).read().split()))",
"+XL = sorted((x + l, x - l) for x, l in zip(*[iter(XL)] * 2))",
"-for x, l in XL:",
"- if x - l >= curr:",
"- curr = x + l",
"+for right, l... | false | 0.047815 | 0.048211 | 0.991791 | [
"s139574180",
"s405427146"
] |
u780342333 | p02382 | python | s013543645 | s308640097 | 30 | 20 | 7,820 | 5,668 | Accepted | Accepted | 33.33 | import math
n = int(eval(input()))
vector_x = [float(x) for x in input().split(" ")]
vector_y = [float(y) for y in input().split(" ")]
p1 = sum([abs(x - y) for x, y in zip(vector_x, vector_y)])
p2 = sum([abs(x - y) ** 2 for x, y in zip(vector_x, vector_y)]) ** (1/2)
p3 = sum([abs(x - y) ** 3 for x, y in zip(v... | def get_minkowski_distance(a, b, p):
"""
get Minkowski's distance
a : int list
b : int list
p : int
"""
s = 0
res = 0.0
if p == 0:
l = []
for x, y in zip(a, b):
l.append(abs(x - y))
res = max(l)
else:
for x, y in zip... | 15 | 34 | 515 | 734 | import math
n = int(eval(input()))
vector_x = [float(x) for x in input().split(" ")]
vector_y = [float(y) for y in input().split(" ")]
p1 = sum([abs(x - y) for x, y in zip(vector_x, vector_y)])
p2 = sum([abs(x - y) ** 2 for x, y in zip(vector_x, vector_y)]) ** (1 / 2)
p3 = sum([abs(x - y) ** 3 for x, y in zip(vector_x... | def get_minkowski_distance(a, b, p):
"""
get Minkowski's distance
a : int list
b : int list
p : int
"""
s = 0
res = 0.0
if p == 0:
l = []
for x, y in zip(a, b):
l.append(abs(x - y))
res = max(l)
else:
for x, y in zip(a, b):
... | false | 55.882353 | [
"-import math",
"+def get_minkowski_distance(a, b, p):",
"+ \"\"\"",
"+ get Minkowski's distance",
"+ a : int list",
"+ b : int list",
"+ p : int",
"+ \"\"\"",
"+ s = 0",
"+ res = 0.0",
"+ if p == 0:",
"+ l = []",
"+ for x, y in zip(a, b):",
"+ ... | false | 0.035019 | 0.007369 | 4.752347 | [
"s013543645",
"s308640097"
] |
u627803856 | p02773 | python | s736997484 | s500906671 | 1,062 | 771 | 120,784 | 45,788 | Accepted | Accepted | 27.4 | from collections import Counter
n=int(eval(input()))
s=[eval(input()) for i in range(n)]
c = Counter(s)
c2 = c.most_common()
m = c2[0][1]#最大値
ans = [i[0] for i in c2 if i[1] == m]#回数が最大となるもの
ans.sort()
print((*ans)) | n = int(eval(input()))
d = {}
for _ in range(n):
s = eval(input())
d[s] = d.get(s, 0) + 1
sorted_d = sorted(list(d.items()), key=lambda x:x[1], reverse=True)
ma = sorted_d[0][1]
res = []
for i in range(len(sorted_d)):
if sorted_d[i][1] == ma:
res.append(sorted_d[i][0])
res.sort()
... | 11 | 19 | 213 | 349 | from collections import Counter
n = int(eval(input()))
s = [eval(input()) for i in range(n)]
c = Counter(s)
c2 = c.most_common()
m = c2[0][1] # 最大値
ans = [i[0] for i in c2 if i[1] == m] # 回数が最大となるもの
ans.sort()
print((*ans))
| n = int(eval(input()))
d = {}
for _ in range(n):
s = eval(input())
d[s] = d.get(s, 0) + 1
sorted_d = sorted(list(d.items()), key=lambda x: x[1], reverse=True)
ma = sorted_d[0][1]
res = []
for i in range(len(sorted_d)):
if sorted_d[i][1] == ma:
res.append(sorted_d[i][0])
res.sort()
for i in range(len... | false | 42.105263 | [
"-from collections import Counter",
"-",
"-s = [eval(input()) for i in range(n)]",
"-c = Counter(s)",
"-c2 = c.most_common()",
"-m = c2[0][1] # 最大値",
"-ans = [i[0] for i in c2 if i[1] == m] # 回数が最大となるもの",
"-ans.sort()",
"-print((*ans))",
"+d = {}",
"+for _ in range(n):",
"+ s = eval(input... | false | 0.038458 | 0.081443 | 0.472205 | [
"s736997484",
"s500906671"
] |
u143509139 | p02847 | python | s231698578 | s474989028 | 180 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.56 | s = eval(input())
print((['', 'SAT', 'FRI', 'THU', 'WED', 'TUE', 'MON', 'SUN'].index(s))) | print((7-['SUN','MON','TUE','WED','THU','FRI','SAT'].index(eval(input())))) | 2 | 1 | 82 | 67 | s = eval(input())
print((["", "SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"].index(s)))
| print((7 - ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"].index(eval(input()))))
| false | 50 | [
"-s = eval(input())",
"-print(([\"\", \"SAT\", \"FRI\", \"THU\", \"WED\", \"TUE\", \"MON\", \"SUN\"].index(s)))",
"+print((7 - [\"SUN\", \"MON\", \"TUE\", \"WED\", \"THU\", \"FRI\", \"SAT\"].index(eval(input()))))"
] | false | 0.048938 | 0.085804 | 0.570345 | [
"s231698578",
"s474989028"
] |
u498487134 | p02948 | python | s944807942 | s983330024 | 1,045 | 217 | 71,456 | 86,104 | Accepted | Accepted | 79.23 | #最終日から見る,残り日数条件を満たす中で最大収入のものを選ぶ
import heapq
N,M=list(map(int,input().split()))
AB=[[0,0] for _ in range(N)]
for i in range(N):
AB[i][0],AB[i][1] = list(map(int,input().split()))
AB.sort()
ans=0
q=[]
heapq.heapify(q)
ne=0
#dは残り日数
for d in range(1,M+1):
for i in range(ne,N):
if AB... | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
import heapq
mod=10**9+7
N,M=MI()
L=[[]for _ in range(M)]
for i in range(N):
#何日までに受ける必要があるかを気... | 29 | 35 | 496 | 692 | # 最終日から見る,残り日数条件を満たす中で最大収入のものを選ぶ
import heapq
N, M = list(map(int, input().split()))
AB = [[0, 0] for _ in range(N)]
for i in range(N):
AB[i][0], AB[i][1] = list(map(int, input().split()))
AB.sort()
ans = 0
q = []
heapq.heapify(q)
ne = 0
# dは残り日数
for d in range(1, M + 1):
for i in range(ne, N):
if AB[i... | import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
import heapq
mod = 10**9 + 7
N, M = MI()
L = [[] for _ in range(M)]
for i in range(N):
... | false | 17.142857 | [
"-# 最終日から見る,残り日数条件を満たす中で最大収入のものを選ぶ",
"-import heapq",
"+import sys",
"-N, M = list(map(int, input().split()))",
"-AB = [[0, 0] for _ in range(N)]",
"-for i in range(N):",
"- AB[i][0], AB[i][1] = list(map(int, input().split()))",
"-AB.sort()",
"-ans = 0",
"-q = []",
"-heapq.heapify(q)",
"-ne... | false | 0.034991 | 0.037064 | 0.944056 | [
"s944807942",
"s983330024"
] |
u396495667 | p03852 | python | s169612949 | s547550854 | 169 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.94 | c = eval(input())
list = ['a','i','u','e','o']
if c in list:
print('vowel')
else:
print('consonant') | s = eval(input())
a = {'a','i','u','e','o'}
if s in a:
print('vowel')
else:
print('consonant') | 8 | 7 | 107 | 99 | c = eval(input())
list = ["a", "i", "u", "e", "o"]
if c in list:
print("vowel")
else:
print("consonant")
| s = eval(input())
a = {"a", "i", "u", "e", "o"}
if s in a:
print("vowel")
else:
print("consonant")
| false | 12.5 | [
"-c = eval(input())",
"-list = [\"a\", \"i\", \"u\", \"e\", \"o\"]",
"-if c in list:",
"+s = eval(input())",
"+a = {\"a\", \"i\", \"u\", \"e\", \"o\"}",
"+if s in a:"
] | false | 0.042895 | 0.040387 | 1.062084 | [
"s169612949",
"s547550854"
] |
u972591645 | p02579 | python | s614562886 | s281623185 | 1,903 | 1,607 | 23,668 | 23,476 | Accepted | Accepted | 15.55 | from collections import deque
def main():
h, w = list(map(int, input().split()))
start_h, start_w = [int(x)+1 for x in input().split()]
goal_h, goal_w = [int(x)+1 for x in input().split()]
s = ["#"*(w+4)]
s.append("#"*(w+4))
for _ in range(h):
s.append("##" + eval(input()) + ... | from collections import deque
def main():
h, w = list(map(int, input().split()))
c = list([int(x)+1 for x in input().split()])
d = list([int(x)+1 for x in input().split()])
s = ['#'*(w+4)]*2 + ['#'*2 + eval(input()) + '#'*2 for _ in range(h)] + ['#'*(w+4)]*2
ans = [[-1]*(w+4) for _ in rang... | 49 | 43 | 1,574 | 1,319 | from collections import deque
def main():
h, w = list(map(int, input().split()))
start_h, start_w = [int(x) + 1 for x in input().split()]
goal_h, goal_w = [int(x) + 1 for x in input().split()]
s = ["#" * (w + 4)]
s.append("#" * (w + 4))
for _ in range(h):
s.append("##" + eval(input()) ... | from collections import deque
def main():
h, w = list(map(int, input().split()))
c = list([int(x) + 1 for x in input().split()])
d = list([int(x) + 1 for x in input().split()])
s = (
["#" * (w + 4)] * 2
+ ["#" * 2 + eval(input()) + "#" * 2 for _ in range(h)]
+ ["#" * (w + 4)] *... | false | 12.244898 | [
"- start_h, start_w = [int(x) + 1 for x in input().split()]",
"- goal_h, goal_w = [int(x) + 1 for x in input().split()]",
"- s = [\"#\" * (w + 4)]",
"- s.append(\"#\" * (w + 4))",
"- for _ in range(h):",
"- s.append(\"##\" + eval(input()) + \"##\")",
"- s.append(\"#\" * (w + 4))... | false | 0.033997 | 0.034951 | 0.972728 | [
"s614562886",
"s281623185"
] |
u892797057 | p02571 | python | s897299424 | s133660902 | 190 | 68 | 9,104 | 9,088 | Accepted | Accepted | 64.21 | S = eval(input())
T = eval(input())
min_count = len(T)
for s_i in range(len(S)):
i = s_i
matched = 0
for j in range(len(T)):
if len(S) <= i: # Out of S
matched = 0 # Cannot append characters to S
break
if S[i] == T[j]:
matched += 1
... | S = eval(input())
T = eval(input())
min_count = len(T)
for s in range(len(S) - len(T) + 1): # T cannot exceed the length of S
matched = 0
for i in range(len(T)):
# print(f'S[{s + i}] == T[{i}]')
if S[s + i] == T[i]:
matched += 1
count = len(T) - matched
if count ... | 18 | 14 | 416 | 365 | S = eval(input())
T = eval(input())
min_count = len(T)
for s_i in range(len(S)):
i = s_i
matched = 0
for j in range(len(T)):
if len(S) <= i: # Out of S
matched = 0 # Cannot append characters to S
break
if S[i] == T[j]:
matched += 1
i += 1
cou... | S = eval(input())
T = eval(input())
min_count = len(T)
for s in range(len(S) - len(T) + 1): # T cannot exceed the length of S
matched = 0
for i in range(len(T)):
# print(f'S[{s + i}] == T[{i}]')
if S[s + i] == T[i]:
matched += 1
count = len(T) - matched
if count < min_count:... | false | 22.222222 | [
"-for s_i in range(len(S)):",
"- i = s_i",
"+for s in range(len(S) - len(T) + 1): # T cannot exceed the length of S",
"- for j in range(len(T)):",
"- if len(S) <= i: # Out of S",
"- matched = 0 # Cannot append characters to S",
"- break",
"- if S[i] == T[j]... | false | 0.034672 | 0.072927 | 0.475432 | [
"s897299424",
"s133660902"
] |
u947883560 | p02644 | python | s267475989 | s782687711 | 341 | 306 | 163,756 | 156,184 | Accepted | Accepted | 10.26 | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
def ZIP(n): return [LIST() for _ in range(n)]
INF = float(... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
from collections import deque
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
def ZIP(n): return [LIST() for _... | 58 | 59 | 1,586 | 1,622 | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
def input():
return sys.stdin.readline().strip()
def INT():
return int(eval(input()))
def MAP():
return list(map(int, input().split()))
def LIST():
return list(map(int, input().split()))
def ZIP(n):
return [LIST() for _ in ran... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
from collections import deque
def input():
return sys.stdin.readline().strip()
def INT():
return int(eval(input()))
def MAP():
return list(map(int, input().split()))
def LIST():
return list(map(int, input().split()))
def ZIP(n):
... | false | 1.694915 | [
"+from collections import deque",
"- stack = [",
"- ((x1 * KETA + y1) << 2) + 0,",
"- ((x1 * KETA + y1) << 2) + 1,",
"- ((x1 * KETA + y1) << 2) + 2,",
"- ((x1 * KETA + y1) << 2) + 3,",
"- ]",
"+ stack = deque(",
"+ [",
"+ ((x1 * KETA + y1) << ... | false | 0.048289 | 0.048695 | 0.991676 | [
"s267475989",
"s782687711"
] |
u985929170 | p03478 | python | s424730056 | s375478967 | 44 | 37 | 9,216 | 8,996 | Accepted | Accepted | 15.91 | N,A,B = list(map(int,input().split()))
l = list(range(1,N+1))
su = 0
for i in l:
num_li = (list(str(i)))
num_li = list(map(int,num_li))
k = sum(num_li)
if A <= k <= B:su+=i
print(su) | n,a,b = list(map(int,input().split()))
ans = 0
for i in range(1,n+1):
l = sum(map(int,list(str(i))))
if a<=l<=b:
ans += i
print(ans) | 9 | 7 | 200 | 148 | N, A, B = list(map(int, input().split()))
l = list(range(1, N + 1))
su = 0
for i in l:
num_li = list(str(i))
num_li = list(map(int, num_li))
k = sum(num_li)
if A <= k <= B:
su += i
print(su)
| n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
l = sum(map(int, list(str(i))))
if a <= l <= b:
ans += i
print(ans)
| false | 22.222222 | [
"-N, A, B = list(map(int, input().split()))",
"-l = list(range(1, N + 1))",
"-su = 0",
"-for i in l:",
"- num_li = list(str(i))",
"- num_li = list(map(int, num_li))",
"- k = sum(num_li)",
"- if A <= k <= B:",
"- su += i",
"-print(su)",
"+n, a, b = list(map(int, input().split()... | false | 0.043703 | 0.109884 | 0.397719 | [
"s424730056",
"s375478967"
] |
u319589470 | p03854 | python | s251383896 | s837871476 | 73 | 19 | 3,316 | 3,188 | Accepted | Accepted | 73.97 | s_1 = eval(input())
s = s_1[::-1]
while len(s) >= 0:
if s[0:5] == "maerd":
s = s[5:len(s)]
continue
elif s[0:7] == "remaerd":
s = s[7:len(s)]
continue
elif s[0:5] == "esare":
s = s[5:len(s)]
continue
elif s[0:6] == "resare":
s = s[6:len(s)]
continue
elif s == "":... | s=input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if len(s)>0:
print("NO")
else:
print("YES") | 21 | 5 | 380 | 144 | s_1 = eval(input())
s = s_1[::-1]
while len(s) >= 0:
if s[0:5] == "maerd":
s = s[5 : len(s)]
continue
elif s[0:7] == "remaerd":
s = s[7 : len(s)]
continue
elif s[0:5] == "esare":
s = s[5 : len(s)]
continue
elif s[0:6] == "resare":
s = s[6 : len(s)]... | s = (
input()
.replace("eraser", "")
.replace("erase", "")
.replace("dreamer", "")
.replace("dream", "")
)
if len(s) > 0:
print("NO")
else:
print("YES")
| false | 76.190476 | [
"-s_1 = eval(input())",
"-s = s_1[::-1]",
"-while len(s) >= 0:",
"- if s[0:5] == \"maerd\":",
"- s = s[5 : len(s)]",
"- continue",
"- elif s[0:7] == \"remaerd\":",
"- s = s[7 : len(s)]",
"- continue",
"- elif s[0:5] == \"esare\":",
"- s = s[5 : len(s)]... | false | 0.034657 | 0.036419 | 0.951609 | [
"s251383896",
"s837871476"
] |
u569960318 | p02270 | python | s588474655 | s591049217 | 650 | 530 | 17,840 | 17,876 | Accepted | Accepted | 18.46 | def checkCapacity(W,k,P):
ws = 0
cnt = 1
for wi in W:
if wi > P: return False
ws += wi
if ws > P:
cnt += 1
ws = wi
if cnt > k: return False
return True
if __name__=='__main__':
n,k = list(map(int, input().split()))
W = list(m... | def checkCapacity(W,k,P):
ws = 0
cnt = 1
for wi in W:
ws += wi
if ws > P:
cnt += 1
ws = wi
if cnt > k: return False
return True
if __name__=='__main__':
n,k = list(map(int, input().split()))
W = list(map(int,[eval(input()) for _ in ra... | 24 | 23 | 559 | 531 | def checkCapacity(W, k, P):
ws = 0
cnt = 1
for wi in W:
if wi > P:
return False
ws += wi
if ws > P:
cnt += 1
ws = wi
if cnt > k:
return False
return True
if __name__ == "__main__":
n, k = list(map(int, input().split())... | def checkCapacity(W, k, P):
ws = 0
cnt = 1
for wi in W:
ws += wi
if ws > P:
cnt += 1
ws = wi
if cnt > k:
return False
return True
if __name__ == "__main__":
n, k = list(map(int, input().split()))
W = list(map(int, [eval(input()) for _... | false | 4.166667 | [
"- if wi > P:",
"- return False",
"- Pmin = 0",
"+ Pmin = max(W)"
] | false | 0.046366 | 0.045515 | 1.0187 | [
"s588474655",
"s591049217"
] |
u445404615 | p02577 | python | s465991218 | s281255579 | 728 | 68 | 10,620 | 9,256 | Accepted | Accepted | 90.66 | n=int(eval(input()))
l=list(str(n))
wrk=0
for i in l:
wrk+=int(i)
if wrk % 9 == 0:
print('Yes')
else:
print('No') | n=eval(input())
wrk=0
for i in n:
wrk+=int(i)
if wrk % 9 == 0:
print('Yes')
else:
print('No') | 11 | 10 | 131 | 110 | n = int(eval(input()))
l = list(str(n))
wrk = 0
for i in l:
wrk += int(i)
if wrk % 9 == 0:
print("Yes")
else:
print("No")
| n = eval(input())
wrk = 0
for i in n:
wrk += int(i)
if wrk % 9 == 0:
print("Yes")
else:
print("No")
| false | 9.090909 | [
"-n = int(eval(input()))",
"-l = list(str(n))",
"+n = eval(input())",
"-for i in l:",
"+for i in n:"
] | false | 0.067462 | 0.08651 | 0.779816 | [
"s465991218",
"s281255579"
] |
u893063840 | p02837 | python | s685874201 | s685304269 | 732 | 603 | 3,064 | 3,064 | Accepted | Accepted | 17.62 | from itertools import product
n = int(eval(input()))
a = []
xy = []
for _ in range(n):
a_tmp = int(eval(input()))
a.append(a_tmp)
xy_tmp = []
for _ in range(a_tmp):
xy_tmp.append(list(map(int, input().split())))
xy.append(xy_tmp)
ans = 0
for pat in product([1, 0], repeat=... | from itertools import product
n = int(eval(input()))
a = []
xy = []
for _ in range(n):
ea = int(eval(input()))
new = []
for _ in range(ea):
x, y = list(map(int, input().split()))
x -= 1
new.append([x, y])
xy.append(new)
ans = 0
for pat in product([1, 0], repe... | 30 | 29 | 582 | 531 | from itertools import product
n = int(eval(input()))
a = []
xy = []
for _ in range(n):
a_tmp = int(eval(input()))
a.append(a_tmp)
xy_tmp = []
for _ in range(a_tmp):
xy_tmp.append(list(map(int, input().split())))
xy.append(xy_tmp)
ans = 0
for pat in product([1, 0], repeat=n):
sat = True
... | from itertools import product
n = int(eval(input()))
a = []
xy = []
for _ in range(n):
ea = int(eval(input()))
new = []
for _ in range(ea):
x, y = list(map(int, input().split()))
x -= 1
new.append([x, y])
xy.append(new)
ans = 0
for pat in product([1, 0], repeat=n):
bl = True... | false | 3.333333 | [
"- a_tmp = int(eval(input()))",
"- a.append(a_tmp)",
"- xy_tmp = []",
"- for _ in range(a_tmp):",
"- xy_tmp.append(list(map(int, input().split())))",
"- xy.append(xy_tmp)",
"+ ea = int(eval(input()))",
"+ new = []",
"+ for _ in range(ea):",
"+ x, y = list(map(... | false | 0.040482 | 0.04825 | 0.839009 | [
"s685874201",
"s685304269"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.