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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u936985471 | p02866 | python | s451342852 | s632427352 | 342 | 163 | 18,936 | 20,576 | Accepted | Accepted | 52.34 | n=int(eval(input()))
d=list(map(int,input().split()))
maxd=max(d)
import collections
counter=collections.Counter(d)
if d[0]!=0 or counter[0]!=1:
print((0))
else:
a=1
ans=1
for i in range(1,maxd+1):
if i not in counter:
print((0))
break
else:
b=counter[i]
ans*=(a**... | n=int(eval(input()))
d=list(map(int,input().split()))
if d[0]!=0:
print((0))
exit(0)
m=max(d)
counts=[0]*(m+1)
import collections
counter=collections.Counter(d)
for key,val in list(counter.items()):
counts[key]=val
if counts[0]!=1:
print((0))
exit(0)
ans=1
div=998244353
for i in rang... | 20 | 25 | 359 | 388 | n = int(eval(input()))
d = list(map(int, input().split()))
maxd = max(d)
import collections
counter = collections.Counter(d)
if d[0] != 0 or counter[0] != 1:
print((0))
else:
a = 1
ans = 1
for i in range(1, maxd + 1):
if i not in counter:
print((0))
break
else:
... | n = int(eval(input()))
d = list(map(int, input().split()))
if d[0] != 0:
print((0))
exit(0)
m = max(d)
counts = [0] * (m + 1)
import collections
counter = collections.Counter(d)
for key, val in list(counter.items()):
counts[key] = val
if counts[0] != 1:
print((0))
exit(0)
ans = 1
div = 998244353
fo... | false | 20 | [
"-maxd = max(d)",
"+if d[0] != 0:",
"+ print((0))",
"+ exit(0)",
"+m = max(d)",
"+counts = [0] * (m + 1)",
"-if d[0] != 0 or counter[0] != 1:",
"+for key, val in list(counter.items()):",
"+ counts[key] = val",
"+if counts[0] != 1:",
"-else:",
"- a = 1",
"- ans = 1",
"- fo... | false | 0.044142 | 0.11312 | 0.390223 | [
"s451342852",
"s632427352"
] |
u744920373 | p03166 | python | s619194319 | s897437835 | 670 | 614 | 74,648 | 72,188 | Accepted | Accepted | 8.36 | import sys
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j... | import sys
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j... | 46 | 44 | 1,148 | 1,080 | import sys
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j):
return [... | import sys
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j):
return [... | false | 4.347826 | [
"-def dfs(x, ans):",
"+def dfs(x):",
"- if adj[x]:",
"- for a in adj[x]:",
"- dfs(a, ans)",
"- # global ans",
"+ for a in adj[x]:",
"+ dfs(a)",
"+ global ans",
"- dfs(i, ans)",
"+ dfs(i)",
"- if adj[a]:",
"- for... | false | 0.047606 | 0.041346 | 1.151395 | [
"s619194319",
"s897437835"
] |
u366959492 | p02868 | python | s458583352 | s017698210 | 1,548 | 1,226 | 134,232 | 135,388 | Accepted | Accepted | 20.8 | def func(x,y):
return min(x,y)
class SegmentTree:
def __init__(self, n): #a1, a2, ..., an
n_ = 1
while n_ < n:
n_ *= 2
self.n = n_
self.arr = [10**18] * (2*self.n-1)
def update(self, k, a): #0_indexed
k += self.n - 1
self.arr[k] = ... | def func(x,y):
return min(x,y)
class SegmentTree:
def __init__(self, n): #a1, a2, ..., an
n_ = 1
while n_ < n:
n_ *= 2
self.n = n_
self.arr = [10**18] * (2*self.n-1)
def update(self, k, a): #0_indexed
k += self.n - 1
self.arr[k] = ... | 67 | 68 | 1,467 | 1,503 | def func(x, y):
return min(x, y)
class SegmentTree:
def __init__(self, n): # a1, a2, ..., an
n_ = 1
while n_ < n:
n_ *= 2
self.n = n_
self.arr = [10**18] * (2 * self.n - 1)
def update(self, k, a): # 0_indexed
k += self.n - 1
self.arr[k] = a
... | def func(x, y):
return min(x, y)
class SegmentTree:
def __init__(self, n): # a1, a2, ..., an
n_ = 1
while n_ < n:
n_ *= 2
self.n = n_
self.arr = [10**18] * (2 * self.n - 1)
def update(self, k, a): # 0_indexed
k += self.n - 1
self.arr[k] = a
... | false | 1.470588 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.206663 | 0.069324 | 2.981132 | [
"s458583352",
"s017698210"
] |
u034128150 | p02913 | python | s241991053 | s752057945 | 158 | 116 | 76,504 | 75,988 | Accepted | Accepted | 26.58 | class RollingHash:
def __init__(self, string, root, mod):
self.root = root
self.mod = mod
self.hs = [0] * (len(string) + 1)
self.pw = [1] * (len(string) + 1)
for i in range(len(string)):
self.hs[i + 1] = (self.hs[i] * self.root + ord(string[i])) % self.mo... | class RollingHash:
def __init__(self, string, root, mod):
self.root = root
self.mod = mod
self.hs = [0] * (len(string) + 1)
self.pw = [1] * (len(string) + 1)
for i in range(len(string)):
self.hs[i + 1] = (self.hs[i] * self.root + ord(string[i])) % self.mo... | 86 | 85 | 2,459 | 2,426 | class RollingHash:
def __init__(self, string, root, mod):
self.root = root
self.mod = mod
self.hs = [0] * (len(string) + 1)
self.pw = [1] * (len(string) + 1)
for i in range(len(string)):
self.hs[i + 1] = (self.hs[i] * self.root + ord(string[i])) % self.mod
... | class RollingHash:
def __init__(self, string, root, mod):
self.root = root
self.mod = mod
self.hs = [0] * (len(string) + 1)
self.pw = [1] * (len(string) + 1)
for i in range(len(string)):
self.hs[i + 1] = (self.hs[i] * self.root + ord(string[i])) % self.mod
... | false | 1.162791 | [
"- assert 0 <= ret < RHMOD"
] | false | 0.102017 | 0.038928 | 2.620619 | [
"s241991053",
"s752057945"
] |
u332385682 | p03725 | python | s357838748 | s364581239 | 1,642 | 232 | 13,556 | 13,556 | Accepted | Accepted | 85.87 | import sys
from collections import deque
dx = (1, 0, -1, 0,)
dy = (0, 1, 0, -1,)
inf = 1<<60
def solve():
h, w, k = list(map(int, sys.stdin.readline().split()))
si = -1
sj = -1
a = [[False]*w for i in range(h)]
for i in range(h):
s = sys.stdin.readline().rstrip()
... | import sys
from collections import deque
dx = (1, 0, -1, 0,)
dy = (0, 1, 0, -1,)
inf = 1<<60
def solve():
h, w, k = list(map(int, sys.stdin.readline().split()))
si = -1
sj = -1
a = [[False]*w for i in range(h)]
for i in range(h):
s = sys.stdin.readline().rstrip()
... | 52 | 56 | 1,106 | 1,172 | import sys
from collections import deque
dx = (
1,
0,
-1,
0,
)
dy = (
0,
1,
0,
-1,
)
inf = 1 << 60
def solve():
h, w, k = list(map(int, sys.stdin.readline().split()))
si = -1
sj = -1
a = [[False] * w for i in range(h)]
for i in range(h):
s = sys.stdin.readl... | import sys
from collections import deque
dx = (
1,
0,
-1,
0,
)
dy = (
0,
1,
0,
-1,
)
inf = 1 << 60
def solve():
h, w, k = list(map(int, sys.stdin.readline().split()))
si = -1
sj = -1
a = [[False] * w for i in range(h)]
for i in range(h):
s = sys.stdin.readl... | false | 7.142857 | [
"+ if ans == 0:",
"+ print((1))",
"+ return"
] | false | 0.04564 | 0.089445 | 0.510258 | [
"s357838748",
"s364581239"
] |
u599547273 | p02918 | python | s784898684 | s129493417 | 139 | 35 | 10,728 | 4,852 | Accepted | Accepted | 74.82 | from itertools import groupby, accumulate
N, K = list(map(int, input().split()))
S = eval(input())
l = [len(list(g)) for k, g in groupby(S)]
# print(l)
m = min(len(l)//2, K)
# print(m)
a = [0]*(N+1)
x = 0
for l_i in l[:m]:
x += l_i
a[x] += 1
x = N
for l_i in l[-m:][::-1]:
x -= l_i
if ... | N, K = list(map(int, input().split()))
S = eval(input())
def g(t):
l = []
b = "x"
c = 0
for i, t_i in enumerate(t):
if b != t_i:
l.append(c)
c = 0
c += 1
b = t_i
l.append(c)
return l[1:]
l = g(S)
len_l = len(l)
score = sum(l)-le... | 41 | 23 | 780 | 391 | from itertools import groupby, accumulate
N, K = list(map(int, input().split()))
S = eval(input())
l = [len(list(g)) for k, g in groupby(S)]
# print(l)
m = min(len(l) // 2, K)
# print(m)
a = [0] * (N + 1)
x = 0
for l_i in l[:m]:
x += l_i
a[x] += 1
x = N
for l_i in l[-m:][::-1]:
x -= l_i
if a[x] == 0:
... | N, K = list(map(int, input().split()))
S = eval(input())
def g(t):
l = []
b = "x"
c = 0
for i, t_i in enumerate(t):
if b != t_i:
l.append(c)
c = 0
c += 1
b = t_i
l.append(c)
return l[1:]
l = g(S)
len_l = len(l)
score = sum(l) - len_l
score += m... | false | 43.902439 | [
"-from itertools import groupby, accumulate",
"-",
"-l = [len(list(g)) for k, g in groupby(S)]",
"-# print(l)",
"-m = min(len(l) // 2, K)",
"-# print(m)",
"-a = [0] * (N + 1)",
"-x = 0",
"-for l_i in l[:m]:",
"- x += l_i",
"- a[x] += 1",
"-x = N",
"-for l_i in l[-m:][::-1]:",
"- x... | false | 0.040518 | 0.040665 | 0.996371 | [
"s784898684",
"s129493417"
] |
u691018832 | p02642 | python | s696366830 | s242096138 | 1,989 | 270 | 50,884 | 27,772 | Accepted | Accepted | 86.43 | def main():
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from collections import Counter
n = int(readline())
a = list(map(int, readline().split()))
memo = [True] * (10 *... | def main():
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n = int(readline())
a = list(map(int, readline().split()))
a.sort()
limit = a[-1]
dp = [0] * (limit + 1)
... | 26 | 22 | 661 | 552 | def main():
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
from collections import Counter
n = int(readline())
a = list(map(int, readline().split()))
memo = [True] * (10**6 + 1)
an... | def main():
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
n = int(readline())
a = list(map(int, readline().split()))
a.sort()
limit = a[-1]
dp = [0] * (limit + 1)
for aa in a:
... | false | 15.384615 | [
"- from collections import Counter",
"-",
"- memo = [True] * (10**6 + 1)",
"- ans = 0",
"- for k, v in sorted(Counter(a).items()):",
"- if v == 1 and memo[k]:",
"- ans += 1",
"- memo[k] = False",
"- for i in range(1, 10**6 + 1):",
"- if 10**6 ... | false | 0.729469 | 0.037538 | 19.433062 | [
"s696366830",
"s242096138"
] |
u929569377 | p02844 | python | s446213943 | s443679484 | 699 | 142 | 42,860 | 4,496 | Accepted | Accepted | 79.69 | n = int(eval(input()))
s = list(map(int, list(eval(input()))))
ans = 0
for i in range(1000):
c = 0
for j in s:
if i % 10 == j:
if c == 2:
ans += 1
break
c += 1
i //= 10
print(ans) | n = int(eval(input()))
s = list(map(int, list(eval(input()))))
idx = [[] for _ in range(10)]
for i, v in enumerate(s):
idx[v].append(i)
ans = 0
for i in range(1000):
c = 0
p = -1
chk = True
while c < 3 and chk:
chk = False
for j in idx[i // 100]:
if j > p:
... | 13 | 23 | 263 | 485 | n = int(eval(input()))
s = list(map(int, list(eval(input()))))
ans = 0
for i in range(1000):
c = 0
for j in s:
if i % 10 == j:
if c == 2:
ans += 1
break
c += 1
i //= 10
print(ans)
| n = int(eval(input()))
s = list(map(int, list(eval(input()))))
idx = [[] for _ in range(10)]
for i, v in enumerate(s):
idx[v].append(i)
ans = 0
for i in range(1000):
c = 0
p = -1
chk = True
while c < 3 and chk:
chk = False
for j in idx[i // 100]:
if j > p:
... | false | 43.478261 | [
"+idx = [[] for _ in range(10)]",
"+for i, v in enumerate(s):",
"+ idx[v].append(i)",
"- for j in s:",
"- if i % 10 == j:",
"- if c == 2:",
"- ans += 1",
"+ p = -1",
"+ chk = True",
"+ while c < 3 and chk:",
"+ chk = False",
"+ for ... | false | 0.035901 | 0.057803 | 0.621085 | [
"s446213943",
"s443679484"
] |
u641446860 | p02779 | python | s818837538 | s997996883 | 111 | 93 | 32,844 | 26,808 | Accepted | Accepted | 16.22 | N = eval(input())
A = list(map(int, input().split()))
ans = {}
b = True
for i in A:
if i in ans:
b = False
break
else:
ans[i] = 0
if b:
print("YES")
else:
print("NO")
| N = eval(input())
A = list(map(int, input().split()))
if len(A) == len(set(A)):
print("YES")
else:
print("NO")
| 16 | 8 | 206 | 126 | N = eval(input())
A = list(map(int, input().split()))
ans = {}
b = True
for i in A:
if i in ans:
b = False
break
else:
ans[i] = 0
if b:
print("YES")
else:
print("NO")
| N = eval(input())
A = list(map(int, input().split()))
if len(A) == len(set(A)):
print("YES")
else:
print("NO")
| false | 50 | [
"-ans = {}",
"-b = True",
"-for i in A:",
"- if i in ans:",
"- b = False",
"- break",
"- else:",
"- ans[i] = 0",
"-if b:",
"+if len(A) == len(set(A)):"
] | false | 0.048825 | 0.007464 | 6.54114 | [
"s818837538",
"s997996883"
] |
u200228637 | p02639 | python | s409187319 | s792583996 | 27 | 24 | 9,156 | 8,968 | Accepted | Accepted | 11.11 | s = list(map(int, input().split()))
b = s.index(0)
print((b + 1)) | n = list(map(int, input().split()))
s = n.index(0)
print((s + 1)) | 4 | 3 | 67 | 65 | s = list(map(int, input().split()))
b = s.index(0)
print((b + 1))
| n = list(map(int, input().split()))
s = n.index(0)
print((s + 1))
| false | 25 | [
"-s = list(map(int, input().split()))",
"-b = s.index(0)",
"-print((b + 1))",
"+n = list(map(int, input().split()))",
"+s = n.index(0)",
"+print((s + 1))"
] | false | 0.045397 | 0.118455 | 0.383242 | [
"s409187319",
"s792583996"
] |
u426534722 | p02396 | python | s864766900 | s755698124 | 160 | 130 | 7,528 | 5,576 | Accepted | Accepted | 18.75 | cnt = 1
while(True):
x = int(input())
if x == 0: break
print("Case", cnt, end="")
print(":", x)
cnt += 1
| for i in range(1, 10001):
x = eval(input())
if x == "0":
break
print(f"Case {i}: {x}")
| 7 | 5 | 130 | 105 | cnt = 1
while True:
x = int(input())
if x == 0:
break
print("Case", cnt, end="")
print(":", x)
cnt += 1
| for i in range(1, 10001):
x = eval(input())
if x == "0":
break
print(f"Case {i}: {x}")
| false | 28.571429 | [
"-cnt = 1",
"-while True:",
"- x = int(input())",
"- if x == 0:",
"+for i in range(1, 10001):",
"+ x = eval(input())",
"+ if x == \"0\":",
"- print(\"Case\", cnt, end=\"\")",
"- print(\":\", x)",
"- cnt += 1",
"+ print(f\"Case {i}: {x}\")"
] | false | 0.094898 | 0.040004 | 2.372245 | [
"s864766900",
"s755698124"
] |
u525065967 | p02574 | python | s974132492 | s721575813 | 558 | 392 | 127,280 | 127,428 | Accepted | Accepted | 29.75 | def gcd_all(a):
from math import gcd
g = 0
for x in a: g = gcd(g, x)
return g
def is_pairwise():
MAX_A = 10**6 + 1
C = [0] * MAX_A
for a in A: C[a] += 1
for i in range(2, MAX_A):
if sum(C[i::i]) > 1: return False
return True
def solve():
if is_pairwise():... | def gcd_all(a):
from math import gcd
g = 0
for x in a: g = gcd(g, x)
return g
def is_pairwise():
MAX_A = 10**6 + 1
C = [0] * MAX_A
for a in A: C[a] += 1
if sum(C[2::2]) > 1: return False
for i in range(3, MAX_A, 2):
if sum(C[i::i]) > 1: return False
return T... | 22 | 23 | 480 | 522 | def gcd_all(a):
from math import gcd
g = 0
for x in a:
g = gcd(g, x)
return g
def is_pairwise():
MAX_A = 10**6 + 1
C = [0] * MAX_A
for a in A:
C[a] += 1
for i in range(2, MAX_A):
if sum(C[i::i]) > 1:
return False
return True
def solve():
i... | def gcd_all(a):
from math import gcd
g = 0
for x in a:
g = gcd(g, x)
return g
def is_pairwise():
MAX_A = 10**6 + 1
C = [0] * MAX_A
for a in A:
C[a] += 1
if sum(C[2::2]) > 1:
return False
for i in range(3, MAX_A, 2):
if sum(C[i::i]) > 1:
... | false | 4.347826 | [
"- for i in range(2, MAX_A):",
"+ if sum(C[2::2]) > 1:",
"+ return False",
"+ for i in range(3, MAX_A, 2):"
] | false | 0.381731 | 0.287715 | 1.326767 | [
"s974132492",
"s721575813"
] |
u729133443 | p03987 | python | s647518270 | s545888976 | 205 | 177 | 34,512 | 33,392 | Accepted | Accepted | 13.66 | code = r"""
# distutils: language=c++
from libcpp.set cimport set
from libcpp.vector cimport vector
from libcpp.iterator cimport iterator
from cython.operator cimport dereference as deref, predecrement as dec
cdef int n = int(input()), i
cdef long c
cdef iterator it, jt
cdef vector[long] a = [*map(int, input()... | code = r"""
# distutils: language=c++
from libcpp.set cimport set
from libcpp.vector cimport vector
from cython.operator cimport dereference as deref, predecrement as dec
cdef int n = int(input()), i
cdef long c
cdef vector[long] a = [*map(int, input().split())]
cdef vector[long] l = [0] * n
for i in range(n):... | 23 | 23 | 743 | 706 | code = r"""
# distutils: language=c++
from libcpp.set cimport set
from libcpp.vector cimport vector
from libcpp.iterator cimport iterator
from cython.operator cimport dereference as deref, predecrement as dec
cdef int n = int(input()), i
cdef long c
cdef iterator it, jt
cdef vector[long] a = [*map(int, input().split())... | code = r"""
# distutils: language=c++
from libcpp.set cimport set
from libcpp.vector cimport vector
from cython.operator cimport dereference as deref, predecrement as dec
cdef int n = int(input()), i
cdef long c
cdef vector[long] a = [*map(int, input().split())]
cdef vector[long] l = [0] * n
for i in range(n): l[a[i] -... | false | 0 | [
"-from libcpp.iterator cimport iterator",
"-cdef iterator it, jt",
"+cdef set[long].iterator it",
"- c += (deref(s.lower_bound(l[i])) - l[i]) * (l[i] - deref(dec(s.lower_bound(l[i])))) * (i + 1)",
"+ it = s.lower_bound(l[i])",
"+ c += (deref(it) - l[i]) * (l[i] - deref(dec(it))) * (i + 1)"
] | false | 0.037393 | 0.03811 | 0.981209 | [
"s647518270",
"s545888976"
] |
u318127926 | p03546 | python | s614717446 | s670555801 | 349 | 189 | 42,332 | 40,300 | Accepted | Accepted | 45.85 | from itertools import permutations
h, w = list(map(int, input().split()))
c = []
for _ in range(10):
c.append(list(map(int, input().split())))
a = [0]*10
for _ in range(h):
for i in map(int, input().split()):
if i<0:
continue
a[i] += 1
ans = 0
for i in range(10):
... | from itertools import permutations
h, w = list(map(int, input().split()))
c = []
for _ in range(10):
c.append(list(map(int, input().split())))
a = [0]*10
for _ in range(h):
for i in map(int, input().split()):
if i<0:
continue
a[i] += 1
INF = 10**10
q = list(range(10))
di... | 29 | 31 | 732 | 680 | from itertools import permutations
h, w = list(map(int, input().split()))
c = []
for _ in range(10):
c.append(list(map(int, input().split())))
a = [0] * 10
for _ in range(h):
for i in map(int, input().split()):
if i < 0:
continue
a[i] += 1
ans = 0
for i in range(10):
if i == 1 o... | from itertools import permutations
h, w = list(map(int, input().split()))
c = []
for _ in range(10):
c.append(list(map(int, input().split())))
a = [0] * 10
for _ in range(h):
for i in map(int, input().split()):
if i < 0:
continue
a[i] += 1
INF = 10**10
q = list(range(10))
dist = [IN... | false | 6.451613 | [
"+INF = 10**10",
"+q = list(range(10))",
"+dist = [INF] * 10",
"+dist[1] = 0",
"+while q:",
"+ mi = INF",
"+ for i in q:",
"+ if dist[i] < mi:",
"+ mi = dist[i]",
"+ mi_ind = i",
"+ node = mi_ind",
"+ q.remove(mi_ind)",
"+ for i in range(10):",
"... | false | 0.324707 | 0.036807 | 8.821851 | [
"s614717446",
"s670555801"
] |
u724687935 | p02774 | python | s475049721 | s798171929 | 665 | 568 | 84,996 | 87,000 | Accepted | Accepted | 14.59 | N, K = list(map(int, input().split()))
plus = []
minus = []
zero = 0
for i in map(int, input().split()):
if i > 0:
plus.append(i)
elif i < 0:
minus.append(i)
else:
zero += 1
plus.sort()
minus.sort(reverse=True)
# [ok, ng) - Maximum
# (ng, ok] - Minimum
# ok が 最終的な答... | N, K = list(map(int, input().split()))
plus = []
minus = []
zero = 0
for i in map(int, input().split()):
if i > 0:
plus.append(i)
elif i < 0:
minus.append(i)
else:
zero += 1
plus.sort()
minus.sort(reverse=True)
def solve(mid):
global N, K, zero
cnt = 0
... | 46 | 50 | 1,082 | 1,147 | N, K = list(map(int, input().split()))
plus = []
minus = []
zero = 0
for i in map(int, input().split()):
if i > 0:
plus.append(i)
elif i < 0:
minus.append(i)
else:
zero += 1
plus.sort()
minus.sort(reverse=True)
# [ok, ng) - Maximum
# (ng, ok] - Minimum
# ok が 最終的な答え
ok, ng = -(10**19... | N, K = list(map(int, input().split()))
plus = []
minus = []
zero = 0
for i in map(int, input().split()):
if i > 0:
plus.append(i)
elif i < 0:
minus.append(i)
else:
zero += 1
plus.sort()
minus.sort(reverse=True)
def solve(mid):
global N, K, zero
cnt = 0
if mid >= 0:
... | false | 8 | [
"-# [ok, ng) - Maximum",
"-# (ng, ok] - Minimum",
"-# ok が 最終的な答え",
"-ok, ng = -(10**19), 10**19",
"-while abs(ok - ng) > 1:",
"- mid = (ok + ng) // 2",
"+",
"+",
"+def solve(mid):",
"+ global N, K, zero",
"- for a in (plus, minus):",
"- l, r = 0, len(a) - 1",
... | false | 0.042642 | 0.076022 | 0.560922 | [
"s475049721",
"s798171929"
] |
u991567869 | p03325 | python | s107744695 | s322500636 | 108 | 80 | 4,148 | 4,148 | Accepted | Accepted | 25.93 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i in range(n):
while True:
if a[i]%2 == 0:
a[i] = a[i]//2
cnt += 1
else:
break
print(cnt) | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i in a:
while True:
if i%2 == 0:
i = i//2
cnt += 1
else:
break
print(cnt) | 12 | 12 | 222 | 206 | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i in range(n):
while True:
if a[i] % 2 == 0:
a[i] = a[i] // 2
cnt += 1
else:
break
print(cnt)
| n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
for i in a:
while True:
if i % 2 == 0:
i = i // 2
cnt += 1
else:
break
print(cnt)
| false | 0 | [
"-for i in range(n):",
"+for i in a:",
"- if a[i] % 2 == 0:",
"- a[i] = a[i] // 2",
"+ if i % 2 == 0:",
"+ i = i // 2"
] | false | 0.100018 | 0.088592 | 1.128977 | [
"s107744695",
"s322500636"
] |
u561231954 | p02721 | python | s498933136 | s126175535 | 323 | 200 | 36,472 | 31,720 | Accepted | Accepted | 38.08 | MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
def main():
n,k,c = list(map(int,input().split()))
s = eval(input())
cuml = [0] * (n + 1)
cumr = [0] * (n + 1)
idx = []
for i in range(n):
if s[i] == 'o':
... | MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
def main():
n,k,c = map(int,input().split())
s = input()
R = [-1] * k
L = [-1] * k
day = INF
cnt = 0
for i in range(n):
if s[i] == 'o':
if day >... | 52 | 52 | 1,196 | 1,057 | MOD = 10**9 + 7
INF = 10**10
import sys
sys.setrecursionlimit(100000000)
dy = (-1, 0, 1, 0)
dx = (0, 1, 0, -1)
def main():
n, k, c = list(map(int, input().split()))
s = eval(input())
cuml = [0] * (n + 1)
cumr = [0] * (n + 1)
idx = []
for i in range(n):
if s[i] == "o":
idx.... | MOD = 10**9 + 7
INF = 10**10
import sys
sys.setrecursionlimit(100000000)
dy = (-1, 0, 1, 0)
dx = (0, 1, 0, -1)
def main():
n, k, c = map(int, input().split())
s = input()
R = [-1] * k
L = [-1] * k
day = INF
cnt = 0
for i in range(n):
if s[i] == "o":
if day > c:
... | false | 0 | [
"- n, k, c = list(map(int, input().split()))",
"- s = eval(input())",
"- cuml = [0] * (n + 1)",
"- cumr = [0] * (n + 1)",
"- idx = []",
"+ n, k, c = map(int, input().split())",
"+ s = input()",
"+ R = [-1] * k",
"+ L = [-1] * k",
"+ day = INF",
"+ cnt = 0",
"- ... | false | 0.08639 | 0.047242 | 1.828662 | [
"s498933136",
"s126175535"
] |
u598229387 | p03607 | python | s711511026 | s451579235 | 206 | 87 | 16,636 | 16,640 | Accepted | Accepted | 57.77 | from collections import Counter
n=int(eval(input()))
a=[int(eval(input())) for i in range(n)]
count = Counter(a)
ans=0
for i in list(count.values()):
ans+=i%2
print(ans) | import sys
input = sys.stdin.readline
from collections import Counter
n=int(eval(input()))
a=[int(eval(input())) for i in range(n)]
count = Counter(a)
ans=0
for i in list(count.values()):
ans+=i%2
print(ans) | 9 | 11 | 164 | 204 | from collections import Counter
n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
count = Counter(a)
ans = 0
for i in list(count.values()):
ans += i % 2
print(ans)
| import sys
input = sys.stdin.readline
from collections import Counter
n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
count = Counter(a)
ans = 0
for i in list(count.values()):
ans += i % 2
print(ans)
| false | 18.181818 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.047502 | 0.04763 | 0.997303 | [
"s711511026",
"s451579235"
] |
u707124227 | p02709 | python | s527453217 | s983076722 | 1,451 | 1,270 | 315,816 | 50,176 | Accepted | Accepted | 12.47 | from collections import defaultdict
n=int(eval(input()))
a_=list(map(int,input().split()))
a=[]
for i,ai in enumerate(a_):
a.append([1+i,ai])
a.sort(key=lambda x:x[1],reverse=True)
dp=defaultdict(lambda:0)
dp[(0,1)]=max(a[0][1]*(n-a[0][0]),0)
dp[(1,0)]=max(a[0][1]*(a[0][0]-1),0)
for i in range(2,n+1):#i... | from collections import defaultdict
n=int(eval(input()))
a_=list(map(int,input().split()))
import numpy as np
a=[]
for i,ai in enumerate(a_):
a.append([1+i,ai])
a.sort(key=lambda x:x[1],reverse=True)
dp=np.zeros((n+1,n+1),np.int64) #dp[i,j]:i人目までを配置し終えていて、そのうちj人を右に置いた時の最大値。j<=i
dp[1,1]=a[0][1]*(n-a[0][0]... | 23 | 20 | 772 | 825 | from collections import defaultdict
n = int(eval(input()))
a_ = list(map(int, input().split()))
a = []
for i, ai in enumerate(a_):
a.append([1 + i, ai])
a.sort(key=lambda x: x[1], reverse=True)
dp = defaultdict(lambda: 0)
dp[(0, 1)] = max(a[0][1] * (n - a[0][0]), 0)
dp[(1, 0)] = max(a[0][1] * (a[0][0] - 1), 0)
for... | from collections import defaultdict
n = int(eval(input()))
a_ = list(map(int, input().split()))
import numpy as np
a = []
for i, ai in enumerate(a_):
a.append([1 + i, ai])
a.sort(key=lambda x: x[1], reverse=True)
dp = np.zeros((n + 1, n + 1), np.int64) # dp[i,j]:i人目までを配置し終えていて、そのうちj人を右に置いた時の最大値。j<=i
dp[1, 1] = a... | false | 13.043478 | [
"+import numpy as np",
"+",
"-dp = defaultdict(lambda: 0)",
"-dp[(0, 1)] = max(a[0][1] * (n - a[0][0]), 0)",
"-dp[(1, 0)] = max(a[0][1] * (a[0][0] - 1), 0)",
"+dp = np.zeros((n + 1, n + 1), np.int64) # dp[i,j]:i人目までを配置し終えていて、そのうちj人を右に置いた時の最大値。j<=i",
"+dp[1, 1] = a[0][1] * (n - a[0][0])",
"+dp[1, 0] =... | false | 0.045934 | 0.669527 | 0.068607 | [
"s527453217",
"s983076722"
] |
u757117214 | p02613 | python | s871233105 | s831309252 | 143 | 52 | 9,120 | 17,236 | Accepted | Accepted | 63.64 | dic = {'AC':0,'WA':0,'TLE':0,'RE':0}
for i in range(int(eval(input()))):
dic[eval(input())] += 1
print(f"AC x {dic['AC']}")
print(f"WA x {dic['WA']}")
print(f"TLE x {dic['TLE']}")
print(f"RE x {dic['RE']}")
| from collections import Counter
n,*lst = open(0).read().split()
c = Counter(lst)
for s in ['AC','WA','TLE','RE']:
print(f"{s} x {c[s]}") | 7 | 5 | 205 | 144 | dic = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}
for i in range(int(eval(input()))):
dic[eval(input())] += 1
print(f"AC x {dic['AC']}")
print(f"WA x {dic['WA']}")
print(f"TLE x {dic['TLE']}")
print(f"RE x {dic['RE']}")
| from collections import Counter
n, *lst = open(0).read().split()
c = Counter(lst)
for s in ["AC", "WA", "TLE", "RE"]:
print(f"{s} x {c[s]}")
| false | 28.571429 | [
"-dic = {\"AC\": 0, \"WA\": 0, \"TLE\": 0, \"RE\": 0}",
"-for i in range(int(eval(input()))):",
"- dic[eval(input())] += 1",
"-print(f\"AC x {dic['AC']}\")",
"-print(f\"WA x {dic['WA']}\")",
"-print(f\"TLE x {dic['TLE']}\")",
"-print(f\"RE x {dic['RE']}\")",
"+from collections import Counter",
"+... | false | 0.040973 | 0.056865 | 0.720532 | [
"s871233105",
"s831309252"
] |
u353797797 | p03061 | python | s618046434 | s325405846 | 351 | 146 | 111,964 | 14,488 | Accepted | Accepted | 58.4 | import sys
sys.setrecursionlimit(10**6)
def Lgcd(i):
if i == 0:
return 0
if i == 1:
return a_s[0]
if i in Lmemo:
return Lmemo[i]
re = gcd(Lgcd(i - 1), a_s[i - 1])
Lmemo[i] = re
return re
def Rgcd(i):
if i == n - 1:
return 0
if i == n -... | import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def gcd(a,b):
whil... | 46 | 32 | 795 | 736 | import sys
sys.setrecursionlimit(10**6)
def Lgcd(i):
if i == 0:
return 0
if i == 1:
return a_s[0]
if i in Lmemo:
return Lmemo[i]
re = gcd(Lgcd(i - 1), a_s[i - 1])
Lmemo[i] = re
return re
def Rgcd(i):
if i == n - 1:
return 0
if i == n - 2:
retu... | import sys
sys.setrecursionlimit(10**6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number):
return [LI() for _ in range(rows_number)]
def gcd(a, b)... | false | 30.434783 | [
"+int1 = lambda x: int(x) - 1",
"+p2D = lambda x: print(*x, sep=\"\\n\")",
"-def Lgcd(i):",
"- if i == 0:",
"- return 0",
"- if i == 1:",
"- return a_s[0]",
"- if i in Lmemo:",
"- return Lmemo[i]",
"- re = gcd(Lgcd(i - 1), a_s[i - 1])",
"- Lmemo[i] = re",
"-... | false | 0.031898 | 0.035336 | 0.902687 | [
"s618046434",
"s325405846"
] |
u374802266 | p03043 | python | s668802825 | s021990501 | 99 | 42 | 2,940 | 9,408 | Accepted | Accepted | 57.58 | import math
n,k=list(map(int,input().split()))
a=0
k=math.log2(k)
for i in range(n):
a+=2**-max(math.ceil(k-math.log2(i+1)),0)/n
print(a) | n,k=list(map(int,input().split()))
a=0
for i in range(1,n+1):
j=0
while i<k:
i*=2
j+=1
a+=0.5**j
print((a/n)) | 7 | 9 | 141 | 137 | import math
n, k = list(map(int, input().split()))
a = 0
k = math.log2(k)
for i in range(n):
a += 2 ** -max(math.ceil(k - math.log2(i + 1)), 0) / n
print(a)
| n, k = list(map(int, input().split()))
a = 0
for i in range(1, n + 1):
j = 0
while i < k:
i *= 2
j += 1
a += 0.5**j
print((a / n))
| false | 22.222222 | [
"-import math",
"-",
"-k = math.log2(k)",
"-for i in range(n):",
"- a += 2 ** -max(math.ceil(k - math.log2(i + 1)), 0) / n",
"-print(a)",
"+for i in range(1, n + 1):",
"+ j = 0",
"+ while i < k:",
"+ i *= 2",
"+ j += 1",
"+ a += 0.5**j",
"+print((a / n))"
] | false | 0.086596 | 0.058856 | 1.471331 | [
"s668802825",
"s021990501"
] |
u077291787 | p03608 | python | s326218523 | s623562275 | 480 | 207 | 18,872 | 9,812 | Accepted | Accepted | 56.88 | # ABC073D - joisino's travel
from itertools import permutations
from scipy.sparse.csgraph import dijkstra
def main():
N, M, R, *RABC = list(map(int, open(0).read().split()))
visit, ABC = RABC[:R], RABC[R:]
G = [[float("inf")] * (N + 1) for _ in range(N + 1)]
for v, u, c in zip(*[iter(ABC)] * ... | # ABC073D - joisino's travel (218ms)
from collections import defaultdict
from heapq import heapify, heappop, heappush
from itertools import permutations
def dijkstra(G: "Array[dict[int]]", size: int, start: int) -> list:
dist = [float("inf")] * size
unchecked = size - 1 # vertex_0 won't appear in 1-i... | 21 | 42 | 621 | 1,260 | # ABC073D - joisino's travel
from itertools import permutations
from scipy.sparse.csgraph import dijkstra
def main():
N, M, R, *RABC = list(map(int, open(0).read().split()))
visit, ABC = RABC[:R], RABC[R:]
G = [[float("inf")] * (N + 1) for _ in range(N + 1)]
for v, u, c in zip(*[iter(ABC)] * 3):
... | # ABC073D - joisino's travel (218ms)
from collections import defaultdict
from heapq import heapify, heappop, heappush
from itertools import permutations
def dijkstra(G: "Array[dict[int]]", size: int, start: int) -> list:
dist = [float("inf")] * size
unchecked = size - 1 # vertex_0 won't appear in 1-idx graph... | false | 50 | [
"-# ABC073D - joisino's travel",
"+# ABC073D - joisino's travel (218ms)",
"+from collections import defaultdict",
"+from heapq import heapify, heappop, heappush",
"-from scipy.sparse.csgraph import dijkstra",
"+",
"+",
"+def dijkstra(G: \"Array[dict[int]]\", size: int, start: int) -> list:",
"+ d... | false | 0.473062 | 0.037719 | 12.541678 | [
"s326218523",
"s623562275"
] |
u576432509 | p02881 | python | s659065850 | s767577269 | 166 | 145 | 2,940 | 3,060 | Accepted | Accepted | 12.65 | n=int(eval(input()))
n2=int(n**0.5)
for n3 in range(n2,0,-1):
if n%n3==0:
n4=n/n3
n5=int((n3-1)+(n4-1))
print(n5)
break | n=int(eval(input()))
n2=int(n**0.5)
abmin=n
for i in range(1,n2+1):
if n%i==0:
ab=n//i+i-2
abmin=min(ab,abmin)
print(abmin) | 8 | 10 | 156 | 156 | n = int(eval(input()))
n2 = int(n**0.5)
for n3 in range(n2, 0, -1):
if n % n3 == 0:
n4 = n / n3
n5 = int((n3 - 1) + (n4 - 1))
print(n5)
break
| n = int(eval(input()))
n2 = int(n**0.5)
abmin = n
for i in range(1, n2 + 1):
if n % i == 0:
ab = n // i + i - 2
abmin = min(ab, abmin)
print(abmin)
| false | 20 | [
"-for n3 in range(n2, 0, -1):",
"- if n % n3 == 0:",
"- n4 = n / n3",
"- n5 = int((n3 - 1) + (n4 - 1))",
"- print(n5)",
"- break",
"+abmin = n",
"+for i in range(1, n2 + 1):",
"+ if n % i == 0:",
"+ ab = n // i + i - 2",
"+ abmin = min(ab, abmin)",... | false | 0.045782 | 0.045995 | 0.995379 | [
"s659065850",
"s767577269"
] |
u537976628 | p03457 | python | s841897275 | s836826891 | 377 | 235 | 27,300 | 9,108 | Accepted | Accepted | 37.67 | N = int(eval(input()))
tm_pos = [list(map(int, input().split())) for i in range(N)]
for i in tm_pos:
if i[0] < i[1] + i[2] or i[0] % 2 != (i[1] + i[2]) % 2:
print('No')
exit()
print('Yes') | N = int(eval(input()))
count = 0
T, X, Y = 0, 0, 0
for i in range(N):
t, x, y = list(map(int, input().split()))
if abs(x-X)+abs(y-Y) <= t-T and t % 2 == (x+y) % 2:
count += 1
T, X, Y = t, x, y
print(("Yes" if count == N else "No")) | 7 | 9 | 208 | 249 | N = int(eval(input()))
tm_pos = [list(map(int, input().split())) for i in range(N)]
for i in tm_pos:
if i[0] < i[1] + i[2] or i[0] % 2 != (i[1] + i[2]) % 2:
print("No")
exit()
print("Yes")
| N = int(eval(input()))
count = 0
T, X, Y = 0, 0, 0
for i in range(N):
t, x, y = list(map(int, input().split()))
if abs(x - X) + abs(y - Y) <= t - T and t % 2 == (x + y) % 2:
count += 1
T, X, Y = t, x, y
print(("Yes" if count == N else "No"))
| false | 22.222222 | [
"-tm_pos = [list(map(int, input().split())) for i in range(N)]",
"-for i in tm_pos:",
"- if i[0] < i[1] + i[2] or i[0] % 2 != (i[1] + i[2]) % 2:",
"- print(\"No\")",
"- exit()",
"-print(\"Yes\")",
"+count = 0",
"+T, X, Y = 0, 0, 0",
"+for i in range(N):",
"+ t, x, y = list(map(... | false | 0.092904 | 0.03735 | 2.487387 | [
"s841897275",
"s836826891"
] |
u160244242 | p03241 | python | s155549411 | s265747725 | 1,787 | 22 | 3,064 | 3,064 | Accepted | Accepted | 98.77 | def f():
n, m = list(map(int, input().split()))
for i in range(m//n+1)[::-1]:
if m%i==0:return i
print((f())) | import math
n,m = list(map(int, input().split()))
ans = 0
for i in range(1, math.ceil(math.sqrt(m))+1):
if m % i == 0:
if min(i, m//i) >= n:
ans = max(ans, max(i, m//i))
elif max(i, m//i) >= n:
ans = max(ans, min(i, m//i))
print(ans) | 5 | 13 | 113 | 286 | def f():
n, m = list(map(int, input().split()))
for i in range(m // n + 1)[::-1]:
if m % i == 0:
return i
print((f()))
| import math
n, m = list(map(int, input().split()))
ans = 0
for i in range(1, math.ceil(math.sqrt(m)) + 1):
if m % i == 0:
if min(i, m // i) >= n:
ans = max(ans, max(i, m // i))
elif max(i, m // i) >= n:
ans = max(ans, min(i, m // i))
print(ans)
| false | 61.538462 | [
"-def f():",
"- n, m = list(map(int, input().split()))",
"- for i in range(m // n + 1)[::-1]:",
"- if m % i == 0:",
"- return i",
"+import math",
"-",
"-print((f()))",
"+n, m = list(map(int, input().split()))",
"+ans = 0",
"+for i in range(1, math.ceil(math.sqrt(m)) + 1):... | false | 0.065725 | 0.054591 | 1.203949 | [
"s155549411",
"s265747725"
] |
u759412327 | p03260 | python | s257218243 | s341783554 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | a = list(map(int,input().split()))
if a[0]*a[1]%2==0:
print("No")
else:
print("Yes") | A,B = list(map(int,input().split()))
if A*B%2==0:
print("No")
else:
print("Yes") | 6 | 6 | 94 | 90 | a = list(map(int, input().split()))
if a[0] * a[1] % 2 == 0:
print("No")
else:
print("Yes")
| A, B = list(map(int, input().split()))
if A * B % 2 == 0:
print("No")
else:
print("Yes")
| false | 0 | [
"-a = list(map(int, input().split()))",
"-if a[0] * a[1] % 2 == 0:",
"+A, B = list(map(int, input().split()))",
"+if A * B % 2 == 0:"
] | false | 0.042285 | 0.039429 | 1.072426 | [
"s257218243",
"s341783554"
] |
u426534722 | p02276 | python | s391227273 | s566449118 | 110 | 80 | 18,396 | 16,396 | Accepted | Accepted | 27.27 | def partition(p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
n = int(eval(input()))
A = [int(i) for i in input().split()]
q = partition(0, n - 1)
A[q] = "[%d]"%A[q]
... | def partition(A, p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
n = int(eval(input()))
A = list(map(int, input().split()))
p = partition(A, 0, n - 1)
A[p] = f"[{A[p]... | 14 | 14 | 324 | 329 | def partition(p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
n = int(eval(input()))
A = [int(i) for i in input().split()]
q = partition(0, n - 1)
A[q] = "[%d]" % A[q]
print((*... | def partition(A, p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
n = int(eval(input()))
A = list(map(int, input().split()))
p = partition(A, 0, n - 1)
A[p] = f"[{A[p]}]"
print(... | false | 0 | [
"-def partition(p, r):",
"+def partition(A, p, r):",
"-A = [int(i) for i in input().split()]",
"-q = partition(0, n - 1)",
"-A[q] = \"[%d]\" % A[q]",
"+A = list(map(int, input().split()))",
"+p = partition(A, 0, n - 1)",
"+A[p] = f\"[{A[p]}]\""
] | false | 0.033967 | 0.035955 | 0.944706 | [
"s391227273",
"s566449118"
] |
u648881683 | p02804 | python | s375435371 | s724889985 | 307 | 280 | 23,104 | 20,184 | Accepted | Accepted | 8.79 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A)
mod = 10**9+7
# conbModに使うfactとfactinvを求める
def factorialMod(n, p):
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
for i in range(2, N + 1):
fact.append((fact[-1] * i) % mod)
inv.append((-in... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A)
mod = 10**9+7
# conbModに使うfactとfactinvを求める
def factorialMod(n, p):
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
for i in range(2, n + 1):
fact.append((fact[-1] * i) % p)
inv.append((-inv[... | 32 | 32 | 818 | 808 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A)
mod = 10**9 + 7
# conbModに使うfactとfactinvを求める
def factorialMod(n, p):
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
for i in range(2, N + 1):
fact.append((fact[-1] * i) % mod)
inv.append((-inv[mod % i] ... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A)
mod = 10**9 + 7
# conbModに使うfactとfactinvを求める
def factorialMod(n, p):
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
for i in range(2, n + 1):
fact.append((fact[-1] * i) % p)
inv.append((-inv[p % i] * (p... | false | 0 | [
"- for i in range(2, N + 1):",
"- fact.append((fact[-1] * i) % mod)",
"- inv.append((-inv[mod % i] * (mod // i)) % mod)",
"- factinv.append((factinv[-1] * inv[-1]) % mod)",
"+ for i in range(2, n + 1):",
"+ fact.append((fact[-1] * i) % p)",
"+ inv.append((-inv[p ... | false | 0.065232 | 0.069767 | 0.934994 | [
"s375435371",
"s724889985"
] |
u693953100 | p03738 | python | s611303798 | s156039131 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | a= int(eval(input()))
b = int(eval(input()))
if a>b:
print('GREATER')
elif a<b:
print('LESS')
else:
print('EQUAL') | a = int(eval(input()))
b = int(eval(input()))
if a<b:
print('LESS')
elif a==b:
print('EQUAL')
else:
print('GREATER') | 8 | 8 | 121 | 123 | a = int(eval(input()))
b = int(eval(input()))
if a > b:
print("GREATER")
elif a < b:
print("LESS")
else:
print("EQUAL")
| a = int(eval(input()))
b = int(eval(input()))
if a < b:
print("LESS")
elif a == b:
print("EQUAL")
else:
print("GREATER")
| false | 0 | [
"-if a > b:",
"+if a < b:",
"+ print(\"LESS\")",
"+elif a == b:",
"+ print(\"EQUAL\")",
"+else:",
"-elif a < b:",
"- print(\"LESS\")",
"-else:",
"- print(\"EQUAL\")"
] | false | 0.041659 | 0.042125 | 0.988939 | [
"s611303798",
"s156039131"
] |
u536113865 | p03426 | python | s214486436 | s656525684 | 977 | 497 | 9,460 | 15,036 | Accepted | Accepted | 49.13 | ai = lambda: list(map(int, input().split()))
h,w,d = ai()
ph = [0 for _ in range(h*w + 1)]
pw = [0 for _ in range(h*w + 1)]
for i in range(h):
a = ai()
for j in range(w):
ph[a[j]] = i
pw[a[j]] = j
score = [0 for _ in range(h*w + 1)]
for i in range(d+1, h*w+1):
score[i] = s... | ai = lambda: list(map(int, input().split()))
h,w,d = ai()
ph = [0 for _ in range(h*w + 1)]
pw = [0 for _ in range(h*w + 1)]
for i in range(h):
a = ai()
for j in range(w):
ph[a[j]] = i
pw[a[j]] = j
score = [0 for _ in range(h*w + 1)]
for i in range(d+1, h*w+1):
score[i] = s... | 23 | 24 | 462 | 498 | ai = lambda: list(map(int, input().split()))
h, w, d = ai()
ph = [0 for _ in range(h * w + 1)]
pw = [0 for _ in range(h * w + 1)]
for i in range(h):
a = ai()
for j in range(w):
ph[a[j]] = i
pw[a[j]] = j
score = [0 for _ in range(h * w + 1)]
for i in range(d + 1, h * w + 1):
score[i] = score[... | ai = lambda: list(map(int, input().split()))
h, w, d = ai()
ph = [0 for _ in range(h * w + 1)]
pw = [0 for _ in range(h * w + 1)]
for i in range(h):
a = ai()
for j in range(w):
ph[a[j]] = i
pw[a[j]] = j
score = [0 for _ in range(h * w + 1)]
for i in range(d + 1, h * w + 1):
score[i] = score[... | false | 4.166667 | [
"-q = int(eval(input()))",
"+q = int(input())",
"+ans = []",
"- print((score[r] - score[l]))",
"+ ans.append(score[r] - score[l])",
"+print(*ans, sep=\"\\n\")"
] | false | 0.067633 | 0.085395 | 0.792003 | [
"s214486436",
"s656525684"
] |
u047796752 | p02749 | python | s969609660 | s185176107 | 702 | 390 | 93,876 | 129,596 | Accepted | Accepted | 44.44 | import sys
input = sys.stdin.readline
from collections import *
def bfs():
q = deque([0])
color = [0]*N
color[0] = 1
while q:
v = q.popleft()
for nv in G[v]:
if color[nv]==0:
color[nv] = -color[v]
q.append(nv)
... | import sys
input = sys.stdin.readline
from collections import *
def bfs():
color = [0]*N
color[0] = 1
q = deque([0])
while q:
v = q.popleft()
for nv in G[v]:
if color[nv]==0:
color[nv] = -color[v]
q.append(nv)
... | 98 | 55 | 2,018 | 1,103 | import sys
input = sys.stdin.readline
from collections import *
def bfs():
q = deque([0])
color = [0] * N
color[0] = 1
while q:
v = q.popleft()
for nv in G[v]:
if color[nv] == 0:
color[nv] = -color[v]
q.append(nv)
return color
N = int(... | import sys
input = sys.stdin.readline
from collections import *
def bfs():
color = [0] * N
color[0] = 1
q = deque([0])
while q:
v = q.popleft()
for nv in G[v]:
if color[nv] == 0:
color[nv] = -color[v]
q.append(nv)
return color
N = int(... | false | 43.877551 | [
"- q = deque([0])",
"+ q = deque([0])",
"-cnt = [0] * 3",
"+n = [0, 0, 0]",
"- cnt[i % 3] += 1",
"+ n[i % 3] += 1",
"-m = color.count(1)",
"+b = color.count(1)",
"+if b > N - b:",
"+ for i in range(N):",
"+ color[i] *= -1",
"-if m <= cnt[0]:",
"- c0, c1, c2 = 3, 1, 2... | false | 0.083426 | 0.040029 | 2.084141 | [
"s969609660",
"s185176107"
] |
u969850098 | p03835 | python | s354785217 | s394415155 | 1,703 | 786 | 2,940 | 2,940 | Accepted | Accepted | 53.85 | K, S = list(map(int, input().split()))
count = 0
for X in range(K+1):
for Y in range(K+1):
if S-X-Y >= 0 and S-X-Y <= K:
count += 1
print(count) | import sys
readline = sys.stdin.readline
def main():
K, S = list(map(int, readline().rstrip().split()))
ans = 0
for x in range(K+1):
for y in range(K+1):
if 0 <= S - x - y <= K:
ans += 1
print(ans)
if __name__ == '__main__':
main() | 7 | 16 | 168 | 300 | K, S = list(map(int, input().split()))
count = 0
for X in range(K + 1):
for Y in range(K + 1):
if S - X - Y >= 0 and S - X - Y <= K:
count += 1
print(count)
| import sys
readline = sys.stdin.readline
def main():
K, S = list(map(int, readline().rstrip().split()))
ans = 0
for x in range(K + 1):
for y in range(K + 1):
if 0 <= S - x - y <= K:
ans += 1
print(ans)
if __name__ == "__main__":
main()
| false | 56.25 | [
"-K, S = list(map(int, input().split()))",
"-count = 0",
"-for X in range(K + 1):",
"- for Y in range(K + 1):",
"- if S - X - Y >= 0 and S - X - Y <= K:",
"- count += 1",
"-print(count)",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+",
"+",
"+def main():",
"... | false | 0.040857 | 0.077234 | 0.529008 | [
"s354785217",
"s394415155"
] |
u305366205 | p02783 | python | s481128454 | s419074508 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | h, a = list(map(int, input().split()))
cnt = 0
while h > 0:
h -= a
cnt += 1
print(cnt)
| h, a = list(map(int, input().split()))
print(((h + a - 1) // a)) | 6 | 2 | 94 | 57 | h, a = list(map(int, input().split()))
cnt = 0
while h > 0:
h -= a
cnt += 1
print(cnt)
| h, a = list(map(int, input().split()))
print(((h + a - 1) // a))
| false | 66.666667 | [
"-cnt = 0",
"-while h > 0:",
"- h -= a",
"- cnt += 1",
"-print(cnt)",
"+print(((h + a - 1) // a))"
] | false | 0.037078 | 0.04137 | 0.89626 | [
"s481128454",
"s419074508"
] |
u113971909 | p02600 | python | s336758741 | s441024470 | 34 | 29 | 9,168 | 9,072 | Accepted | Accepted | 14.71 | #!/usr/bin python3
# -*- coding: utf-8 -*-
x = int(eval(input()))
if x<600:
print((8))
elif x<800:
print((7))
elif x<1000:
print((6))
elif x<1200:
print((5))
elif x<1400:
print((4))
elif x<1600:
print((3))
elif x<1800:
print((2))
else:
print((1))
| #!/usr/bin python3
# -*- coding: utf-8 -*-
x = int(eval(input()))
print((10-x//200))
| 20 | 5 | 277 | 82 | #!/usr/bin python3
# -*- coding: utf-8 -*-
x = int(eval(input()))
if x < 600:
print((8))
elif x < 800:
print((7))
elif x < 1000:
print((6))
elif x < 1200:
print((5))
elif x < 1400:
print((4))
elif x < 1600:
print((3))
elif x < 1800:
print((2))
else:
print((1))
| #!/usr/bin python3
# -*- coding: utf-8 -*-
x = int(eval(input()))
print((10 - x // 200))
| false | 75 | [
"-if x < 600:",
"- print((8))",
"-elif x < 800:",
"- print((7))",
"-elif x < 1000:",
"- print((6))",
"-elif x < 1200:",
"- print((5))",
"-elif x < 1400:",
"- print((4))",
"-elif x < 1600:",
"- print((3))",
"-elif x < 1800:",
"- print((2))",
"-else:",
"- print((1... | false | 0.044791 | 0.044534 | 1.005771 | [
"s336758741",
"s441024470"
] |
u539692012 | p02692 | python | s946146891 | s821122851 | 273 | 211 | 30,324 | 12,180 | Accepted | Accepted | 22.71 | n, a, b, c = map(int, input().split())
q = [(0, 1) if si == 'AB' else (1, 2) if si == 'BC' else (0, 2) for si in (input() for _ in range(n))]
ans = []
ch = ['A', 'B', 'C']
d = [a, b, c]
nxt = [[-1] * 3] * n
t = [-1, -1, -1]
for i, (x, y) in reversed(list(enumerate(q))):
nxt[i] = t.copy()
t[x], t[y] =... | n, a, b, c = map(int, input().split())
q = [(0, 1) if s == 'AB' else (1, 2) if s == 'BC' else (0, 2) for s in (input() for _ in range(n))]
ans = []
ch = ('A', 'B', 'C')
d = [a, b, c]
for (x, y), t in zip(q, q[1:] + [()]):
if d[x] + d[y] == 0:
print('No')
break
if d[x] > d[y] or d[x] *... | 22 | 17 | 608 | 458 | n, a, b, c = map(int, input().split())
q = [
(0, 1) if si == "AB" else (1, 2) if si == "BC" else (0, 2)
for si in (input() for _ in range(n))
]
ans = []
ch = ["A", "B", "C"]
d = [a, b, c]
nxt = [[-1] * 3] * n
t = [-1, -1, -1]
for i, (x, y) in reversed(list(enumerate(q))):
nxt[i] = t.copy()
t[x], t[y] = ... | n, a, b, c = map(int, input().split())
q = [
(0, 1) if s == "AB" else (1, 2) if s == "BC" else (0, 2)
for s in (input() for _ in range(n))
]
ans = []
ch = ("A", "B", "C")
d = [a, b, c]
for (x, y), t in zip(q, q[1:] + [()]):
if d[x] + d[y] == 0:
print("No")
break
if d[x] > d[y] or d[x] * ... | false | 22.727273 | [
"- (0, 1) if si == \"AB\" else (1, 2) if si == \"BC\" else (0, 2)",
"- for si in (input() for _ in range(n))",
"+ (0, 1) if s == \"AB\" else (1, 2) if s == \"BC\" else (0, 2)",
"+ for s in (input() for _ in range(n))",
"-ch = [\"A\", \"B\", \"C\"]",
"+ch = (\"A\", \"B\", \"C\")",
"-nxt = [[-... | false | 0.043182 | 0.06314 | 0.683917 | [
"s946146891",
"s821122851"
] |
u852690916 | p04044 | python | s363013888 | s844133869 | 168 | 64 | 38,384 | 62,136 | Accepted | Accepted | 61.9 | N, L = list(map(int, input().split()))
print(("".join(sorted([eval(input()) for _ in range(N)])))) | N, L = list(map(int, input().split()))
S = sorted([eval(input()) for _ in range(N)])
print((''.join(S)))
| 2 | 3 | 85 | 93 | N, L = list(map(int, input().split()))
print(("".join(sorted([eval(input()) for _ in range(N)]))))
| N, L = list(map(int, input().split()))
S = sorted([eval(input()) for _ in range(N)])
print(("".join(S)))
| false | 33.333333 | [
"-print((\"\".join(sorted([eval(input()) for _ in range(N)]))))",
"+S = sorted([eval(input()) for _ in range(N)])",
"+print((\"\".join(S)))"
] | false | 0.037291 | 0.036482 | 1.022167 | [
"s363013888",
"s844133869"
] |
u414458988 | p03937 | python | s154841500 | s171869385 | 173 | 65 | 38,384 | 61,912 | Accepted | Accepted | 62.43 | h,w=list(map(int,input().split()))
a=[list(eval(input())) for i in range(h)]
cnt=0
for i in range(h):
for j in range(w):
if a[i][j] == "#":
cnt += 1
if cnt == h+w-1:
print("Possible")
else:
print("Impossible") | def main():
h, w = list(map(int,input().split()))
a = [list(eval(input())) for _ in range(h)]
cnt=0
for i in range(h):
for j in range(w):
if a[i][j] == '#':
cnt += 1
if cnt == h+w-1:
print('Possible')
else:
print('Impossible')
if ... | 11 | 15 | 239 | 344 | h, w = list(map(int, input().split()))
a = [list(eval(input())) for i in range(h)]
cnt = 0
for i in range(h):
for j in range(w):
if a[i][j] == "#":
cnt += 1
if cnt == h + w - 1:
print("Possible")
else:
print("Impossible")
| def main():
h, w = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(h)]
cnt = 0
for i in range(h):
for j in range(w):
if a[i][j] == "#":
cnt += 1
if cnt == h + w - 1:
print("Possible")
else:
print("Impossible")
if __nam... | false | 26.666667 | [
"-h, w = list(map(int, input().split()))",
"-a = [list(eval(input())) for i in range(h)]",
"-cnt = 0",
"-for i in range(h):",
"- for j in range(w):",
"- if a[i][j] == \"#\":",
"- cnt += 1",
"-if cnt == h + w - 1:",
"- print(\"Possible\")",
"-else:",
"- print(\"Impossib... | false | 0.042427 | 0.042967 | 0.987429 | [
"s154841500",
"s171869385"
] |
u454524105 | p03262 | python | s720521924 | s684143015 | 103 | 91 | 16,240 | 16,252 | Accepted | Accepted | 11.65 | import fractions
n, x = list(map(int, input().split()))
idx = [abs(int(i) - x) for i in input().split()]
ans = idx[0]
if n == 1: pass
else:
for i in range(1, n):
ans = fractions.gcd(ans, idx[i])
print(ans) | import fractions
from functools import reduce
gcd = lambda l: reduce(fractions.gcd, l)
n, x = list(map(int, input().split()))
c = [abs(x-int(i)) for i in input().split()]
print((gcd(c))) | 9 | 6 | 219 | 183 | import fractions
n, x = list(map(int, input().split()))
idx = [abs(int(i) - x) for i in input().split()]
ans = idx[0]
if n == 1:
pass
else:
for i in range(1, n):
ans = fractions.gcd(ans, idx[i])
print(ans)
| import fractions
from functools import reduce
gcd = lambda l: reduce(fractions.gcd, l)
n, x = list(map(int, input().split()))
c = [abs(x - int(i)) for i in input().split()]
print((gcd(c)))
| false | 33.333333 | [
"+from functools import reduce",
"+gcd = lambda l: reduce(fractions.gcd, l)",
"-idx = [abs(int(i) - x) for i in input().split()]",
"-ans = idx[0]",
"-if n == 1:",
"- pass",
"-else:",
"- for i in range(1, n):",
"- ans = fractions.gcd(ans, idx[i])",
"-print(ans)",
"+c = [abs(x - int(i... | false | 0.12755 | 0.055514 | 2.297612 | [
"s720521924",
"s684143015"
] |
u127499732 | p03037 | python | s844607891 | s853655455 | 194 | 117 | 28,172 | 18,292 | Accepted | Accepted | 39.69 | def main():
import sys
n,m=list(map(int,input().split()))
LR=tuple([list(map(int,e.split())) for e in sys.stdin])
left,right=-1*float("inf"),float("inf")
for L,R in LR:
if right<L or R<left:
print((0))
break
else:
tmp=sorted([left,right,L,R])
left,right=tmp[1]... | def main():
IN= open(0).read().split()[2:]
left,right=-1*float("inf"),float("inf")
for L,R in zip(IN[::2],IN[1::2]):
L,R=int(L),int(R)
if right<L or R<left:
print((0))
break
else:
tmp=sorted([left,right,L,R])
left,right=tmp[1],tmp[2]
else:
print((right-lef... | 19 | 17 | 393 | 361 | def main():
import sys
n, m = list(map(int, input().split()))
LR = tuple([list(map(int, e.split())) for e in sys.stdin])
left, right = -1 * float("inf"), float("inf")
for L, R in LR:
if right < L or R < left:
print((0))
break
else:
tmp = sorted([l... | def main():
IN = open(0).read().split()[2:]
left, right = -1 * float("inf"), float("inf")
for L, R in zip(IN[::2], IN[1::2]):
L, R = int(L), int(R)
if right < L or R < left:
print((0))
break
else:
tmp = sorted([left, right, L, R])
left,... | false | 10.526316 | [
"- import sys",
"-",
"- n, m = list(map(int, input().split()))",
"- LR = tuple([list(map(int, e.split())) for e in sys.stdin])",
"+ IN = open(0).read().split()[2:]",
"- for L, R in LR:",
"+ for L, R in zip(IN[::2], IN[1::2]):",
"+ L, R = int(L), int(R)"
] | false | 0.086007 | 0.041772 | 2.058975 | [
"s844607891",
"s853655455"
] |
u594859393 | p03339 | python | s469894345 | s555927526 | 209 | 116 | 27,552 | 16,164 | Accepted | Accepted | 44.5 | n = int(eval(input()))
s = eval(input())
e = [0]
w = [s[1:].count('E')]
for i in range(1, n):
e.append(e[-1]+(s[i-1]=='W'))
w.append(w[-1]-(s[i]=='E'))
print((min(a+b for a,b in zip(e,w)))) | from itertools import accumulate
n, s = eval(input()), eval(input())
a = accumulate(c=='W' for c in 'X'+s[:-1])
b = reversed(list(accumulate(c=='E' for c in 'X'+s[-1:0:-1])))
print((min(x + y for x, y in zip(a, b)))) | 8 | 7 | 186 | 210 | n = int(eval(input()))
s = eval(input())
e = [0]
w = [s[1:].count("E")]
for i in range(1, n):
e.append(e[-1] + (s[i - 1] == "W"))
w.append(w[-1] - (s[i] == "E"))
print((min(a + b for a, b in zip(e, w))))
| from itertools import accumulate
n, s = eval(input()), eval(input())
a = accumulate(c == "W" for c in "X" + s[:-1])
b = reversed(list(accumulate(c == "E" for c in "X" + s[-1:0:-1])))
print((min(x + y for x, y in zip(a, b))))
| false | 12.5 | [
"-n = int(eval(input()))",
"-s = eval(input())",
"-e = [0]",
"-w = [s[1:].count(\"E\")]",
"-for i in range(1, n):",
"- e.append(e[-1] + (s[i - 1] == \"W\"))",
"- w.append(w[-1] - (s[i] == \"E\"))",
"-print((min(a + b for a, b in zip(e, w))))",
"+from itertools import accumulate",
"+",
"+n,... | false | 0.03885 | 0.067654 | 0.57424 | [
"s469894345",
"s555927526"
] |
u970197315 | p03608 | python | s738346532 | s121184864 | 581 | 312 | 72,792 | 77,268 | Accepted | Accepted | 46.3 | # ABC073 D - joisino's travel
import itertools
N,M,R=list(map(int, input().split()))
r=list(map(int, input().split()))
inf=float("inf")
mat=[[inf]*N for _ in range(N)]
for i in range(M):
a,b,c=list(map(int,input().split()))
if mat[a-1][b-1]>c:
mat[a-1][b-1]=mat[b-1][a-1]=c
for i in range(R... | from itertools import permutations
N, M, R = list(map(int, input().split()))
r = [int(i)-1 for i in input().split()]
inf = float("inf")
mat = [[inf]*N for _ in range(N)]
for i in range(M):
a, b, c = list(map(int, input().split()))
if mat[a-1][b-1] > c:
mat[a-1][b-1] = mat[b-1][a-1] = c
for k ... | 27 | 24 | 623 | 603 | # ABC073 D - joisino's travel
import itertools
N, M, R = list(map(int, input().split()))
r = list(map(int, input().split()))
inf = float("inf")
mat = [[inf] * N for _ in range(N)]
for i in range(M):
a, b, c = list(map(int, input().split()))
if mat[a - 1][b - 1] > c:
mat[a - 1][b - 1] = mat[b - 1][a - 1... | from itertools import permutations
N, M, R = list(map(int, input().split()))
r = [int(i) - 1 for i in input().split()]
inf = float("inf")
mat = [[inf] * N for _ in range(N)]
for i in range(M):
a, b, c = list(map(int, input().split()))
if mat[a - 1][b - 1] > c:
mat[a - 1][b - 1] = mat[b - 1][a - 1] = c
... | false | 11.111111 | [
"-# ABC073 D - joisino's travel",
"-import itertools",
"+from itertools import permutations",
"-r = list(map(int, input().split()))",
"+r = [int(i) - 1 for i in input().split()]",
"-for i in range(R):",
"- r[i] -= 1",
"-ans = inf",
"-for rr in itertools.permutations(r, R):",
"- t_sum = 0",
... | false | 0.038552 | 0.037466 | 1.028981 | [
"s738346532",
"s121184864"
] |
u014730000 | p03160 | python | s417496761 | s611318933 | 214 | 131 | 136,772 | 20,408 | Accepted | Accepted | 38.79 | from functools import lru_cache
import sys
iMaxStackSize = 5000000
sys.setrecursionlimit(iMaxStackSize)
n = int(eval(input()))
heights = [int(x) for x in input().split()]
@lru_cache(None)
def solve(i):
if i == n - 1:
return 0
if i + 2 >= len(heights):
return abs(heights[i + 1] - h... | n = int(eval(input()))
heights = [int(x) for x in input().split()]
dp = [float("inf")] * n
dp[0] = 0
for i in range(1, n):
if i - 2 >= 0:
val1 = abs(heights[i] - heights[i - 1]) + dp[i - 1]
val2 = abs(heights[i] - heights[i - 2]) + dp[i - 2]
dp[i] = min(val1, val2)
else:
... | 21 | 13 | 532 | 385 | from functools import lru_cache
import sys
iMaxStackSize = 5000000
sys.setrecursionlimit(iMaxStackSize)
n = int(eval(input()))
heights = [int(x) for x in input().split()]
@lru_cache(None)
def solve(i):
if i == n - 1:
return 0
if i + 2 >= len(heights):
return abs(heights[i + 1] - heights[i])
... | n = int(eval(input()))
heights = [int(x) for x in input().split()]
dp = [float("inf")] * n
dp[0] = 0
for i in range(1, n):
if i - 2 >= 0:
val1 = abs(heights[i] - heights[i - 1]) + dp[i - 1]
val2 = abs(heights[i] - heights[i - 2]) + dp[i - 2]
dp[i] = min(val1, val2)
else:
dp[i] = ... | false | 38.095238 | [
"-from functools import lru_cache",
"-import sys",
"-",
"-iMaxStackSize = 5000000",
"-sys.setrecursionlimit(iMaxStackSize)",
"-",
"-",
"-@lru_cache(None)",
"-def solve(i):",
"- if i == n - 1:",
"- return 0",
"- if i + 2 >= len(heights):",
"- return abs(heights[i + 1] - he... | false | 0.035963 | 0.035861 | 1.002864 | [
"s417496761",
"s611318933"
] |
u579699847 | p03013 | python | s853638927 | s614890659 | 355 | 96 | 460,020 | 13,224 | Accepted | Accepted | 72.96 | def main(N,M,a):
dp = [-1]*N
dp[0] = 1
if N != 1:
dp[1] = 2
for i in a:
if i == 1:
dp[0] = 0
dp[1] = 1
else:
dp[i-1] = 0
for i in range(2,N):
if dp[i] != 0:
dp[i] = dp[i-1] + dp[i-2]
return dp[-1]
N,M ... | import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M = LI()
a = set([I() for _ in range(M)])
if N==1:
print((1))
exit()
dp = [0]*(N+1) #1_indexed
dp[1] = 0 if 1 in a else 1
dp[2] = 0 if 2 in a else (1+dp[1])
for i in r... | 19 | 17 | 424 | 441 | def main(N, M, a):
dp = [-1] * N
dp[0] = 1
if N != 1:
dp[1] = 2
for i in a:
if i == 1:
dp[0] = 0
dp[1] = 1
else:
dp[i - 1] = 0
for i in range(2, N):
if dp[i] != 0:
dp[i] = dp[i - 1] + dp[i - 2]
return dp[-1]
N, M =... | import sys
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
N, M = LI()
a = set([I() for _ in range(M)])
if N == 1:
print((1))
exit()
dp = [0] * (N + 1) # 1_indexed
dp[1] = 0 if 1 in a else 1
dp[2] = 0 if 2 in a else (1 + dp... | false | 10.526316 | [
"-def main(N, M, a):",
"- dp = [-1] * N",
"- dp[0] = 1",
"- if N != 1:",
"- dp[1] = 2",
"- for i in a:",
"- if i == 1:",
"- dp[0] = 0",
"- dp[1] = 1",
"- else:",
"- dp[i - 1] = 0",
"- for i in range(2, N):",
"- if dp... | false | 0.112574 | 0.055979 | 2.011005 | [
"s853638927",
"s614890659"
] |
u133936772 | p02661 | python | s988956715 | s904527187 | 466 | 210 | 25,392 | 55,212 | Accepted | Accepted | 54.94 | n=int(eval(input()))
m,M=[],[]
for i in range(n):
a,b=list(map(int,input().split()))
m+=[a]
M+=[b]
m.sort()
M.sort()
d=n//2
print((M[d]-m[d]+1+(M[d-1]+-m[d-1])*(1-n%2))) | n,*l=list(map(int,open(0).read().split()))
m,M=sorted(l[::2]),sorted(l[1::2])
d=n//2
print((M[d]-m[d]+1+(M[d-1]+-m[d-1])*(n%2^1))) | 10 | 4 | 170 | 125 | n = int(eval(input()))
m, M = [], []
for i in range(n):
a, b = list(map(int, input().split()))
m += [a]
M += [b]
m.sort()
M.sort()
d = n // 2
print((M[d] - m[d] + 1 + (M[d - 1] + -m[d - 1]) * (1 - n % 2)))
| n, *l = list(map(int, open(0).read().split()))
m, M = sorted(l[::2]), sorted(l[1::2])
d = n // 2
print((M[d] - m[d] + 1 + (M[d - 1] + -m[d - 1]) * (n % 2 ^ 1)))
| false | 60 | [
"-n = int(eval(input()))",
"-m, M = [], []",
"-for i in range(n):",
"- a, b = list(map(int, input().split()))",
"- m += [a]",
"- M += [b]",
"-m.sort()",
"-M.sort()",
"+n, *l = list(map(int, open(0).read().split()))",
"+m, M = sorted(l[::2]), sorted(l[1::2])",
"-print((M[d] - m[d] + 1 + ... | false | 0.04012 | 0.040771 | 0.984036 | [
"s988956715",
"s904527187"
] |
u635277286 | p03475 | python | s072003784 | s300684978 | 1,383 | 140 | 9,256 | 9,204 | Accepted | Accepted | 89.88 | N = int(eval(input()))
C = [0] * N
S = [0] * N
F = [0] * N
for i in range(N-1):
C[i], S[i], F[i] = list(map(int, input().split()))
def Time_spent(i,t):
global C,S,F
res = C[i]
if t < S[i]:
res += S[i]
else: # if t >= S[i]
for tt in range(t,t + F[i] + 1):
if tt % F[i] == 0:
res += tt
... | N = int(eval(input()))
C = [0] * N
S = [0] * N
F = [0] * N
for i in range(N-1):
C[i], S[i], F[i] = list(map(int, input().split()))
def calc_time(i,t):
global C,S,F
res = 0
if t < S[i]:
res = S[i]
elif t % F[i] == 0:
res = t
else:
res = (t + F[i]) - (t % F[i])
res += C[i]
return res
... | 32 | 31 | 581 | 544 | N = int(eval(input()))
C = [0] * N
S = [0] * N
F = [0] * N
for i in range(N - 1):
C[i], S[i], F[i] = list(map(int, input().split()))
def Time_spent(i, t):
global C, S, F
res = C[i]
if t < S[i]:
res += S[i]
else: # if t >= S[i]
for tt in range(t, t + F[i] + 1):
if tt % ... | N = int(eval(input()))
C = [0] * N
S = [0] * N
F = [0] * N
for i in range(N - 1):
C[i], S[i], F[i] = list(map(int, input().split()))
def calc_time(i, t):
global C, S, F
res = 0
if t < S[i]:
res = S[i]
elif t % F[i] == 0:
res = t
else:
res = (t + F[i]) - (t % F[i])
r... | false | 3.125 | [
"-def Time_spent(i, t):",
"+def calc_time(i, t):",
"- res = C[i]",
"+ res = 0",
"- res += S[i]",
"- else: # if t >= S[i]",
"- for tt in range(t, t + F[i] + 1):",
"- if tt % F[i] == 0:",
"- res += tt",
"- break",
"+ res = S[i... | false | 0.044696 | 0.036572 | 1.222148 | [
"s072003784",
"s300684978"
] |
u603958124 | p02735 | python | s741502608 | s998337429 | 58 | 52 | 10,232 | 10,220 | Accepted | Accepted | 10.34 | from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator ... | from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator ... | 52 | 39 | 1,572 | 1,288 | from math import (
ceil,
floor,
comb,
factorial,
gcd,
pow,
sqrt,
log2,
cos,
sin,
tan,
acos,
asin,
atan,
degrees,
radians,
pi,
inf,
)
from itertools import (
accumulate,
permutations,
combinations,
product,
combinations_with_repl... | from math import (
ceil,
floor,
comb,
factorial,
gcd,
pow,
sqrt,
log2,
cos,
sin,
tan,
acos,
asin,
atan,
degrees,
radians,
pi,
inf,
)
from itertools import (
accumulate,
permutations,
combinations,
product,
combinations_with_repl... | false | 25 | [
"-def bfs():",
"- que = deque()",
"- que.append([0, 0])",
"- if s[0][0] == \"#\":",
"- d[0][0] = 1",
"- else:",
"- d[0][0] = 0",
"- while que:",
"- p = que.popleft()",
"- if p[0] == h - 1 and p[1] == w - 1:",
"- break",
"- for i in r... | false | 0.042855 | 0.080139 | 0.534762 | [
"s741502608",
"s998337429"
] |
u581187895 | p02844 | python | s511105947 | s239987668 | 1,617 | 25 | 3,060 | 3,188 | Accepted | Accepted | 98.45 | def resolve():
N = int(input())
S = input()
ans = 0
for i in range(1000):
pw = str(i).zfill(3)
pw_ind = 0
for s in S:
if s == pw[pw_ind]:
pw_ind += 1
if pw_ind == 3:
break
if pw_ind == 3:
... | def resolve():
N = int(input())
S = input()
ans = set()
for i in range(1000):
str_i = str(i).zfill(3)
idx1 = S.find(str_i[0], 0)
idx2 = S.find(str_i[1], idx1 + 1)
idx3 = S.find(str_i[2], idx2 + 1)
if idx1 != -1 and idx2 != -1 and idx3 != -1:
... | 20 | 18 | 405 | 413 | def resolve():
N = int(input())
S = input()
ans = 0
for i in range(1000):
pw = str(i).zfill(3)
pw_ind = 0
for s in S:
if s == pw[pw_ind]:
pw_ind += 1
if pw_ind == 3:
break
if pw_ind == 3:
ans += 1... | def resolve():
N = int(input())
S = input()
ans = set()
for i in range(1000):
str_i = str(i).zfill(3)
idx1 = S.find(str_i[0], 0)
idx2 = S.find(str_i[1], idx1 + 1)
idx3 = S.find(str_i[2], idx2 + 1)
if idx1 != -1 and idx2 != -1 and idx3 != -1:
ans.add(st... | false | 10 | [
"- ans = 0",
"+ ans = set()",
"- pw = str(i).zfill(3)",
"- pw_ind = 0",
"- for s in S:",
"- if s == pw[pw_ind]:",
"- pw_ind += 1",
"- if pw_ind == 3:",
"- break",
"- if pw_ind == 3:",
"- ans ... | false | 0.036187 | 0.039254 | 0.92186 | [
"s511105947",
"s239987668"
] |
u309120194 | p03042 | python | s353879649 | s506311597 | 28 | 23 | 9,160 | 9,168 | Accepted | Accepted | 17.86 | S = int(eval(input()))
L = S // 100 # 前半2桁
R = S % 100 # 後半2桁
if L > 12 or L == 0:
if R > 12 or R == 0: print('NA')
else: print('YYMM')
else:
if R > 12 or R == 0: print('MMYY')
else: print('AMBIGUOUS') | S = int(eval(input()))
L = S // 100 # 前半2桁
R = S % 100 # 後半2桁
if 1 <= L <= 12:
if 1 <= R <= 12: print('AMBIGUOUS')
else: print('MMYY')
else:
if 1 <= R <= 12: print('YYMM')
else: print('NA') | 11 | 11 | 215 | 205 | S = int(eval(input()))
L = S // 100 # 前半2桁
R = S % 100 # 後半2桁
if L > 12 or L == 0:
if R > 12 or R == 0:
print("NA")
else:
print("YYMM")
else:
if R > 12 or R == 0:
print("MMYY")
else:
print("AMBIGUOUS")
| S = int(eval(input()))
L = S // 100 # 前半2桁
R = S % 100 # 後半2桁
if 1 <= L <= 12:
if 1 <= R <= 12:
print("AMBIGUOUS")
else:
print("MMYY")
else:
if 1 <= R <= 12:
print("YYMM")
else:
print("NA")
| false | 0 | [
"-if L > 12 or L == 0:",
"- if R > 12 or R == 0:",
"+if 1 <= L <= 12:",
"+ if 1 <= R <= 12:",
"+ print(\"AMBIGUOUS\")",
"+ else:",
"+ print(\"MMYY\")",
"+else:",
"+ if 1 <= R <= 12:",
"+ print(\"YYMM\")",
"+ else:",
"- else:",
"- print(\"YYMM\")"... | false | 0.068087 | 0.037317 | 1.824552 | [
"s353879649",
"s506311597"
] |
u128539234 | p02983 | python | s650957533 | s739388450 | 1,991 | 478 | 3,060 | 3,060 | Accepted | Accepted | 75.99 | l,r = list(map(int,input().split()))
r = min(r, l+4038)
min = 99999999
for i in range(l,r):
for j in range(i+1,r+1):
value = (i*j)%2019
if min > value:
min = value
print(min) | l,r = list(map(int,input().split()))
r = min(r, l+2019)
# ある数を2019で割った時の余りの最大値(2018)でminを初期化
min = 2018
for i in range(l,r):
for j in range(i+1,r+1):
value = (i*j)%2019
if min > value:
min = value
print(min) | 11 | 10 | 196 | 226 | l, r = list(map(int, input().split()))
r = min(r, l + 4038)
min = 99999999
for i in range(l, r):
for j in range(i + 1, r + 1):
value = (i * j) % 2019
if min > value:
min = value
print(min)
| l, r = list(map(int, input().split()))
r = min(r, l + 2019)
# ある数を2019で割った時の余りの最大値(2018)でminを初期化
min = 2018
for i in range(l, r):
for j in range(i + 1, r + 1):
value = (i * j) % 2019
if min > value:
min = value
print(min)
| false | 9.090909 | [
"-r = min(r, l + 4038)",
"-min = 99999999",
"+r = min(r, l + 2019)",
"+# ある数を2019で割った時の余りの最大値(2018)でminを初期化",
"+min = 2018"
] | false | 0.080224 | 0.078868 | 1.017197 | [
"s650957533",
"s739388450"
] |
u104282757 | p02619 | python | s634168829 | s544852210 | 846 | 595 | 115,720 | 106,712 | Accepted | Accepted | 29.67 | import numpy as np
import numba
@numba.njit('i4[:](i4, i4[:], i4[:, :], i4[:])')
def solve(dd, c_arr, s_arr, t_arr):
last_d = np.zeros(26, dtype=np.int32) - 1
score = 0
score_arr = np.zeros(dd, dtype=np.int32)
for d in range(dd):
score += s_arr[d, t_arr[d] - 1]
last_d[t_arr[... | import numpy as np
import numba
i4 = numba.int32
@numba.njit((i4, i4[:], i4[:, :], i4[:]), cache=True)
def solve(dd, c_arr, s_arr, t_arr):
last_d = np.zeros(26, dtype=np.int32) - 1
score = 0
score_arr = np.zeros(dd, dtype=np.int32)
for d in range(dd):
score += s_arr[d, t_arr[d] ... | 29 | 32 | 834 | 861 | import numpy as np
import numba
@numba.njit("i4[:](i4, i4[:], i4[:, :], i4[:])")
def solve(dd, c_arr, s_arr, t_arr):
last_d = np.zeros(26, dtype=np.int32) - 1
score = 0
score_arr = np.zeros(dd, dtype=np.int32)
for d in range(dd):
score += s_arr[d, t_arr[d] - 1]
last_d[t_arr[d] - 1] = d... | import numpy as np
import numba
i4 = numba.int32
@numba.njit((i4, i4[:], i4[:, :], i4[:]), cache=True)
def solve(dd, c_arr, s_arr, t_arr):
last_d = np.zeros(26, dtype=np.int32) - 1
score = 0
score_arr = np.zeros(dd, dtype=np.int32)
for d in range(dd):
score += s_arr[d, t_arr[d] - 1]
l... | false | 9.375 | [
"+i4 = numba.int32",
"-@numba.njit(\"i4[:](i4, i4[:], i4[:, :], i4[:])\")",
"+",
"+@numba.njit((i4, i4[:], i4[:, :], i4[:]), cache=True)"
] | false | 0.203589 | 0.399485 | 0.509627 | [
"s634168829",
"s544852210"
] |
u528470578 | p03168 | python | s921960356 | s560862706 | 272 | 236 | 153,224 | 153,312 | Accepted | Accepted | 13.24 | N = int(eval(input()))
p = list(map(float, input().split()))
dp = [[0.0 for i in range(N+1)] for j in range(N+1)]
dp[0][0] = 1.0
for i in range(N):
for j in range(N):
dp[i+1][j+1] += dp[i][j] * p[i]
dp[i+1][j] += dp[i][j] * (1 - p[i])
temp = (N+1) // 2
ans = 0
for i in range(temp, N+1):
... | N = int(eval(input()))
p = list(map(float, input().split()))
dp = [[0.0 for i in range(N+1)] for _ in range(N+1)]
dp[0][0] = 1.0
for i in range(N):
for j in range(i+1):
# 表が出る
dp[i+1][j+1] += dp[i][j] * p[i]
# 裏が出る
dp[i+1][j] += dp[i][j] * (1 - p[i])
temp = (N+1)//2
print(... | 13 | 12 | 344 | 333 | N = int(eval(input()))
p = list(map(float, input().split()))
dp = [[0.0 for i in range(N + 1)] for j in range(N + 1)]
dp[0][0] = 1.0
for i in range(N):
for j in range(N):
dp[i + 1][j + 1] += dp[i][j] * p[i]
dp[i + 1][j] += dp[i][j] * (1 - p[i])
temp = (N + 1) // 2
ans = 0
for i in range(temp, N + 1)... | N = int(eval(input()))
p = list(map(float, input().split()))
dp = [[0.0 for i in range(N + 1)] for _ in range(N + 1)]
dp[0][0] = 1.0
for i in range(N):
for j in range(i + 1):
# 表が出る
dp[i + 1][j + 1] += dp[i][j] * p[i]
# 裏が出る
dp[i + 1][j] += dp[i][j] * (1 - p[i])
temp = (N + 1) // 2
p... | false | 7.692308 | [
"-dp = [[0.0 for i in range(N + 1)] for j in range(N + 1)]",
"+dp = [[0.0 for i in range(N + 1)] for _ in range(N + 1)]",
"- for j in range(N):",
"+ for j in range(i + 1):",
"+ # 表が出る",
"+ # 裏が出る",
"-ans = 0",
"-for i in range(temp, N + 1):",
"- ans += dp[N][i]",
"-print(ans... | false | 0.037327 | 0.061099 | 0.610918 | [
"s921960356",
"s560862706"
] |
u989962753 | p03370 | python | s761560775 | s171543589 | 47 | 19 | 3,064 | 3,064 | Accepted | Accepted | 59.57 | #NとXの読み込み
n, x = input().split()
n = int(n)
x = int (x)
m = []
i_min = 0
result = 0
#m1からmnまでの読み込み
for i in range(n):
m.append(int(eval(input())))
#全種類ひとつずつ作る
for i in range(len(m)):
x = x - m[i]
result = result + 1
#リストの中の最小値を突き止める
for i in range(len(m)):
if m[i_min] > m[i]:
i_min = i
#i_mi... | #データの読み込み
n, x = input().split()
n = int(n)
x = int(x)
m = []
i_min = 0
gokei = 0
#n個の入力に対するループ
for i in range(n):
#問題からの入力をintに変換してリストへ格納
m.append(int(eval(input())))
#全部を1つずつ作った場合の粉量の合計
gokei = gokei + m[i]
#使う粉量が一番少ないドーナツを見つける
if m[i_min] > m[i]:
i_min = i
#全部を1つずつ作った後に残る粉量
x = x - g... | 28 | 19 | 444 | 346 | # NとXの読み込み
n, x = input().split()
n = int(n)
x = int(x)
m = []
i_min = 0
result = 0
# m1からmnまでの読み込み
for i in range(n):
m.append(int(eval(input())))
# 全種類ひとつずつ作る
for i in range(len(m)):
x = x - m[i]
result = result + 1
# リストの中の最小値を突き止める
for i in range(len(m)):
if m[i_min] > m[i]:
i_min = i
# i_mi... | # データの読み込み
n, x = input().split()
n = int(n)
x = int(x)
m = []
i_min = 0
gokei = 0
# n個の入力に対するループ
for i in range(n):
# 問題からの入力をintに変換してリストへ格納
m.append(int(eval(input())))
# 全部を1つずつ作った場合の粉量の合計
gokei = gokei + m[i]
# 使う粉量が一番少ないドーナツを見つける
if m[i_min] > m[i]:
i_min = i
# 全部を1つずつ作った後に残る粉量
x = ... | false | 32.142857 | [
"-# NとXの読み込み",
"+# データの読み込み",
"-result = 0",
"-# m1からmnまでの読み込み",
"+gokei = 0",
"+# n個の入力に対するループ",
"+ # 問題からの入力をintに変換してリストへ格納",
"-# 全種類ひとつずつ作る",
"-for i in range(len(m)):",
"- x = x - m[i]",
"- result = result + 1",
"-# リストの中の最小値を突き止める",
"-for i in range(len(m)):",
"+ # 全部を1つずつ... | false | 0.035169 | 0.073552 | 0.478149 | [
"s761560775",
"s171543589"
] |
u912237403 | p00048 | python | s869882818 | s568457781 | 20 | 10 | 4,220 | 4,220 | Accepted | Accepted | 50 | import sys
c=["light fly", "fly", "bantam", "feather", "light", "light welter",
"welter", "light middle", "middle", "light heavy", "heavy"]
w=[48,51,54,57,60,64,69,75,81,91]
for s in map(float,sys.stdin):
i=0
while i<len(w) and w[i]<s:
i+=1
print(c[i]) | import sys
c=["light fly", "fly", "bantam", "feather", "light", "light welter",
"welter", "light middle", "middle", "light heavy", "heavy"]
w=[48,51,54,57,60,64,69,75,81,91]
for s in map(float,sys.stdin):
i=0
for e in w:
if e<s: i+=1
print(c[i]) | 10 | 10 | 284 | 277 | import sys
c = [
"light fly",
"fly",
"bantam",
"feather",
"light",
"light welter",
"welter",
"light middle",
"middle",
"light heavy",
"heavy",
]
w = [48, 51, 54, 57, 60, 64, 69, 75, 81, 91]
for s in map(float, sys.stdin):
i = 0
while i < len(w) and w[i] < s:
... | import sys
c = [
"light fly",
"fly",
"bantam",
"feather",
"light",
"light welter",
"welter",
"light middle",
"middle",
"light heavy",
"heavy",
]
w = [48, 51, 54, 57, 60, 64, 69, 75, 81, 91]
for s in map(float, sys.stdin):
i = 0
for e in w:
if e < s:
... | false | 0 | [
"- while i < len(w) and w[i] < s:",
"- i += 1",
"+ for e in w:",
"+ if e < s:",
"+ i += 1"
] | false | 0.037955 | 0.040941 | 0.927072 | [
"s869882818",
"s568457781"
] |
u844895214 | p02696 | python | s194285202 | s726513799 | 27 | 23 | 9,124 | 9,092 | Accepted | Accepted | 14.81 | import sys
import math
def IL(): return list(map(int,sys.stdin.readline().rstrip().split()))
def Main():
a,b,n = IL()
x = min(b-1,n)
print((math.floor(a*x/b)-a*math.floor(x/b)))
return
if __name__=='__main__':
Main() | import sys
import math
def IL(): return list(map(int,sys.stdin.readline().rstrip().split()))
def Main():
a,b,n = IL()
x = min(b-1,n)
print((a*x//b))
return
if __name__=='__main__':
Main() | 12 | 12 | 241 | 214 | import sys
import math
def IL():
return list(map(int, sys.stdin.readline().rstrip().split()))
def Main():
a, b, n = IL()
x = min(b - 1, n)
print((math.floor(a * x / b) - a * math.floor(x / b)))
return
if __name__ == "__main__":
Main()
| import sys
import math
def IL():
return list(map(int, sys.stdin.readline().rstrip().split()))
def Main():
a, b, n = IL()
x = min(b - 1, n)
print((a * x // b))
return
if __name__ == "__main__":
Main()
| false | 0 | [
"- print((math.floor(a * x / b) - a * math.floor(x / b)))",
"+ print((a * x // b))"
] | false | 0.085029 | 0.037841 | 2.247013 | [
"s194285202",
"s726513799"
] |
u347640436 | p02913 | python | s604127232 | s342287791 | 887 | 789 | 231,688 | 229,896 | Accepted | Accepted | 11.05 | # PyPy なら通る
# DP(貰うDP)
N = int(eval(input()))
S = eval(input())
dp = [[0] * (N + 1) for _ in range(N + 1)]
result = 0
for i in range(N - 1, -1, -1):
for j in range(N - 1, -1, -1):
if S[i] == S[j]:
dp[i][j] = dp[i + 1][j + 1] + 1
t = dp[i][j]
if t > j - i:
... | N = int(eval(input()))
S = eval(input())
dp = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(N - 1, -1, -1):
for j in range(N - 1, -1, -1):
if S[i] == S[j]:
dp[i][j] = dp[i + 1][j + 1] + 1
result = 0
for i in range(N):
for j in range(i + 1, N):
t = dp[i][j]
i... | 17 | 16 | 403 | 407 | # PyPy なら通る
# DP(貰うDP)
N = int(eval(input()))
S = eval(input())
dp = [[0] * (N + 1) for _ in range(N + 1)]
result = 0
for i in range(N - 1, -1, -1):
for j in range(N - 1, -1, -1):
if S[i] == S[j]:
dp[i][j] = dp[i + 1][j + 1] + 1
t = dp[i][j]
if t > j - i:
... | N = int(eval(input()))
S = eval(input())
dp = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(N - 1, -1, -1):
for j in range(N - 1, -1, -1):
if S[i] == S[j]:
dp[i][j] = dp[i + 1][j + 1] + 1
result = 0
for i in range(N):
for j in range(i + 1, N):
t = dp[i][j]
if t > j - i... | false | 5.882353 | [
"-# PyPy なら通る",
"-# DP(貰うDP)",
"-result = 0",
"- t = dp[i][j]",
"- if t > j - i:",
"- t = j - i",
"- if t > result:",
"- result = t",
"+result = 0",
"+for i in range(N):",
"+ for j in range(i + 1, N):",
"+ t = dp[i][j]",
... | false | 0.047079 | 0.156874 | 0.300105 | [
"s604127232",
"s342287791"
] |
u757030836 | p03495 | python | s479327553 | s615140310 | 160 | 146 | 32,264 | 32,264 | Accepted | Accepted | 8.75 | n,k = list(map(int, input().split()))
A = [int(x) for x in input().split()]
d = {}
for a in A:
if a in d:
d[a] +=1
else:
d[a] =1
d =sorted(d.values())
if len(d) > k:
ans = 0
for i in range(len(d)-k):
ans += d[i]
print(ans)
else:
print((0))
| n,k = list(map(int,input().split()))
a = [int(i) for i in input().split() ]
d = {}
for i in a:
if i in d:
d[i] += 1
else:
d[i] = 1
d = sorted(d.values())
if len(d) > k:
ans = 0
for i in range(len(d)-k):
ans += d[i]
print(ans)
else:
print((0))
| 17 | 20 | 277 | 291 | n, k = list(map(int, input().split()))
A = [int(x) for x in input().split()]
d = {}
for a in A:
if a in d:
d[a] += 1
else:
d[a] = 1
d = sorted(d.values())
if len(d) > k:
ans = 0
for i in range(len(d) - k):
ans += d[i]
print(ans)
else:
print((0))
| n, k = list(map(int, input().split()))
a = [int(i) for i in input().split()]
d = {}
for i in a:
if i in d:
d[i] += 1
else:
d[i] = 1
d = sorted(d.values())
if len(d) > k:
ans = 0
for i in range(len(d) - k):
ans += d[i]
print(ans)
else:
print((0))
| false | 15 | [
"-A = [int(x) for x in input().split()]",
"+a = [int(i) for i in input().split()]",
"-for a in A:",
"- if a in d:",
"- d[a] += 1",
"+for i in a:",
"+ if i in d:",
"+ d[i] += 1",
"- d[a] = 1",
"+ d[i] = 1"
] | false | 0.034291 | 0.033552 | 1.022023 | [
"s479327553",
"s615140310"
] |
u340901659 | p02412 | python | s282374980 | s450055829 | 2,930 | 40 | 7,672 | 7,644 | Accepted | Accepted | 98.63 | def solve(n,x):
count = 0
for i in range(1,n+1):
for j in range(1,n+1):
if i == j :
continue
for k in range(1,n+1):
if j == k or i == k:
continue
if i+j+k == x:
count += 1
retur... | def solve(n,x):
count = 0
for i in range(1,n+1):
for j in range(i+1,n+1):
k = x - i - j
if j < k and k <= n:
count += 1
return count
while True:
n,x = list(map(int,input().split()))
if n == x == 0:
break;
print((solve(n,x))) | 18 | 14 | 441 | 310 | def solve(n, x):
count = 0
for i in range(1, n + 1):
for j in range(1, n + 1):
if i == j:
continue
for k in range(1, n + 1):
if j == k or i == k:
continue
if i + j + k == x:
count += 1
ret... | def solve(n, x):
count = 0
for i in range(1, n + 1):
for j in range(i + 1, n + 1):
k = x - i - j
if j < k and k <= n:
count += 1
return count
while True:
n, x = list(map(int, input().split()))
if n == x == 0:
break
print((solve(n, x)))
| false | 22.222222 | [
"- for j in range(1, n + 1):",
"- if i == j:",
"- continue",
"- for k in range(1, n + 1):",
"- if j == k or i == k:",
"- continue",
"- if i + j + k == x:",
"- count += 1",
"- return cou... | false | 0.048298 | 0.047438 | 1.018144 | [
"s282374980",
"s450055829"
] |
u222668979 | p02616 | python | s995362188 | s535564405 | 302 | 240 | 31,772 | 31,624 | Accepted | Accepted | 20.53 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
mia = sorted([i for i in a if i < 0], reverse=True)
pla = sorted([i for i in a if i >= 0])
ans, num, cnt = 1, [], 0
if len(pla) == 0 and k % 2 == 1:
for i in mia[:k]:
ans = ans * i % mod
print(ans)
... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
mia = sorted([i for i in a if i < 0], reverse=True)
pla = sorted([i for i in a if i >= 0])
cnt = 1
if len(pla) == 0 and k % 2 == 1:
for i in mia[:k]:
cnt = cnt * i % mod
print(cnt)
exit()
wh... | 36 | 33 | 1,045 | 802 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9 + 7
mia = sorted([i for i in a if i < 0], reverse=True)
pla = sorted([i for i in a if i >= 0])
ans, num, cnt = 1, [], 0
if len(pla) == 0 and k % 2 == 1:
for i in mia[:k]:
ans = ans * i % mod
print(ans)
exit()
for ... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9 + 7
mia = sorted([i for i in a if i < 0], reverse=True)
pla = sorted([i for i in a if i >= 0])
cnt = 1
if len(pla) == 0 and k % 2 == 1:
for i in mia[:k]:
cnt = cnt * i % mod
print(cnt)
exit()
while k > 0:
if k... | false | 8.333333 | [
"-ans, num, cnt = 1, [], 0",
"+cnt = 1",
"- ans = ans * i % mod",
"- print(ans)",
"+ cnt = cnt * i % mod",
"+ print(cnt)",
"-for _ in range(k):",
"- if len(mia) == 0 or (len(pla) > 0 and abs(mia[-1]) <= pla[-1]):",
"- tmp = pla.pop()",
"- elif len(pla) == 0 or (len... | false | 0.0417 | 0.041605 | 1.002288 | [
"s995362188",
"s535564405"
] |
u105124953 | p03329 | python | s820176826 | s201841752 | 613 | 100 | 4,596 | 3,828 | Accepted | Accepted | 83.69 | import math
n = int(eval(input()))
#n = 127
inf = float('inf')
dp = [inf]*(n+100000)
dp[0]=0
#print(dp)
#print(len(dp))
def motome(target):
tmp = []
for i in range(10):
if 9**i <= n:
tmp.append(9**i)
if 6**i <= n:
tmp.append(6**i)
#print(tmp)
... | n = int(eval(input()))
inf = float('inf')
dp = [inf]*(n+1)
dp[0] = 0
a = 1
b = 6
c = 9
for i in range(1,n+1):
if i>=b*6:
b*=6
if i>=c*9:
c*=9
if i<6:
dp[i] = i
elif i<9:
dp[i] = min(dp[i],dp[i-b]+1)
else:
dp[i] = min(dp[i],dp[i-b]+1,dp[i-c]+1)... | 43 | 19 | 985 | 328 | import math
n = int(eval(input()))
# n = 127
inf = float("inf")
dp = [inf] * (n + 100000)
dp[0] = 0
# print(dp)
# print(len(dp))
def motome(target):
tmp = []
for i in range(10):
if 9**i <= n:
tmp.append(9**i)
if 6**i <= n:
tmp.append(6**i)
# print(tmp)
# [1, 6, 3... | n = int(eval(input()))
inf = float("inf")
dp = [inf] * (n + 1)
dp[0] = 0
a = 1
b = 6
c = 9
for i in range(1, n + 1):
if i >= b * 6:
b *= 6
if i >= c * 9:
c *= 9
if i < 6:
dp[i] = i
elif i < 9:
dp[i] = min(dp[i], dp[i - b] + 1)
else:
dp[i] = min(dp[i], dp[i - b... | false | 55.813953 | [
"-import math",
"-",
"-# n = 127",
"-dp = [inf] * (n + 100000)",
"+dp = [inf] * (n + 1)",
"-# print(dp)",
"-# print(len(dp))",
"-def motome(target):",
"- tmp = []",
"- for i in range(10):",
"- if 9**i <= n:",
"- tmp.append(9**i)",
"- if 6**i <= n:",
"- ... | false | 0.162308 | 0.060703 | 2.67379 | [
"s820176826",
"s201841752"
] |
u124498235 | p03006 | python | s048489026 | s757035002 | 86 | 34 | 9,224 | 9,124 | Accepted | Accepted | 60.47 | import itertools
n = int(eval(input()))
xy = []
for i in range(n):
x,y = list(map(int, input().split()))
xy.append([x,y])
a,b = [],[]
for v in itertools.combinations(xy,2):
z = list(v)
z.sort()
x = z[1][0]-z[0][0]
y = z[1][1]-z[0][1]
a.append([x,y])
if [x,y] in b:
continue
b.a... | import itertools
n = int(eval(input()))
xy = []
for i in range(n):
x,y = list(map(int, input().split()))
xy.append([x,y])
a={}
for v in itertools.combinations(xy,2):
z = list(v)
z.sort()
x = z[1][0]-z[0][0]
y = z[1][1]-z[0][1]
if (x,y) not in a:
a[(x,y)] = 1
else:
a[(x,y)] += 1
... | 24 | 21 | 380 | 368 | import itertools
n = int(eval(input()))
xy = []
for i in range(n):
x, y = list(map(int, input().split()))
xy.append([x, y])
a, b = [], []
for v in itertools.combinations(xy, 2):
z = list(v)
z.sort()
x = z[1][0] - z[0][0]
y = z[1][1] - z[0][1]
a.append([x, y])
if [x, y] in b:
con... | import itertools
n = int(eval(input()))
xy = []
for i in range(n):
x, y = list(map(int, input().split()))
xy.append([x, y])
a = {}
for v in itertools.combinations(xy, 2):
z = list(v)
z.sort()
x = z[1][0] - z[0][0]
y = z[1][1] - z[0][1]
if (x, y) not in a:
a[(x, y)] = 1
else:
... | false | 12.5 | [
"-a, b = [], []",
"+a = {}",
"- a.append([x, y])",
"- if [x, y] in b:",
"- continue",
"- b.append([x, y])",
"-c = 0",
"-for i in b:",
"- c = max(c, a.count(i))",
"-print((n - c))",
"+ if (x, y) not in a:",
"+ a[(x, y)] = 1",
"+ else:",
"+ a[(x, y)] +=... | false | 0.037074 | 0.036804 | 1.007314 | [
"s048489026",
"s757035002"
] |
u941438707 | p03095 | python | s645022992 | s656112458 | 35 | 32 | 9,396 | 9,212 | Accepted | Accepted | 8.57 | from collections import *
_=eval(input())
c=Counter(eval(input()))
ans=1
for i in list(c.values()):
ans*=i+1
ans%=10**9+7
print((ans-1)) | _=eval(input())
s=eval(input())
ans=1
for i in set(s):
ans*=s.count(i)+1
ans%=10**9+7
print((ans-1)) | 8 | 7 | 131 | 100 | from collections import *
_ = eval(input())
c = Counter(eval(input()))
ans = 1
for i in list(c.values()):
ans *= i + 1
ans %= 10**9 + 7
print((ans - 1))
| _ = eval(input())
s = eval(input())
ans = 1
for i in set(s):
ans *= s.count(i) + 1
ans %= 10**9 + 7
print((ans - 1))
| false | 12.5 | [
"-from collections import *",
"-",
"-c = Counter(eval(input()))",
"+s = eval(input())",
"-for i in list(c.values()):",
"- ans *= i + 1",
"+for i in set(s):",
"+ ans *= s.count(i) + 1"
] | false | 0.037215 | 0.03681 | 1.010998 | [
"s645022992",
"s656112458"
] |
u099300051 | p02572 | python | s826131805 | s778971319 | 229 | 146 | 31,536 | 31,628 | Accepted | Accepted | 36.24 | N=int(eval(input()))
A=list(map(int,input().split()))
#437235829 mod(10^9+7)
sumAcol=0
sumA=0
sumtr=0
for i in range(N):
sumtr+=A[i]**2
sumAcol+=A[i]
sumtr=sumtr % (10**9+7)
sumAcol=sumAcol % (10**9+7)
for i in range(N):
sumA+=(sumAcol*A[i])%(10**9+7)
sumA=(sumA-sumtr)+10**9+7
print((sum... | N=int(eval(input()))
A=list(map(int,input().split()))
sumA=sum(A)
result=0
for i in range(N):
sumA-=A[i]
result+=A[i]*sumA
result=result % (10**9+7)
print(result) | 19 | 10 | 342 | 174 | N = int(eval(input()))
A = list(map(int, input().split()))
# 437235829 mod(10^9+7)
sumAcol = 0
sumA = 0
sumtr = 0
for i in range(N):
sumtr += A[i] ** 2
sumAcol += A[i]
sumtr = sumtr % (10**9 + 7)
sumAcol = sumAcol % (10**9 + 7)
for i in range(N):
sumA += (sumAcol * A[i]) % (10**9 + 7)
sumA = (sumA -... | N = int(eval(input()))
A = list(map(int, input().split()))
sumA = sum(A)
result = 0
for i in range(N):
sumA -= A[i]
result += A[i] * sumA
result = result % (10**9 + 7)
print(result)
| false | 47.368421 | [
"-# 437235829 mod(10^9+7)",
"-sumAcol = 0",
"-sumA = 0",
"-sumtr = 0",
"+sumA = sum(A)",
"+result = 0",
"- sumtr += A[i] ** 2",
"- sumAcol += A[i]",
"- sumtr = sumtr % (10**9 + 7)",
"- sumAcol = sumAcol % (10**9 + 7)",
"-for i in range(N):",
"- sumA += (sumAcol * A[i]) % (10**9 ... | false | 0.04283 | 0.04471 | 0.957952 | [
"s826131805",
"s778971319"
] |
u562935282 | p02758 | python | s523574057 | s403206625 | 953 | 804 | 57,180 | 47,692 | Accepted | Accepted | 15.63 | # 解説放送
# https://atcoder.jp/contests/abc158/submissions/10643692
# dfsの代わりに親の頂点番号を配列で管理する方法
# PyPyでは通った
def main():
from collections import deque, namedtuple
from operator import attrgetter
import sys
input = sys.stdin.readline
MOD = 998244353
Robot = namedtuple('Robot', 'x d rea... | def main():
from collections import deque
from operator import itemgetter
import sys
input = sys.stdin.readline
MOD = 998244353
N = int(eval(input()))
xds = []
xs = []
for _ in range(N):
x, d = list(map(int, input().split()))
xds.append((x, d))
... | 65 | 52 | 1,810 | 1,193 | # 解説放送
# https://atcoder.jp/contests/abc158/submissions/10643692
# dfsの代わりに親の頂点番号を配列で管理する方法
# PyPyでは通った
def main():
from collections import deque, namedtuple
from operator import attrgetter
import sys
input = sys.stdin.readline
MOD = 998244353
Robot = namedtuple("Robot", "x d reach ind")
N ... | def main():
from collections import deque
from operator import itemgetter
import sys
input = sys.stdin.readline
MOD = 998244353
N = int(eval(input()))
xds = []
xs = []
for _ in range(N):
x, d = list(map(int, input().split()))
xds.append((x, d))
xs.append(x)
... | false | 20 | [
"-# 解説放送",
"-# https://atcoder.jp/contests/abc158/submissions/10643692",
"-# dfsの代わりに親の頂点番号を配列で管理する方法",
"-# PyPyでは通った",
"- from collections import deque, namedtuple",
"- from operator import attrgetter",
"+ from collections import deque",
"+ from operator import itemgetter",
"- Robot ... | false | 0.072616 | 0.03569 | 2.03461 | [
"s523574057",
"s403206625"
] |
u497952650 | p02779 | python | s607530785 | s352400310 | 180 | 83 | 26,808 | 25,172 | Accepted | Accepted | 53.89 | N = int(eval(input()))
A = list(map(int,input().split()))
A.sort()
ans = "YES"
for i in range(N-1):
if A[i] == A[i+1]:
ans = "NO"
break
print(ans) | N = int(eval(input()))
A = list(map(int,input().split()))
ans ="YES" if len(set(A))==N else "NO"
print(ans) | 11 | 6 | 172 | 108 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = "YES"
for i in range(N - 1):
if A[i] == A[i + 1]:
ans = "NO"
break
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
ans = "YES" if len(set(A)) == N else "NO"
print(ans)
| false | 45.454545 | [
"-A.sort()",
"-ans = \"YES\"",
"-for i in range(N - 1):",
"- if A[i] == A[i + 1]:",
"- ans = \"NO\"",
"- break",
"+ans = \"YES\" if len(set(A)) == N else \"NO\""
] | false | 0.11688 | 0.036246 | 3.224672 | [
"s607530785",
"s352400310"
] |
u392319141 | p02954 | python | s975900774 | s534378455 | 126 | 114 | 7,168 | 6,400 | Accepted | Accepted | 9.52 | S = eval(input())
N = len(S)
ans = [0] * N
dist = [0] * N
def ceil(x, y) :
return (x + y - 1) // y
nowIndex = 0
while nowIndex < N :
leftL = nowIndex
while leftL < N and S[leftL] == 'R' :
leftL += 1
nextR = leftL
while nextR < N and S[nextR] == 'L' :
nextR += 1
... | S = eval(input())
N = len(S)
ans = [1] * (N)
for i in range(N - 2):
if S[i] == 'L':
continue
if S[i + 1] == 'R':
ans[i + 2] += ans[i]
ans[i] = 0
for i in range(2, N)[:: -1]:
if S[i] == 'R':
continue
if S[i - 1] == 'L':
ans[i - 2] += ans[i]
... | 22 | 19 | 470 | 341 | S = eval(input())
N = len(S)
ans = [0] * N
dist = [0] * N
def ceil(x, y):
return (x + y - 1) // y
nowIndex = 0
while nowIndex < N:
leftL = nowIndex
while leftL < N and S[leftL] == "R":
leftL += 1
nextR = leftL
while nextR < N and S[nextR] == "L":
nextR += 1
ans[leftL - 1] = c... | S = eval(input())
N = len(S)
ans = [1] * (N)
for i in range(N - 2):
if S[i] == "L":
continue
if S[i + 1] == "R":
ans[i + 2] += ans[i]
ans[i] = 0
for i in range(2, N)[::-1]:
if S[i] == "R":
continue
if S[i - 1] == "L":
ans[i - 2] += ans[i]
ans[i] = 0
print(... | false | 13.636364 | [
"-ans = [0] * N",
"-dist = [0] * N",
"-",
"-",
"-def ceil(x, y):",
"- return (x + y - 1) // y",
"-",
"-",
"-nowIndex = 0",
"-while nowIndex < N:",
"- leftL = nowIndex",
"- while leftL < N and S[leftL] == \"R\":",
"- leftL += 1",
"- nextR = leftL",
"- while nextR < N... | false | 0.037169 | 0.0349 | 1.06502 | [
"s975900774",
"s534378455"
] |
u716530146 | p02793 | python | s240884967 | s627153208 | 1,883 | 1,017 | 4,464 | 131,884 | Accepted | Accepted | 45.99 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n=int(eval(input()))
A=list(map(int,input().split()))
def gcd(a, b):
while(b != 0):
... | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n=int(eval(input()))
A=list(map(int,input().split()))
def gcd(a, b):
while(b != 0):
... | 20 | 50 | 482 | 1,258 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n = int(eval(input()))
A = list(map(int, input().split()))
def gcd(a, b):
while b != 0:
a, b... | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n = int(eval(input()))
A = list(map(int, input().split()))
def gcd(a, b):
while b != 0:
a, b... | false | 60 | [
"+class InverseTable:",
"+ __slots__ = [\"In\", \"fac\", \"Ifac\"]",
"+",
"+ def __init__(self, mod, maxnum):",
"+ self.In = [0, 1]",
"+ self.fac = [1, 1]",
"+ self.Ifac = [1, 1]",
"+ for i in range(2, maxnum + 1):",
"+ self.fac.append((self.fac[-1] * i) ... | false | 0.035806 | 2.050101 | 0.017466 | [
"s240884967",
"s627153208"
] |
u423665486 | p03161 | python | s969296175 | s237334654 | 499 | 398 | 55,008 | 55,136 | Accepted | Accepted | 20.24 | def resolve():
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [float('inf')]*n
dp[0], dp[1] = 0, abs(h[0] - h[1])
for i in range(2, n):
s = []
for j in range(1, k+1):
if i-j >= 0:
s.append(dp[i-j] + abs(h[i-j] - h[i]))
dp[i] = min(s)
print((dp[-1]))
resolv... | def resolve():
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [float('inf')]*n
dp[0] = 0
for i in range(n):
for j in range(1, k+1):
if i + j < n:
dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j] - h[i]))
print((dp[-1]))
resolve() | 13 | 11 | 315 | 272 | def resolve():
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0], dp[1] = 0, abs(h[0] - h[1])
for i in range(2, n):
s = []
for j in range(1, k + 1):
if i - j >= 0:
s.append(dp[i - j] + abs(h[i - j] - h... | def resolve():
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0] = 0
for i in range(n):
for j in range(1, k + 1):
if i + j < n:
dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))
print((dp[-1]))
re... | false | 15.384615 | [
"- dp[0], dp[1] = 0, abs(h[0] - h[1])",
"- for i in range(2, n):",
"- s = []",
"+ dp[0] = 0",
"+ for i in range(n):",
"- if i - j >= 0:",
"- s.append(dp[i - j] + abs(h[i - j] - h[i]))",
"- dp[i] = min(s)",
"+ if i + j < n:",
"+ ... | false | 0.037886 | 0.089788 | 0.421951 | [
"s969296175",
"s237334654"
] |
u844646164 | p02765 | python | s621681825 | s101027801 | 21 | 18 | 3,316 | 2,940 | Accepted | Accepted | 14.29 | n, r = list(map(int, input().split()))
if n >= 10:
print(r)
else:
print((100*(10-n)+r))
| N, R = list(map(int, input().split()))
if N >= 10:
print(R)
else:
print((R + 100*(10-N))) | 5 | 5 | 88 | 89 | n, r = list(map(int, input().split()))
if n >= 10:
print(r)
else:
print((100 * (10 - n) + r))
| N, R = list(map(int, input().split()))
if N >= 10:
print(R)
else:
print((R + 100 * (10 - N)))
| false | 0 | [
"-n, r = list(map(int, input().split()))",
"-if n >= 10:",
"- print(r)",
"+N, R = list(map(int, input().split()))",
"+if N >= 10:",
"+ print(R)",
"- print((100 * (10 - n) + r))",
"+ print((R + 100 * (10 - N)))"
] | false | 0.155312 | 0.047833 | 3.246959 | [
"s621681825",
"s101027801"
] |
u624475441 | p03608 | python | s041748012 | s294426855 | 1,724 | 1,469 | 4,688 | 4,668 | Accepted | Accepted | 14.79 | from itertools import permutations
import sys
import gc
def main():
N, M, R = list(map(int, input().split()))
rs = [x - 1 for x in map(int, input().split())]
# グラフを作る
dist = [[float('inf')] * (N) for _ in range(N)]
for e in sys.stdin:
A, B, C = list(map(int, e.split()))
dis... | from itertools import permutations
import sys
def main():
N, M, R = list(map(int, input().split()))
rs = [x - 1 for x in map(int, input().split())]
# グラフを作る
dist = [[float('inf')] * (N) for _ in range(N)]
for e in sys.stdin:
A, B, C = list(map(int, e.split()))
dist[A - 1][B ... | 31 | 23 | 892 | 758 | from itertools import permutations
import sys
import gc
def main():
N, M, R = list(map(int, input().split()))
rs = [x - 1 for x in map(int, input().split())]
# グラフを作る
dist = [[float("inf")] * (N) for _ in range(N)]
for e in sys.stdin:
A, B, C = list(map(int, e.split()))
dist[A - 1]... | from itertools import permutations
import sys
def main():
N, M, R = list(map(int, input().split()))
rs = [x - 1 for x in map(int, input().split())]
# グラフを作る
dist = [[float("inf")] * (N) for _ in range(N)]
for e in sys.stdin:
A, B, C = list(map(int, e.split()))
dist[A - 1][B - 1] = ... | false | 25.806452 | [
"-import gc",
"- tmp = 0",
"- for u, v in zip(p, p[1:]):",
"- tmp += dist[u][v]",
"- if tmp > ans:",
"- break",
"- else:",
"- ans = tmp",
"+ ans = min(ans, sum(dist[u][v] for u, v in zip(p, p[1:])))",
"- gc.disable()"
] | false | 0.048451 | 0.04689 | 1.033305 | [
"s041748012",
"s294426855"
] |
u055875839 | p03478 | python | s115269800 | s451472469 | 38 | 28 | 3,060 | 2,940 | Accepted | Accepted | 26.32 | a, b, c = list(map(int, input().split()))
y = 0
for x in range(a):
if b <= sum(list(map(int, list(str(x+1))))) <= c:y += x + 1
print(y) | a, b, c = list(map(int, input().split()))
total = 0
for x in range(a+1):
z = x
d = 0
while z != 0:
d += z % 10
z = z // 10
if b <= d <= c:total += x
print(total)
| 6 | 11 | 136 | 183 | a, b, c = list(map(int, input().split()))
y = 0
for x in range(a):
if b <= sum(list(map(int, list(str(x + 1))))) <= c:
y += x + 1
print(y)
| a, b, c = list(map(int, input().split()))
total = 0
for x in range(a + 1):
z = x
d = 0
while z != 0:
d += z % 10
z = z // 10
if b <= d <= c:
total += x
print(total)
| false | 45.454545 | [
"-y = 0",
"-for x in range(a):",
"- if b <= sum(list(map(int, list(str(x + 1))))) <= c:",
"- y += x + 1",
"-print(y)",
"+total = 0",
"+for x in range(a + 1):",
"+ z = x",
"+ d = 0",
"+ while z != 0:",
"+ d += z % 10",
"+ z = z // 10",
"+ if b <= d <= c:",
... | false | 0.041035 | 0.066457 | 0.617468 | [
"s115269800",
"s451472469"
] |
u057109575 | p02911 | python | s097651030 | s881793782 | 600 | 191 | 54,616 | 80,980 | Accepted | Accepted | 68.17 | from collections import Counter
N, K, Q = list(map(int, input().split()))
ctr = Counter(int(eval(input())) for _ in range(Q))
for i in range(1, N + 1):
if K - Q + ctr[i] > 0:
print("Yes")
else:
print("No")
|
N, K, Q = list(map(int, input().split()))
X = [int(eval(input())) for _ in range(Q)]
cnt = [0] * N
for q in X:
cnt[q - 1] += 1
for i in range(N):
if Q - cnt[i] >= K:
print("No")
else:
print("Yes")
| 10 | 13 | 229 | 228 | from collections import Counter
N, K, Q = list(map(int, input().split()))
ctr = Counter(int(eval(input())) for _ in range(Q))
for i in range(1, N + 1):
if K - Q + ctr[i] > 0:
print("Yes")
else:
print("No")
| N, K, Q = list(map(int, input().split()))
X = [int(eval(input())) for _ in range(Q)]
cnt = [0] * N
for q in X:
cnt[q - 1] += 1
for i in range(N):
if Q - cnt[i] >= K:
print("No")
else:
print("Yes")
| false | 23.076923 | [
"-from collections import Counter",
"-",
"-ctr = Counter(int(eval(input())) for _ in range(Q))",
"-for i in range(1, N + 1):",
"- if K - Q + ctr[i] > 0:",
"+X = [int(eval(input())) for _ in range(Q)]",
"+cnt = [0] * N",
"+for q in X:",
"+ cnt[q - 1] += 1",
"+for i in range(N):",
"+ if Q... | false | 0.095169 | 0.037827 | 2.515937 | [
"s097651030",
"s881793782"
] |
u861141787 | p04044 | python | s435046808 | s852270470 | 167 | 18 | 38,256 | 3,060 | Accepted | Accepted | 89.22 | n, l = list(map(int, input().split()))
s = []
for _ in range(n):
s.append(eval(input()))
s.sort()
ans =''.join(s)
print(ans) | n, l = list(map(int, input().split()))
a = [eval(input()) for _ in range(n)]
a.sort()
ans =""
for i in range(n):
ans += a[i]
print(ans) | 11 | 10 | 130 | 136 | n, l = list(map(int, input().split()))
s = []
for _ in range(n):
s.append(eval(input()))
s.sort()
ans = "".join(s)
print(ans)
| n, l = list(map(int, input().split()))
a = [eval(input()) for _ in range(n)]
a.sort()
ans = ""
for i in range(n):
ans += a[i]
print(ans)
| false | 9.090909 | [
"-s = []",
"-for _ in range(n):",
"- s.append(eval(input()))",
"-s.sort()",
"-ans = \"\".join(s)",
"+a = [eval(input()) for _ in range(n)]",
"+a.sort()",
"+ans = \"\"",
"+for i in range(n):",
"+ ans += a[i]"
] | false | 0.047346 | 0.034435 | 1.374933 | [
"s435046808",
"s852270470"
] |
u323680411 | p03352 | python | s552333817 | s606665447 | 107 | 18 | 2,940 | 2,940 | Accepted | Accepted | 83.18 | x =int(eval(input()))
for n in range(x, 0, -1):
for b in range(1, n + 1):
for p in range(2, n + 1):
if b ** p == n:
print(n)
exit()
elif b ** p > n:
break
print((1))
| X = int(eval(input()))
ans = 1
for i in range(2, X + 1):
j = 2
while i ** j <= X:
ans = max(ans, i ** j)
j += 1
print(ans) | 10 | 10 | 251 | 151 | x = int(eval(input()))
for n in range(x, 0, -1):
for b in range(1, n + 1):
for p in range(2, n + 1):
if b**p == n:
print(n)
exit()
elif b**p > n:
break
print((1))
| X = int(eval(input()))
ans = 1
for i in range(2, X + 1):
j = 2
while i**j <= X:
ans = max(ans, i**j)
j += 1
print(ans)
| false | 0 | [
"-x = int(eval(input()))",
"-for n in range(x, 0, -1):",
"- for b in range(1, n + 1):",
"- for p in range(2, n + 1):",
"- if b**p == n:",
"- print(n)",
"- exit()",
"- elif b**p > n:",
"- break",
"-print((1))",
"+X = int... | false | 0.090727 | 0.096012 | 0.944956 | [
"s552333817",
"s606665447"
] |
u569960318 | p02386 | python | s576327788 | s159754689 | 200 | 170 | 7,944 | 7,948 | Accepted | Accepted | 15 | class dice:
def __init__(self,label):
self.label = {i+1: l for i,l in enumerate(label)}
def roll(self,op):
l = self.label
if op=='N': self.label = {1:l[2], 2:l[6], 3:l[3], 4:l[4], 5:l[1], 6:l[5]}
elif op=='E': self.label = {1:l[4], 2:l[2], 3:l[1], 4:l[6], 5:l[5], 6:l[3]}
... | class dice:
def __init__(self,label):
self.label = {i+1: l for i,l in enumerate(label)}
def roll(self,op):
l = self.label
if op=='N': self.label = {1:l[2], 2:l[6], 3:l[3], 4:l[4], 5:l[1], 6:l[5]}
elif op=='E': self.label = {1:l[4], 2:l[2], 3:l[1], 4:l[6], 5:l[5], 6:l[3]}
... | 50 | 57 | 1,751 | 1,962 | class dice:
def __init__(self, label):
self.label = {i + 1: l for i, l in enumerate(label)}
def roll(self, op):
l = self.label
if op == "N":
self.label = {1: l[2], 2: l[6], 3: l[3], 4: l[4], 5: l[1], 6: l[5]}
elif op == "E":
self.label = {1: l[4], 2: l[2]... | class dice:
def __init__(self, label):
self.label = {i + 1: l for i, l in enumerate(label)}
def roll(self, op):
l = self.label
if op == "N":
self.label = {1: l[2], 2: l[6], 3: l[3], 4: l[4], 5: l[1], 6: l[5]}
elif op == "E":
self.label = {1: l[4], 2: l[2]... | false | 12.280702 | [
"- n = int(eval(input()))",
"- d_list = [dice(list(map(int, input().split()))) for _ in range(n)]",
"+ d_grp = {}",
"+ for _ in range(int(eval(input()))):",
"+ d = dice(list(map(int, input().split())))",
"+ d_set = tuple(set(d.get_label()))",
"+ if d_set in d_grp:",
"+... | false | 0.06969 | 0.06112 | 1.140208 | [
"s576327788",
"s159754689"
] |
u706414019 | p03087 | python | s477569381 | s363301352 | 460 | 183 | 13,124 | 13,084 | Accepted | Accepted | 60.22 | def ss():
N,Q = list(map(int,input().split()))
s = eval(input())
lis=[0]*N
count = 0
for i in range(1,len(s)):
if s[i-1] == 'A' and s[i] == 'C':
count +=1
lis[i]+=count
for i in range(Q):
l,r = list(map(int,input().split()))
print((li... | import sys
input = sys.stdin.readline
N,Q = list(map(int,input().split()))
s = input().rstrip()
lis=[0]*N
count = 0
for i in range(1,len(s)):
if s[i-1] == 'A' and s[i] == 'C':
count +=1
lis[i]+=count
for i in range(Q):
l,r = list(map(int,input().split()))
print((lis[r-1]-lis[l-1])... | 15 | 14 | 337 | 320 | def ss():
N, Q = list(map(int, input().split()))
s = eval(input())
lis = [0] * N
count = 0
for i in range(1, len(s)):
if s[i - 1] == "A" and s[i] == "C":
count += 1
lis[i] += count
for i in range(Q):
l, r = list(map(int, input().split()))
print((lis[r ... | import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
s = input().rstrip()
lis = [0] * N
count = 0
for i in range(1, len(s)):
if s[i - 1] == "A" and s[i] == "C":
count += 1
lis[i] += count
for i in range(Q):
l, r = list(map(int, input().split()))
print((lis[r - 1] - lis[l... | false | 6.666667 | [
"-def ss():",
"- N, Q = list(map(int, input().split()))",
"- s = eval(input())",
"- lis = [0] * N",
"- count = 0",
"- for i in range(1, len(s)):",
"- if s[i - 1] == \"A\" and s[i] == \"C\":",
"- count += 1",
"- lis[i] += count",
"- for i in range(Q):",
... | false | 0.0681 | 0.068525 | 0.993799 | [
"s477569381",
"s363301352"
] |
u887207211 | p03251 | python | s861367228 | s497931823 | 20 | 17 | 3,060 | 3,060 | Accepted | Accepted | 15 | N, M, X, Y = list(map(int,input().split()))
x = sorted(list(map(int,input().split())))
y = sorted(list(map(int,input().split())))
for i in range(X+1, Y+1):
if(x[-1] < i <= y[0]):
print("No War")
break
else:
print("War") | def ans():
N, M, X, Y = list(map(int,input().split()))
x = sorted(list(map(int,input().split())))
y = sorted(list(map(int,input().split())))
for i in range(X+1, Y+1):
if(x[-1] < i <= y[0]):
print("No War")
break
else:
print("War")
ans() | 10 | 11 | 235 | 270 | N, M, X, Y = list(map(int, input().split()))
x = sorted(list(map(int, input().split())))
y = sorted(list(map(int, input().split())))
for i in range(X + 1, Y + 1):
if x[-1] < i <= y[0]:
print("No War")
break
else:
print("War")
| def ans():
N, M, X, Y = list(map(int, input().split()))
x = sorted(list(map(int, input().split())))
y = sorted(list(map(int, input().split())))
for i in range(X + 1, Y + 1):
if x[-1] < i <= y[0]:
print("No War")
break
else:
print("War")
ans()
| false | 9.090909 | [
"-N, M, X, Y = list(map(int, input().split()))",
"-x = sorted(list(map(int, input().split())))",
"-y = sorted(list(map(int, input().split())))",
"-for i in range(X + 1, Y + 1):",
"- if x[-1] < i <= y[0]:",
"- print(\"No War\")",
"- break",
"-else:",
"- print(\"War\")",
"+def an... | false | 0.063531 | 0.039029 | 1.627804 | [
"s861367228",
"s497931823"
] |
u077291787 | p03013 | python | s400377044 | s608552240 | 67 | 58 | 18,336 | 18,336 | Accepted | Accepted | 13.43 | # ABC129C - Typical Stairs
import sys
input = sys.stdin.readline
def main():
N, M = tuple(map(int, input().rstrip().split()))
A = set(map(int, [input().rstrip() for _ in range(M)]))
MOD = 10 ** 9 + 7
dp = [0] * (N + 1)
dp[:2] = 1, 1 if 1 not in A else 0
for i in range(2, N + 1):
... | # ABC129C - Typical Stairs
import sys
input = sys.stdin.readline
def main():
N, M = tuple(map(int, input().split()))
A = set(map(int, [eval(input()) for _ in range(M)]))
MOD = 10 ** 9 + 7
dp = [0] * (N + 1)
dp[:2] = 1, 1 if 1 not in A else 0
for i in range(2, N + 1):
if i in ... | 20 | 20 | 485 | 468 | # ABC129C - Typical Stairs
import sys
input = sys.stdin.readline
def main():
N, M = tuple(map(int, input().rstrip().split()))
A = set(map(int, [input().rstrip() for _ in range(M)]))
MOD = 10**9 + 7
dp = [0] * (N + 1)
dp[:2] = 1, 1 if 1 not in A else 0
for i in range(2, N + 1):
if i in... | # ABC129C - Typical Stairs
import sys
input = sys.stdin.readline
def main():
N, M = tuple(map(int, input().split()))
A = set(map(int, [eval(input()) for _ in range(M)]))
MOD = 10**9 + 7
dp = [0] * (N + 1)
dp[:2] = 1, 1 if 1 not in A else 0
for i in range(2, N + 1):
if i in A:
... | false | 0 | [
"- N, M = tuple(map(int, input().rstrip().split()))",
"- A = set(map(int, [input().rstrip() for _ in range(M)]))",
"+ N, M = tuple(map(int, input().split()))",
"+ A = set(map(int, [eval(input()) for _ in range(M)]))"
] | false | 0.041857 | 0.062657 | 0.668038 | [
"s400377044",
"s608552240"
] |
u185249212 | p03030 | python | s936487054 | s738787300 | 303 | 182 | 65,900 | 38,384 | Accepted | Accepted | 39.93 |
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
def lcm(n,m):
return int(n*m/gcd(n,m))
i... |
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
# import math
# import string
# import fractions
# from fractions import Fraction
# from fractions import gcd
# def lcm(n,m):
# return int(n*m/... | 56 | 56 | 1,032 | 1,076 | # import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
def lcm(n, m):
return int(n * m / gcd(n, m))
import ... | # import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
# import math
# import string
# import fractions
# from fractions import Fraction
# from fractions import gcd
# def lcm(n,m):
# return int(n*m/gcd(n,m))
# i... | false | 0 | [
"-import math",
"-import string",
"-import fractions",
"-from fractions import Fraction",
"-from fractions import gcd",
"-",
"-",
"-def lcm(n, m):",
"- return int(n * m / gcd(n, m))",
"-",
"-",
"-import re",
"-import array",
"-import copy",
"-import functools",
"-import operator",
... | false | 0.053641 | 0.097807 | 0.548434 | [
"s936487054",
"s738787300"
] |
u754022296 | p02794 | python | s717152009 | s196118711 | 1,991 | 435 | 42,876 | 42,988 | Accepted | Accepted | 78.15 | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
T = [[] for _ in range(n)]
D = {}
for i in range(n-1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
T[a].append(b)
T[b].append(a)
D[(a, b)] = 1<<i
D[(b, a)] = 1<<i
m = int(eval(input())... | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
T = [[] for _ in range(n)]
D = {}
for i in range(n-1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
T[a].append(b)
T[b].append(a)
D[(a, b)] = 1<<i
D[(b, a)] = 1<<i
m = int(eval(input())... | 56 | 65 | 1,092 | 1,528 | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
T = [[] for _ in range(n)]
D = {}
for i in range(n - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
T[a].append(b)
T[b].append(a)
D[(a, b)] = 1 << i
D[(b, a)] = 1... | import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
T = [[] for _ in range(n)]
D = {}
for i in range(n - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
T[a].append(b)
T[b].append(a)
D[(a, b)] = 1 << i
D[(b, a)] = 1... | false | 13.846154 | [
"+ def popcount(n):",
"+ c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)",
"+ c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)",
"+ c = (c & 0x0F0F0F0F0F0F0F0F) + ((c >> 4) & 0x0F0F0F0F0F0F0F0F)",
"+ c = (c & 0x00FF00FF00FF00FF) + ((c >> 8) & 0x00F... | false | 0.076864 | 0.041425 | 1.855497 | [
"s717152009",
"s196118711"
] |
u638795007 | p03475 | python | s788370841 | s182766325 | 209 | 87 | 41,328 | 6,756 | Accepted | Accepted | 58.37 | def examC():
N = I()
C = [0]*N; S =[0]*N; F = [0]*N
for i in range(N-1):
C[i], S[i], F[i] = LI()
ans = []
for i in range(N):
cur = 0
for j in range(i,N-1):
cur = max(((cur-1)//F[j] +1)*F[j],S[j])+C[j]
ans.append(cur)
for v in ans:
p... | def examA():
C1 = SI()
C2 = SI()
ans = "YES"
if C1[0]!=C2[2] or C1[1]!=C2[1] or C1[2]!=C2[0]:
ans = "NO"
print(ans)
return
def examB():
A, B, C, X, Y = LI()
loop = max(X,Y)
ans = inf
for i in range(loop+1):
cost = i*2*C
if X>i:
... | 25 | 105 | 716 | 2,297 | def examC():
N = I()
C = [0] * N
S = [0] * N
F = [0] * N
for i in range(N - 1):
C[i], S[i], F[i] = LI()
ans = []
for i in range(N):
cur = 0
for j in range(i, N - 1):
cur = max(((cur - 1) // F[j] + 1) * F[j], S[j]) + C[j]
ans.append(cur)
for v i... | def examA():
C1 = SI()
C2 = SI()
ans = "YES"
if C1[0] != C2[2] or C1[1] != C2[1] or C1[2] != C2[0]:
ans = "NO"
print(ans)
return
def examB():
A, B, C, X, Y = LI()
loop = max(X, Y)
ans = inf
for i in range(loop + 1):
cost = i * 2 * C
if X > i:
... | false | 76.190476 | [
"+def examA():",
"+ C1 = SI()",
"+ C2 = SI()",
"+ ans = \"YES\"",
"+ if C1[0] != C2[2] or C1[1] != C2[1] or C1[2] != C2[0]:",
"+ ans = \"NO\"",
"+ print(ans)",
"+ return",
"+",
"+",
"+def examB():",
"+ A, B, C, X, Y = LI()",
"+ loop = max(X, Y)",
"+ ans = ... | false | 0.058113 | 0.041713 | 1.393157 | [
"s788370841",
"s182766325"
] |
u283929013 | p02779 | python | s009705579 | s948266569 | 179 | 106 | 26,676 | 31,056 | Accepted | Accepted | 40.78 | N = int(eval(input()))
A = list(map(int,input().split()))
flag = True
A.sort()
for i in range(1,len(A)):
if A[i-1] == A[i]:
flag = False
if flag:
print("YES")
else:
print("NO") | n = int(eval(input()))
a = list(map(int,input().split()))
a = len(list(set(a)))
if n == a:
print("YES")
else:
print("NO") | 12 | 7 | 192 | 129 | N = int(eval(input()))
A = list(map(int, input().split()))
flag = True
A.sort()
for i in range(1, len(A)):
if A[i - 1] == A[i]:
flag = False
if flag:
print("YES")
else:
print("NO")
| n = int(eval(input()))
a = list(map(int, input().split()))
a = len(list(set(a)))
if n == a:
print("YES")
else:
print("NO")
| false | 41.666667 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-flag = True",
"-A.sort()",
"-for i in range(1, len(A)):",
"- if A[i - 1] == A[i]:",
"- flag = False",
"-if flag:",
"+n = int(eval(input()))",
"+a = list(map(int, input().split()))",
"+a = len(list(set(a)))",
"+if n ... | false | 0.08444 | 0.11386 | 0.741613 | [
"s009705579",
"s948266569"
] |
u272557899 | p02713 | python | s207296665 | s411291938 | 1,547 | 688 | 86,048 | 88,860 | Accepted | Accepted | 55.53 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from functools import reduce
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
f... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from functools import reduce
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
f... | 45 | 56 | 1,845 | 2,013 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from functools import reduce
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bi... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from functools import reduce
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bi... | false | 19.642857 | [
"-for a in range(1, K + 1):",
"- for b in range(1, K + 1):",
"- for c in range(1, K + 1):",
"- sigma += gcd_list([a, b, c])",
"+nums = [i for i in range(1, K + 1)]",
"+for abc in itertools.combinations_with_replacement(nums, 3): # 重複組み合わせ,200H3",
"+ tmp = gcd_list(abc)",
"+ ... | false | 0.083677 | 0.079965 | 1.04642 | [
"s207296665",
"s411291938"
] |
u191874006 | p02918 | python | s893738946 | s417683414 | 186 | 172 | 39,536 | 39,408 | Accepted | Accepted | 7.53 | #!/usr/bin/env python3
#ABC140 D
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import ite... | #!/usr/bin/env python3
#ABC140 D
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import ite... | 32 | 27 | 781 | 683 | #!/usr/bin/env python3
# ABC140 D
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
fr... | #!/usr/bin/env python3
# ABC140 D
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
fr... | false | 15.625 | [
"+# (n-1) - 異なっているグループの個数(グループの個数-1)",
"-score = 0",
"-for i in range(n):",
"- if s[i] == \"L\":",
"- if i > 0:",
"- if s[i - 1] == \"L\":",
"- score += 1",
"- else:",
"- if i < n - 1:",
"- if s[i + 1] == \"R\":",
"- score +... | false | 0.04864 | 0.049296 | 0.98671 | [
"s893738946",
"s417683414"
] |
u261103969 | p02755 | python | s545364323 | s187829889 | 183 | 23 | 38,640 | 3,064 | Accepted | Accepted | 87.43 | # import bisect
# from collections import Counter, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
import math
import sys
# import numpy as np
ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF... | a, b = list(map(int, input().split()))
ans = -1 # 答えが見つからなかった場合の-1を初期値にしておく
for price in range(10000):
tax_a = int(price * 0.08)
tax_b = int(price * 0.1)
if tax_a == a and tax_b == b:
ans = price
break
print(ans) | 33 | 12 | 683 | 254 | # import bisect
# from collections import Counter, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
import math
import sys
# import numpy as np
ipti = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys... | a, b = list(map(int, input().split()))
ans = -1 # 答えが見つからなかった場合の-1を初期値にしておく
for price in range(10000):
tax_a = int(price * 0.08)
tax_b = int(price * 0.1)
if tax_a == a and tax_b == b:
ans = price
break
print(ans)
| false | 63.636364 | [
"-# import bisect",
"-# from collections import Counter, deque",
"-# import copy",
"-# from heapq import heappush, heappop, heapify",
"-# from fractions import gcd",
"-# import itertools",
"-# from operator import attrgetter, itemgetter",
"-import math",
"-import sys",
"-",
"-# import numpy as n... | false | 0.051203 | 0.038909 | 1.315966 | [
"s545364323",
"s187829889"
] |
u030879708 | p02658 | python | s936043840 | s689574833 | 89 | 76 | 19,404 | 19,408 | Accepted | Accepted | 14.61 | a=1;d=10**18
for i in[*open(0)][1].split():a=min(a*int(i),d+1)
print(([a,-1][a>d])) | a=1
for i in[*open(0)][1].split():a*=int(i);a=[-1,a][-2<a-1<1e18]
print(a) | 3 | 3 | 83 | 76 | a = 1
d = 10**18
for i in [*open(0)][1].split():
a = min(a * int(i), d + 1)
print(([a, -1][a > d]))
| a = 1
for i in [*open(0)][1].split():
a *= int(i)
a = [-1, a][-2 < a - 1 < 1e18]
print(a)
| false | 0 | [
"-d = 10**18",
"- a = min(a * int(i), d + 1)",
"-print(([a, -1][a > d]))",
"+ a *= int(i)",
"+ a = [-1, a][-2 < a - 1 < 1e18]",
"+print(a)"
] | false | 0.046193 | 0.046159 | 1.000735 | [
"s936043840",
"s689574833"
] |
u442877951 | p03999 | python | s219738336 | s695083517 | 37 | 29 | 3,060 | 3,064 | Accepted | Accepted | 21.62 | S = str(eval(input()))
ans = 0
N = len(S)
for i in range(2**N):
pattern = bin(i)[2:].zfill(N)
formula = ''
for j in range(N):
mark = ''
if pattern[j] == '1' and j < N-1:
mark = '+'
formula += S[j]+mark
ans += eval(formula)
print((ans//2)) | S = str(eval(input()))
ans = 0
N = len(S)
for i in range(2**(N-1)):
pattern = bin(i)[2:].zfill((N-1))
formula = ''
for j in range(N):
mark = ''
if j < N-1:
if pattern[j] == '1':
mark = '+'
formula += S[j]+mark
ans += eval(formula)
print(ans) | 15 | 17 | 272 | 288 | S = str(eval(input()))
ans = 0
N = len(S)
for i in range(2**N):
pattern = bin(i)[2:].zfill(N)
formula = ""
for j in range(N):
mark = ""
if pattern[j] == "1" and j < N - 1:
mark = "+"
formula += S[j] + mark
ans += eval(formula)
print((ans // 2))
| S = str(eval(input()))
ans = 0
N = len(S)
for i in range(2 ** (N - 1)):
pattern = bin(i)[2:].zfill((N - 1))
formula = ""
for j in range(N):
mark = ""
if j < N - 1:
if pattern[j] == "1":
mark = "+"
formula += S[j] + mark
ans += eval(formula)
print(ans)
| false | 11.764706 | [
"-for i in range(2**N):",
"- pattern = bin(i)[2:].zfill(N)",
"+for i in range(2 ** (N - 1)):",
"+ pattern = bin(i)[2:].zfill((N - 1))",
"- if pattern[j] == \"1\" and j < N - 1:",
"- mark = \"+\"",
"+ if j < N - 1:",
"+ if pattern[j] == \"1\":",
"+ ... | false | 0.041273 | 0.038933 | 1.060112 | [
"s219738336",
"s695083517"
] |
u512212329 | p02602 | python | s546284386 | s350574406 | 127 | 97 | 31,548 | 31,676 | Accepted | Accepted | 23.62 | def main():
n, k = [int(x) for x in input().split()]
scores = [int(x) for x in input().split()]
for index, new in enumerate(scores[k:]):
# zip にすると2つのリストを作るのか,これよりも少し時間とメモリ増。
print(('Yes' if scores[index] < new else 'No'))
if __name__ == '__main__':
main()
| def main():
n, k = [int(x) for x in input().split()]
scores = [int(x) for x in input().split()]
# zip にすると2つのリストを作るのか,これよりも少し時間とメモリ増。
print(('\n'.join('Yes' if scores[index] < new else 'No'
for index, new in enumerate(scores[k:]))))
if __name__ == '__main__':
main()
| 10 | 10 | 298 | 316 | def main():
n, k = [int(x) for x in input().split()]
scores = [int(x) for x in input().split()]
for index, new in enumerate(scores[k:]):
# zip にすると2つのリストを作るのか,これよりも少し時間とメモリ増。
print(("Yes" if scores[index] < new else "No"))
if __name__ == "__main__":
main()
| def main():
n, k = [int(x) for x in input().split()]
scores = [int(x) for x in input().split()]
# zip にすると2つのリストを作るのか,これよりも少し時間とメモリ増。
print(
(
"\n".join(
"Yes" if scores[index] < new else "No"
for index, new in enumerate(scores[k:])
)
... | false | 0 | [
"- for index, new in enumerate(scores[k:]):",
"- # zip にすると2つのリストを作るのか,これよりも少し時間とメモリ増。",
"- print((\"Yes\" if scores[index] < new else \"No\"))",
"+ # zip にすると2つのリストを作るのか,これよりも少し時間とメモリ増。",
"+ print(",
"+ (",
"+ \"\\n\".join(",
"+ \"Yes\" if score... | false | 0.045032 | 0.043666 | 1.031294 | [
"s546284386",
"s350574406"
] |
u609061751 | p03031 | python | s957414588 | s072978397 | 202 | 30 | 41,200 | 3,064 | Accepted | Accepted | 85.15 | N, M = list(map(int,input().split()))
s = []
ans = 0
for _ in range(M):
temp = list(map(int, input().split()))
s.append(temp[1:])
p = list(map(int, input().split()))
for i in range(2 ** N):
flag = 1
flag_1 = 1
sw = bin(i)[2:]
sw = sw.zfill(N)
for j in range(M):
sumsw = 0... | import sys
input = sys.stdin.readline
N, M = [int(x) for x in input().split()]
k = []
s = []
for _ in range(M):
tmp = [int(x) for x in input().split()]
k.append(tmp[0])
s.append(tmp[1:])
p = [int(x) for x in input().split()]
ans = 0
for i in range(2 ** N):
flag = 1
for j in range(... | 25 | 28 | 563 | 509 | N, M = list(map(int, input().split()))
s = []
ans = 0
for _ in range(M):
temp = list(map(int, input().split()))
s.append(temp[1:])
p = list(map(int, input().split()))
for i in range(2**N):
flag = 1
flag_1 = 1
sw = bin(i)[2:]
sw = sw.zfill(N)
for j in range(M):
sumsw = 0
for k... | import sys
input = sys.stdin.readline
N, M = [int(x) for x in input().split()]
k = []
s = []
for _ in range(M):
tmp = [int(x) for x in input().split()]
k.append(tmp[0])
s.append(tmp[1:])
p = [int(x) for x in input().split()]
ans = 0
for i in range(2**N):
flag = 1
for j in range(M):
cnt = 0
... | false | 10.714286 | [
"-N, M = list(map(int, input().split()))",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+N, M = [int(x) for x in input().split()]",
"+k = []",
"+for _ in range(M):",
"+ tmp = [int(x) for x in input().split()]",
"+ k.append(tmp[0])",
"+ s.append(tmp[1:])",
"+p = [int(x) for x in i... | false | 0.055171 | 0.042454 | 1.29957 | [
"s957414588",
"s072978397"
] |
u837811962 | p02315 | python | s149304602 | s140710109 | 1,020 | 790 | 27,804 | 7,936 | Accepted | Accepted | 22.55 | N,W = list(map(int,input().split()))
v = [0]*N;w = [0]*N
for i in range(N):
v[i],w[i] = list(map(int,input().split()))
value = [[0 for i in range(W+1)] for i in range(N)]
for i in range(N):
for j in range(1,W+1):
if j<w[i]:
value[i][j] = value[i-1][j]
else:
... | N,W = list(map(int,input().split()))
v = [0]*N;w = [0]*N
for i in range(N):
v[i],w[i] = list(map(int,input().split()))
value = [0 for i in range(W+1)]
for i in range(N):
for j in range(W,-1,-1):
if j<w[i]:
value[j] = value[j]
else:
value[j] = max(value[j],va... | 16 | 15 | 390 | 344 | N, W = list(map(int, input().split()))
v = [0] * N
w = [0] * N
for i in range(N):
v[i], w[i] = list(map(int, input().split()))
value = [[0 for i in range(W + 1)] for i in range(N)]
for i in range(N):
for j in range(1, W + 1):
if j < w[i]:
value[i][j] = value[i - 1][j]
else:
... | N, W = list(map(int, input().split()))
v = [0] * N
w = [0] * N
for i in range(N):
v[i], w[i] = list(map(int, input().split()))
value = [0 for i in range(W + 1)]
for i in range(N):
for j in range(W, -1, -1):
if j < w[i]:
value[j] = value[j]
else:
value[j] = max(value[j], v... | false | 6.25 | [
"-value = [[0 for i in range(W + 1)] for i in range(N)]",
"+value = [0 for i in range(W + 1)]",
"- for j in range(1, W + 1):",
"+ for j in range(W, -1, -1):",
"- value[i][j] = value[i - 1][j]",
"+ value[j] = value[j]",
"- value[i][j] = max(value[i - 1][j], value[i ... | false | 0.042903 | 0.033766 | 1.270575 | [
"s149304602",
"s140710109"
] |
u102461423 | p02952 | python | s429024693 | s612344405 | 56 | 45 | 2,940 | 3,060 | Accepted | Accepted | 19.64 | N = int(eval(input()))
answer = 0
for x in range(1,N+1):
if len(str(x)) & 1:
answer += 1
print(answer) | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
answer = sum(len(str(x))&1 for x in range(1,N+1))
print(answer) | 8 | 9 | 125 | 209 | N = int(eval(input()))
answer = 0
for x in range(1, N + 1):
if len(str(x)) & 1:
answer += 1
print(answer)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
answer = sum(len(str(x)) & 1 for x in range(1, N + 1))
print(answer)
| false | 11.111111 | [
"-N = int(eval(input()))",
"-answer = 0",
"-for x in range(1, N + 1):",
"- if len(str(x)) & 1:",
"- answer += 1",
"+import sys",
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+N = int(readline())",
"+answer ... | false | 0.114231 | 0.108965 | 1.048328 | [
"s429024693",
"s612344405"
] |
u232852711 | p03732 | python | s817138631 | s742706738 | 348 | 80 | 3,064 | 4,072 | Accepted | Accepted | 77.01 | n, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
w0 = wv[0][0]
wv_dict = {w0:[], w0+1:[], w0+2:[], w0+3:[]}
for w, v in wv:
wv_dict[w].append(v)
for w, vs in list(wv_dict.items()):
vs = sorted(vs)[::-1]
wv_dict[w] = [0]
for v in vs:
wv_d... | from collections import defaultdict
n, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
dp = defaultdict(int)
dp[0] = 0
for w, v in wv:
dp_cur = list(dp.items())
for w_cur, v_cur in dp_cur:
if w_cur+w <= W:
dp[w_cur+w] = max(dp[w_cur+w],... | 24 | 14 | 763 | 369 | n, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
w0 = wv[0][0]
wv_dict = {w0: [], w0 + 1: [], w0 + 2: [], w0 + 3: []}
for w, v in wv:
wv_dict[w].append(v)
for w, vs in list(wv_dict.items()):
vs = sorted(vs)[::-1]
wv_dict[w] = [0]
for v in vs:
wv_dic... | from collections import defaultdict
n, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
dp = defaultdict(int)
dp[0] = 0
for w, v in wv:
dp_cur = list(dp.items())
for w_cur, v_cur in dp_cur:
if w_cur + w <= W:
dp[w_cur + w] = max(dp[w_cur + w], v_c... | false | 41.666667 | [
"+from collections import defaultdict",
"+",
"-w0 = wv[0][0]",
"-wv_dict = {w0: [], w0 + 1: [], w0 + 2: [], w0 + 3: []}",
"+dp = defaultdict(int)",
"+dp[0] = 0",
"- wv_dict[w].append(v)",
"-for w, vs in list(wv_dict.items()):",
"- vs = sorted(vs)[::-1]",
"- wv_dict[w] = [0]",
"- for ... | false | 0.058766 | 0.05935 | 0.990159 | [
"s817138631",
"s742706738"
] |
u876705760 | p03074 | python | s117817146 | s652515030 | 176 | 138 | 7,164 | 7,328 | Accepted | Accepted | 21.59 | N, k = list(map(int, input().split()))
s = eval(input())
l, accum = len(s), []
i = 0
while i < l:
ch = s[i]
count = 0
while i < l and s[i] == ch:
count += 1
i += 1
accum.append(count)
l = len(ac... | N, k = list(map(int, input().split()))
s = eval(input())
l, accum = len(s), []
zeros, ones = [], []
if s[0] == '0':
ones = [0]
i = 0
while i < l:
ch = s[i]
if ch == '0':
count = 0
while i < l and s[i] =... | 24 | 28 | 578 | 808 | N, k = list(map(int, input().split()))
s = eval(input())
l, accum = len(s), []
i = 0
while i < l:
ch = s[i]
count = 0
while i < l and s[i] == ch:
count += 1
i += 1
accum.append(count)
l = len(accum)
for i in range(1, l):
accum[i] += accum[i - 1]
mx = accum[min(2 * k - (1 - int(s[0]))... | N, k = list(map(int, input().split()))
s = eval(input())
l, accum = len(s), []
zeros, ones = [], []
if s[0] == "0":
ones = [0]
i = 0
while i < l:
ch = s[i]
if ch == "0":
count = 0
while i < l and s[i] == ch:
count += 1
i += 1
zeros.append(count)
elif ch ==... | false | 14.285714 | [
"+zeros, ones = [], []",
"+if s[0] == \"0\":",
"+ ones = [0]",
"- count = 0",
"- while i < l and s[i] == ch:",
"- count += 1",
"- i += 1",
"- accum.append(count)",
"-l = len(accum)",
"-for i in range(1, l):",
"- accum[i] += accum[i - 1]",
"-mx = accum[min(2 * k - (... | false | 0.120422 | 0.041211 | 2.922098 | [
"s117817146",
"s652515030"
] |
u219197917 | p02695 | python | s482914321 | s697680499 | 767 | 674 | 23,036 | 9,124 | Accepted | Accepted | 12.13 | def comb(k, s, r):
if k == n:
r.append(s[1:])
return
for ai in range(s[-1], m + 1):
comb(k + 1, s + [ai], r)
return r
def main():
abcd = [[int(i) for i in input().split()] for _ in range(q)]
s = 0
for p in comb(0, [1], []):
t = 0
for a, b, c,... | def main(k, s):
if k == n:
return sum(d * (s[b] - s[a] == c) for a, b, c, d in abcd)
return max(main(k + 1, s + [ai]) for ai in range(s[-1], m + 1))
if __name__ == '__main__':
n, m, q = list(map(int, input().split()))
abcd = [[int(i) for i in input().split()] for _ in range(q)]
prin... | 21 | 9 | 500 | 329 | def comb(k, s, r):
if k == n:
r.append(s[1:])
return
for ai in range(s[-1], m + 1):
comb(k + 1, s + [ai], r)
return r
def main():
abcd = [[int(i) for i in input().split()] for _ in range(q)]
s = 0
for p in comb(0, [1], []):
t = 0
for a, b, c, d in abcd:
... | def main(k, s):
if k == n:
return sum(d * (s[b] - s[a] == c) for a, b, c, d in abcd)
return max(main(k + 1, s + [ai]) for ai in range(s[-1], m + 1))
if __name__ == "__main__":
n, m, q = list(map(int, input().split()))
abcd = [[int(i) for i in input().split()] for _ in range(q)]
print((main... | false | 57.142857 | [
"-def comb(k, s, r):",
"+def main(k, s):",
"- r.append(s[1:])",
"- return",
"- for ai in range(s[-1], m + 1):",
"- comb(k + 1, s + [ai], r)",
"- return r",
"-",
"-",
"-def main():",
"- abcd = [[int(i) for i in input().split()] for _ in range(q)]",
"- s = 0",
... | false | 0.171997 | 0.090245 | 1.90589 | [
"s482914321",
"s697680499"
] |
u130900604 | p02714 | python | s613995427 | s959657014 | 1,675 | 168 | 9,192 | 67,992 | Accepted | Accepted | 89.97 | n=int(eval(input()))
s=eval(input())
ans=s.count("R")*s.count("G")*s.count("B")
for j in range(n):
for i in range(j):
if (k:=2*j-i)<n:
if s[i]!=s[k]!=s[j]!=s[i]:
ans-=1
print(ans) | n=int(eval(input()))
s=eval(input())
ans=s.count("R")*s.count("G")*s.count("B")
for j in range(n):
J=s[j]
for i in range(j):
k=2*j-i
if k<n:
I=s[i]
K=s[k]
if I!=J!=K!=I:
ans-=1
print(ans) | 9 | 13 | 198 | 228 | n = int(eval(input()))
s = eval(input())
ans = s.count("R") * s.count("G") * s.count("B")
for j in range(n):
for i in range(j):
if (k := 2 * j - i) < n:
if s[i] != s[k] != s[j] != s[i]:
ans -= 1
print(ans)
| n = int(eval(input()))
s = eval(input())
ans = s.count("R") * s.count("G") * s.count("B")
for j in range(n):
J = s[j]
for i in range(j):
k = 2 * j - i
if k < n:
I = s[i]
K = s[k]
if I != J != K != I:
ans -= 1
print(ans)
| false | 30.769231 | [
"+ J = s[j]",
"- if (k := 2 * j - i) < n:",
"- if s[i] != s[k] != s[j] != s[i]:",
"+ k = 2 * j - i",
"+ if k < n:",
"+ I = s[i]",
"+ K = s[k]",
"+ if I != J != K != I:"
] | false | 0.044528 | 0.007639 | 5.82904 | [
"s613995427",
"s959657014"
] |
u397638621 | p02701 | python | s409948484 | s255699365 | 283 | 259 | 30,964 | 31,152 | Accepted | Accepted | 8.48 | N = int(eval(input()))
S = set(str(eval(input())) for _ in range(N))
print((len(S))) | N = int(eval(input()))
S = set(eval(input()) for i in range(N))
print((len(S))) | 3 | 3 | 72 | 67 | N = int(eval(input()))
S = set(str(eval(input())) for _ in range(N))
print((len(S)))
| N = int(eval(input()))
S = set(eval(input()) for i in range(N))
print((len(S)))
| false | 0 | [
"-S = set(str(eval(input())) for _ in range(N))",
"+S = set(eval(input()) for i in range(N))"
] | false | 0.068336 | 0.043335 | 1.576918 | [
"s409948484",
"s255699365"
] |
u287132915 | p02720 | python | s538653198 | s111517664 | 1,704 | 69 | 14,788 | 6,096 | Accepted | Accepted | 95.95 | k = int(eval(input()))
def hantei(n):
string = str(n)
length = len(string)
ret = True
for i in range(length-1):
if abs(int(string[i]) - int(string[i+1])) > 1:
ret = False
break
return ret
lst = [i for i in range(10)]
dic = {}
dic[1] = lst.copy()
keta ... | from collections import deque
k = int(eval(input()))
if 1 <= k and k <= 9:
print(k)
exit()
d = deque([i for i in range(1, 10)])
k -= 9
while k > 0:
num = d.popleft()
if num % 10 != 0:
new = 10*num + (num%10) - 1
d.append(new)
k -= 1
if k == 0: break
... | 35 | 28 | 816 | 531 | k = int(eval(input()))
def hantei(n):
string = str(n)
length = len(string)
ret = True
for i in range(length - 1):
if abs(int(string[i]) - int(string[i + 1])) > 1:
ret = False
break
return ret
lst = [i for i in range(10)]
dic = {}
dic[1] = lst.copy()
keta = 2
while... | from collections import deque
k = int(eval(input()))
if 1 <= k and k <= 9:
print(k)
exit()
d = deque([i for i in range(1, 10)])
k -= 9
while k > 0:
num = d.popleft()
if num % 10 != 0:
new = 10 * num + (num % 10) - 1
d.append(new)
k -= 1
if k == 0:
break
n... | false | 20 | [
"+from collections import deque",
"+",
"-",
"-",
"-def hantei(n):",
"- string = str(n)",
"- length = len(string)",
"- ret = True",
"- for i in range(length - 1):",
"- if abs(int(string[i]) - int(string[i + 1])) > 1:",
"- ret = False",
"+if 1 <= k and k <= 9:",
"... | false | 0.56409 | 0.037997 | 14.845849 | [
"s538653198",
"s111517664"
] |
u347640436 | p02990 | python | s271662129 | s411013892 | 965 | 34 | 98,056 | 3,188 | Accepted | Accepted | 96.48 | # パスカルの三角形
N, K = list(map(int, input().split()))
n = max(K, N - K + 1)
c = [[0] * (n + 1) for _ in range(n + 1)]
c[0][0] = 1
for i in range(1, n + 1):
c[i][0] = 1
for j in range(1, i + 1):
c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % 1000000007
result = []
for i in range(1, K + 1):
re... | # フェルマーの小定理
N, K = list(map(int, input().split()))
n = max(K, N - K + 1)
fac = [0] * (n + 1)
fac[0] = 1
for i in range(n):
fac[i + 1] = fac[i] * (i + 1) % 1000000007
def mcomb(n, k):
if n == 0 and k == 0:
return 1
if n < k or k < 0:
return 0
return fac[n] * pow(fac[n - ... | 15 | 22 | 416 | 554 | # パスカルの三角形
N, K = list(map(int, input().split()))
n = max(K, N - K + 1)
c = [[0] * (n + 1) for _ in range(n + 1)]
c[0][0] = 1
for i in range(1, n + 1):
c[i][0] = 1
for j in range(1, i + 1):
c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % 1000000007
result = []
for i in range(1, K + 1):
result.append(c[K... | # フェルマーの小定理
N, K = list(map(int, input().split()))
n = max(K, N - K + 1)
fac = [0] * (n + 1)
fac[0] = 1
for i in range(n):
fac[i + 1] = fac[i] * (i + 1) % 1000000007
def mcomb(n, k):
if n == 0 and k == 0:
return 1
if n < k or k < 0:
return 0
return (
fac[n]
* pow(fac[n ... | false | 31.818182 | [
"-# パスカルの三角形",
"+# フェルマーの小定理",
"-c = [[0] * (n + 1) for _ in range(n + 1)]",
"-c[0][0] = 1",
"-for i in range(1, n + 1):",
"- c[i][0] = 1",
"- for j in range(1, i + 1):",
"- c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % 1000000007",
"+fac = [0] * (n + 1)",
"+fac[0] = 1",
"+for i in ra... | false | 0.920869 | 0.037552 | 24.52247 | [
"s271662129",
"s411013892"
] |
u311379832 | p02743 | python | s466594850 | s249469270 | 36 | 17 | 5,076 | 3,064 | Accepted | Accepted | 52.78 |
from decimal import Decimal
a, b, c = list(map(int, input().split()))
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print('Yes')
else:
print('No') | a, b, c = list(map(int, input().split()))
if 4 * a * b < (c - a - b) ** 2 and c - a - b > 0:
print('Yes')
else:
print('No') | 7 | 6 | 171 | 131 | from decimal import Decimal
a, b, c = list(map(int, input().split()))
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
print("Yes")
else:
print("No")
| a, b, c = list(map(int, input().split()))
if 4 * a * b < (c - a - b) ** 2 and c - a - b > 0:
print("Yes")
else:
print("No")
| false | 14.285714 | [
"-from decimal import Decimal",
"-",
"-if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():",
"+if 4 * a * b < (c - a - b) ** 2 and c - a - b > 0:"
] | false | 0.050402 | 0.047378 | 1.063808 | [
"s466594850",
"s249469270"
] |
u583507988 | p03470 | python | s660277631 | s441710423 | 32 | 25 | 9,104 | 9,164 | Accepted | Accepted | 21.88 | n = int(eval(input()))
d = []
ans = 0
for i in range(n):
d_ = int(eval(input()))
if d_ not in d:
d.append(d_)
ans += 1
print(ans) | n = int(eval(input()))
d = [int(eval(input())) for i in range(n)]
ds = set(d)
print((len(ds))) | 9 | 4 | 137 | 83 | n = int(eval(input()))
d = []
ans = 0
for i in range(n):
d_ = int(eval(input()))
if d_ not in d:
d.append(d_)
ans += 1
print(ans)
| n = int(eval(input()))
d = [int(eval(input())) for i in range(n)]
ds = set(d)
print((len(ds)))
| false | 55.555556 | [
"-d = []",
"-ans = 0",
"-for i in range(n):",
"- d_ = int(eval(input()))",
"- if d_ not in d:",
"- d.append(d_)",
"- ans += 1",
"-print(ans)",
"+d = [int(eval(input())) for i in range(n)]",
"+ds = set(d)",
"+print((len(ds)))"
] | false | 0.046214 | 0.092835 | 0.497809 | [
"s660277631",
"s441710423"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.