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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u072053884 | p02366 | python | s667716378 | s740219663 | 2,140 | 170 | 18,208 | 13,284 | Accepted | Accepted | 92.06 | # Acceptance of input
import sys
f_i = sys.stdin
V, E = map(int, f_i.readline().split())
adj_sets = [set() for i in range(V)]
for l_i in f_i:
s, t = map(int, l_i.split())
adj_sets[s].add(t)
adj_sets[t].add(s)
# dfs traverse
prenum = [0] * V
parent = [0] * V
lowest = [V] * V
im... | # Acceptance of input
import sys
f_i = sys.stdin
V, E = map(int, f_i.readline().split())
adj = [[] for i in range(V)]
for l_i in f_i:
s, t = map(int, l_i.split())
adj[s].append(t)
adj[t].append(s)
# dfs traverse
prenum = [1] + [None] * (V - 1)
parent = [0] * V
lowest = [V] * V
... | 72 | 70 | 1,256 | 1,198 | # Acceptance of input
import sys
f_i = sys.stdin
V, E = map(int, f_i.readline().split())
adj_sets = [set() for i in range(V)]
for l_i in f_i:
s, t = map(int, l_i.split())
adj_sets[s].add(t)
adj_sets[t].add(s)
# dfs traverse
prenum = [0] * V
parent = [0] * V
lowest = [V] * V
import collections
path = colle... | # Acceptance of input
import sys
f_i = sys.stdin
V, E = map(int, f_i.readline().split())
adj = [[] for i in range(V)]
for l_i in f_i:
s, t = map(int, l_i.split())
adj[s].append(t)
adj[t].append(s)
# dfs traverse
prenum = [1] + [None] * (V - 1)
parent = [0] * V
lowest = [V] * V
import collections
path = co... | false | 2.777778 | [
"-adj_sets = [set() for i in range(V)]",
"+adj = [[] for i in range(V)]",
"- adj_sets[s].add(t)",
"- adj_sets[t].add(s)",
"+ adj[s].append(t)",
"+ adj[t].append(s)",
"-prenum = [0] * V",
"+prenum = [1] + [None] * (V - 1)",
"-cnt = 0",
"+cnt = 1",
"- adj_v = adj_sets[u].copy()",
... | false | 0.080961 | 0.037703 | 2.147299 | [
"s667716378",
"s740219663"
] |
u761320129 | p03846 | python | s071602448 | s198143491 | 84 | 69 | 11,444 | 14,820 | Accepted | Accepted | 17.86 | from collections import Counter
N = eval(input())
A = list(map(int, input().split()))
hist = Counter(A)
def valid():
if N % 2 == 0:
for i in range(1,N,2):
if hist[i] != 2:
return False
return True
else:
if hist[0] != 1:
return False
for i in range(2,N,2):
... | from collections import Counter
N = int(eval(input()))
src = list(map(int,input().split()))
ctr = Counter(src)
def valid():
if N%2:
if ctr[0] != 1: return False
i = 2
while i <= N:
if ctr[i] != 2: return False
i += 2
else:
i = 1
wh... | 25 | 22 | 438 | 464 | from collections import Counter
N = eval(input())
A = list(map(int, input().split()))
hist = Counter(A)
def valid():
if N % 2 == 0:
for i in range(1, N, 2):
if hist[i] != 2:
return False
return True
else:
if hist[0] != 1:
return False
fo... | from collections import Counter
N = int(eval(input()))
src = list(map(int, input().split()))
ctr = Counter(src)
def valid():
if N % 2:
if ctr[0] != 1:
return False
i = 2
while i <= N:
if ctr[i] != 2:
return False
i += 2
else:
... | false | 12 | [
"-N = eval(input())",
"-A = list(map(int, input().split()))",
"-hist = Counter(A)",
"+N = int(eval(input()))",
"+src = list(map(int, input().split()))",
"+ctr = Counter(src)",
"- if N % 2 == 0:",
"- for i in range(1, N, 2):",
"- if hist[i] != 2:",
"+ if N % 2:",
"+ ... | false | 0.039771 | 0.037729 | 1.054112 | [
"s071602448",
"s198143491"
] |
u073852194 | p02551 | python | s858139576 | s128682253 | 325 | 284 | 94,684 | 101,708 | Accepted | Accepted | 12.62 | class SegmentTreeDual():
def __init__(self, n, op, id, commutative=False):
self.n = n
self.op = op
self.id = id
self.commutative = commutative
self.log = (n - 1).bit_length()
self.size = 1 << self.log
self.d = [id] * self.size
self.lz = [id] *... | class SegmentTreeDual():
def __init__(self, n, op, id, commutative=False):
self.n = n
self.op = op
self.id = id
self.commutative = commutative
self.log = (n - 1).bit_length()
self.size = 1 << self.log
self.d = [id] * self.size
self.lz = [id] *... | 77 | 77 | 2,089 | 2,087 | class SegmentTreeDual:
def __init__(self, n, op, id, commutative=False):
self.n = n
self.op = op
self.id = id
self.commutative = commutative
self.log = (n - 1).bit_length()
self.size = 1 << self.log
self.d = [id] * self.size
self.lz = [id] * (2 * self.... | class SegmentTreeDual:
def __init__(self, n, op, id, commutative=False):
self.n = n
self.op = op
self.id = id
self.commutative = commutative
self.log = (n - 1).bit_length()
self.size = 1 << self.log
self.d = [id] * self.size
self.lz = [id] * (2 * self.... | false | 0 | [
"-stx = SegmentTreeDual(N, min, 10**18, False)",
"-sty = SegmentTreeDual(N, min, 10**18, False)",
"+stx = SegmentTreeDual(N, min, 10**18, True)",
"+sty = SegmentTreeDual(N, min, 10**18, True)"
] | false | 0.08723 | 0.146996 | 0.59342 | [
"s858139576",
"s128682253"
] |
u596276291 | p04029 | python | s636631876 | s900777732 | 25 | 22 | 3,064 | 3,064 | Accepted | Accepted | 12 | def main():
n = int(eval(input()))
print((sum(i for i in range(1, n + 1))))
if __name__ == '__main__':
main()
|
# 初項a,交差dの数列n個の和
def arithmetic_series(a, d, n):
return n * (2 * a + (n - 1) * d) // 2
def main():
n = int(eval(input()))
print((arithmetic_series(1, 1, n)))
if __name__ == '__main__':
main()
| 7 | 13 | 122 | 217 | def main():
n = int(eval(input()))
print((sum(i for i in range(1, n + 1))))
if __name__ == "__main__":
main()
| # 初項a,交差dの数列n個の和
def arithmetic_series(a, d, n):
return n * (2 * a + (n - 1) * d) // 2
def main():
n = int(eval(input()))
print((arithmetic_series(1, 1, n)))
if __name__ == "__main__":
main()
| false | 46.153846 | [
"+# 初項a,交差dの数列n個の和",
"+def arithmetic_series(a, d, n):",
"+ return n * (2 * a + (n - 1) * d) // 2",
"+",
"+",
"- print((sum(i for i in range(1, n + 1))))",
"+ print((arithmetic_series(1, 1, n)))"
] | false | 0.035639 | 0.036633 | 0.972867 | [
"s636631876",
"s900777732"
] |
u691018832 | p03779 | python | s770809559 | s080232270 | 27 | 24 | 6,680 | 2,940 | Accepted | Accepted | 11.11 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
import itertools
x = int(read())
cumsum = list(itertools.accumulate([i for i in range(45000)]))
for i in range(45000):
if cumsum[i] >= x:
print(i)
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
x = int(read())
cnt = 0
for i in range(45000):
cnt += i
if cnt >= x:
print(i)
exit()
| 14 | 13 | 336 | 269 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
import itertools
x = int(read())
cumsum = list(itertools.accumulate([i for i in range(45000)]))
for i in range(45000):
if cumsum[i] >= x:
print(i)
exit()... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
x = int(read())
cnt = 0
for i in range(45000):
cnt += i
if cnt >= x:
print(i)
exit()
| false | 7.142857 | [
"-import itertools",
"-",
"-cumsum = list(itertools.accumulate([i for i in range(45000)]))",
"+cnt = 0",
"- if cumsum[i] >= x:",
"+ cnt += i",
"+ if cnt >= x:"
] | false | 0.058634 | 0.048823 | 1.200958 | [
"s770809559",
"s080232270"
] |
u298297089 | p03855 | python | s193916542 | s690449619 | 1,567 | 1,276 | 184,056 | 74,376 | Accepted | Accepted | 18.57 | import sys
sys.setrecursionlimit(10**9)
def unite(par, i, j):
j = get_par(par, j)
par[j] = get_par(par, i)
def get_par(par, p):
while par[p] != p:
p = par[p]
return par[p]
n,k,l = list(map(int, input().split()))
pq = []
road = [i for i in range(n+1)]
rcnt = [set([i]) for i in... | import sys
sys.setrecursionlimit(10**9)
def unite(par, i, j):
j = get_par(par, j)
par[j] = get_par(par, i)
def get_par(par, p):
while par[p] != p:
p = par[p]
return par[p]
n,k,l = list(map(int, input().split()))
pq = []
road = [i for i in range(n+1)]
rail = [i for i in range(n+... | 57 | 47 | 1,319 | 1,057 | import sys
sys.setrecursionlimit(10**9)
def unite(par, i, j):
j = get_par(par, j)
par[j] = get_par(par, i)
def get_par(par, p):
while par[p] != p:
p = par[p]
return par[p]
n, k, l = list(map(int, input().split()))
pq = []
road = [i for i in range(n + 1)]
rcnt = [set([i]) for i in range(n ... | import sys
sys.setrecursionlimit(10**9)
def unite(par, i, j):
j = get_par(par, j)
par[j] = get_par(par, i)
def get_par(par, p):
while par[p] != p:
p = par[p]
return par[p]
n, k, l = list(map(int, input().split()))
pq = []
road = [i for i in range(n + 1)]
rail = [i for i in range(n + 1)]
f... | false | 17.54386 | [
"-rcnt = [set([i]) for i in range(n + 1)]",
"-acnt = [set([i]) for i in range(n + 1)]",
"- rcnt[aa] |= rcnt[bb]",
"- rcnt[bb] |= rcnt[aa]",
"- acnt[aa] |= acnt[bb]",
"- # acnt[aa] += acnt[bb]",
"- acnt[bb] |= acnt[aa]",
"-# print(acnt)",
"-# print(rcnt)"
] | false | 0.035432 | 0.105092 | 0.33715 | [
"s193916542",
"s690449619"
] |
u243312682 | p02768 | python | s885014621 | s670767989 | 111 | 102 | 9,164 | 9,204 | Accepted | Accepted | 8.11 | def main():
n, a, b = list(map(int, input().split()))
mod = 10 ** 9 + 7 #素数
def modpow(x, n, mod):
res = 1
while n:
if n % 2:
res *= x % mod
x *= x % mod
n >>= 1
return res
def cmb(n, r):
# 分子(n*(... | def main():
n, a, b = list(map(int, input().split()))
mod = 10 ** 9 + 7 #素数
def modpow(x, n, mod):
res = 1
while n:
if n % 2:
res *= x % mod
x *= x % mod
n >>= 1
return res
def cmb(n, r, mod):
# 分... | 32 | 33 | 767 | 791 | def main():
n, a, b = list(map(int, input().split()))
mod = 10**9 + 7 # 素数
def modpow(x, n, mod):
res = 1
while n:
if n % 2:
res *= x % mod
x *= x % mod
n >>= 1
return res
def cmb(n, r):
# 分子(n*(n-1)*...*(n-r+1))
... | def main():
n, a, b = list(map(int, input().split()))
mod = 10**9 + 7 # 素数
def modpow(x, n, mod):
res = 1
while n:
if n % 2:
res *= x % mod
x *= x % mod
n >>= 1
return res
def cmb(n, r, mod):
# 分子(n*(n-1)*...*(n-r+1))... | false | 3.030303 | [
"- def cmb(n, r):",
"+ def cmb(n, r, mod):",
"- return nume * d",
"+ return nume * d % mod",
"- bad_a = cmb(n, a)",
"- bad_b = cmb(n, b)",
"+ bad_a = cmb(n, a, mod)",
"+ bad_b = cmb(n, b, mod)"
] | false | 0.259916 | 0.309747 | 0.839122 | [
"s885014621",
"s670767989"
] |
u014333473 | p02712 | python | s341864270 | s264264173 | 151 | 133 | 29,996 | 29,960 | Accepted | Accepted | 11.92 | print((sum([i for i in range(1,int(eval(input()))+1) if not ((i%3==0 and i%5==0) or i%3==0 or i%5==0)]))) | print((sum([i for i in range(1,int(eval(input()))+1) if i%15 and i%5 and i%3]))) | 1 | 1 | 97 | 72 | print(
(
sum(
[
i
for i in range(1, int(eval(input())) + 1)
if not ((i % 3 == 0 and i % 5 == 0) or i % 3 == 0 or i % 5 == 0)
]
)
)
)
| print(
(sum([i for i in range(1, int(eval(input())) + 1) if i % 15 and i % 5 and i % 3]))
)
| false | 0 | [
"- (",
"- sum(",
"- [",
"- i",
"- for i in range(1, int(eval(input())) + 1)",
"- if not ((i % 3 == 0 and i % 5 == 0) or i % 3 == 0 or i % 5 == 0)",
"- ]",
"- )",
"- )",
"+ (sum([i for i in range(1, int(eval(i... | false | 0.128306 | 0.127487 | 1.006423 | [
"s341864270",
"s264264173"
] |
u376420711 | p03578 | python | s627730287 | s549159692 | 363 | 310 | 67,680 | 67,680 | Accepted | Accepted | 14.6 | from collections import Counter
n = eval(input())
d = Counter(list(map(int, input().split())))
m = eval(input())
t = Counter(list(map(int, input().split())))
d.subtract(t)
print(("NO" if -d else "YES"))
| from collections import Counter
eval(input())
d = Counter(list(map(int, input().split())))
eval(input())
t = Counter(list(map(int, input().split())))
d.subtract(t)
print(("NO" if -d else "YES"))
| 7 | 7 | 183 | 175 | from collections import Counter
n = eval(input())
d = Counter(list(map(int, input().split())))
m = eval(input())
t = Counter(list(map(int, input().split())))
d.subtract(t)
print(("NO" if -d else "YES"))
| from collections import Counter
eval(input())
d = Counter(list(map(int, input().split())))
eval(input())
t = Counter(list(map(int, input().split())))
d.subtract(t)
print(("NO" if -d else "YES"))
| false | 0 | [
"-n = eval(input())",
"+eval(input())",
"-m = eval(input())",
"+eval(input())"
] | false | 0.115902 | 0.070376 | 1.646892 | [
"s627730287",
"s549159692"
] |
u189023301 | p02960 | python | s148790291 | s017642275 | 1,029 | 597 | 43,500 | 43,244 | Accepted | Accepted | 41.98 | def main():
s = input()[::-1]
mod = 13
p = 10 ** 9 + 7
dp = [0] * mod
dp[0] = 1
for i, ss in enumerate(s):
tmp = [0] * mod
if ss == "?":
for j in range(10):
d = j * pow(10, i, mod)
for k in range(mod):
... | def main():
s = eval(input())
mod = 13
p = 10 ** 9 + 7
dp = [0] * mod
dp[0] = 1
for i, ss in enumerate(s):
tmp = [0] * mod
if ss == "?":
for j in range(10):
for k in range(mod):
d = (10 * k + j) % mod
... | 23 | 23 | 606 | 570 | def main():
s = input()[::-1]
mod = 13
p = 10**9 + 7
dp = [0] * mod
dp[0] = 1
for i, ss in enumerate(s):
tmp = [0] * mod
if ss == "?":
for j in range(10):
d = j * pow(10, i, mod)
for k in range(mod):
tmp[(k + d) % mo... | def main():
s = eval(input())
mod = 13
p = 10**9 + 7
dp = [0] * mod
dp[0] = 1
for i, ss in enumerate(s):
tmp = [0] * mod
if ss == "?":
for j in range(10):
for k in range(mod):
d = (10 * k + j) % mod
tmp[d] += dp[... | false | 0 | [
"- s = input()[::-1]",
"+ s = eval(input())",
"- d = j * pow(10, i, mod)",
"- tmp[(k + d) % mod] += dp[k]",
"- tmp[(k + d) % mod] %= p",
"+ d = (10 * k + j) % mod",
"+ tmp[d] += dp[k]",
"+ ... | false | 0.038907 | 0.038342 | 1.014725 | [
"s148790291",
"s017642275"
] |
u493520238 | p03013 | python | s978954855 | s961454419 | 460 | 161 | 503,428 | 76,000 | Accepted | Accepted | 65 | MOD = 10**9+7
n,m = list(map(int, input().split()))
al = [True]*(n+1)
for _ in range(m):
al[int(eval(input()))] = False
dp = [0]*(n+1)
dp[0] = 1
for i in range(n):
if i+2 <= n and al[i+2]:
dp[i+2] += dp[i]
if i+1 <= n and al[i+1]:
dp[i+1] += dp[i]
print((dp[n]%MOD)) | n,m = list(map(int, input().split()))
al = [True]*(n+1)
for _ in range(m):
a = int(eval(input()))
al[a] = False
MOD = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
for i in range(n):
if i+1 <= n and al[i+1]:
dp[i+1] += dp[i]
dp[i+1]%=MOD
if i+2 <= n and al[i+2]:
dp[i+2] += dp[i... | 16 | 18 | 299 | 348 | MOD = 10**9 + 7
n, m = list(map(int, input().split()))
al = [True] * (n + 1)
for _ in range(m):
al[int(eval(input()))] = False
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n):
if i + 2 <= n and al[i + 2]:
dp[i + 2] += dp[i]
if i + 1 <= n and al[i + 1]:
dp[i + 1] += dp[i]
print((dp[n] % MOD))
| n, m = list(map(int, input().split()))
al = [True] * (n + 1)
for _ in range(m):
a = int(eval(input()))
al[a] = False
MOD = 10**9 + 7
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n):
if i + 1 <= n and al[i + 1]:
dp[i + 1] += dp[i]
dp[i + 1] %= MOD
if i + 2 <= n and al[i + 2]:
dp[i ... | false | 11.111111 | [
"-MOD = 10**9 + 7",
"- al[int(eval(input()))] = False",
"+ a = int(eval(input()))",
"+ al[a] = False",
"+MOD = 10**9 + 7",
"+ if i + 1 <= n and al[i + 1]:",
"+ dp[i + 1] += dp[i]",
"+ dp[i + 1] %= MOD",
"- if i + 1 <= n and al[i + 1]:",
"- dp[i + 1] += dp[i]",
... | false | 0.070989 | 0.037403 | 1.897933 | [
"s978954855",
"s961454419"
] |
u970308980 | p03353 | python | s668776121 | s849130945 | 177 | 35 | 40,048 | 4,464 | Accepted | Accepted | 80.23 | s = input().strip()
K = int(eval(input()))
S = set()
for i in range(len(s)):
for w in range(1, K+1):
S.add(s[i:i+w])
print((sorted(S)[K-1]))
| s = input().strip()
K = int(eval(input()))
substr = set()
for i in range(len(s)):
for j in range(1, K+1):
substr.add(s[i:i+j])
print((sorted(substr)[K-1]))
| 10 | 10 | 157 | 172 | s = input().strip()
K = int(eval(input()))
S = set()
for i in range(len(s)):
for w in range(1, K + 1):
S.add(s[i : i + w])
print((sorted(S)[K - 1]))
| s = input().strip()
K = int(eval(input()))
substr = set()
for i in range(len(s)):
for j in range(1, K + 1):
substr.add(s[i : i + j])
print((sorted(substr)[K - 1]))
| false | 0 | [
"-S = set()",
"+substr = set()",
"- for w in range(1, K + 1):",
"- S.add(s[i : i + w])",
"-print((sorted(S)[K - 1]))",
"+ for j in range(1, K + 1):",
"+ substr.add(s[i : i + j])",
"+print((sorted(substr)[K - 1]))"
] | false | 0.006931 | 0.035461 | 0.195458 | [
"s668776121",
"s849130945"
] |
u297667660 | p02683 | python | s202962570 | s703626909 | 102 | 75 | 9,360 | 68,576 | Accepted | Accepted | 26.47 | n, m, x = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(n)]
bi_list = [bin(i)[2:] for i in range(2**n)]
comb = [0] * (m+1)
comb[0] = 10**7
for i in bi_list:#本の選択パターン選択
dig = len(i)
state = [0] * (m+1)
for j in range(dig):#iから本の選択
if i[dig-1-j] == '1':... | #Cbit全探索
n, m, x = list(map(int, input().split()))
books = [list(map(int, input().split())) for i in range(n)]
ans = [0]*(m+1); ans[0] = 10**7
for i in range(2**n):
state = [0]*(m+1)
for j in range(n):
if (i >> j) & 1:
for k in range(m+1):
state[k] += books[n-1-j]... | 22 | 20 | 598 | 515 | n, m, x = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(n)]
bi_list = [bin(i)[2:] for i in range(2**n)]
comb = [0] * (m + 1)
comb[0] = 10**7
for i in bi_list: # 本の選択パターン選択
dig = len(i)
state = [0] * (m + 1)
for j in range(dig): # iから本の選択
if i[dig - 1 - j] == "... | # Cbit全探索
n, m, x = list(map(int, input().split()))
books = [list(map(int, input().split())) for i in range(n)]
ans = [0] * (m + 1)
ans[0] = 10**7
for i in range(2**n):
state = [0] * (m + 1)
for j in range(n):
if (i >> j) & 1:
for k in range(m + 1):
state[k] += books[n - 1 - ... | false | 9.090909 | [
"+# Cbit全探索",
"-l = [list(map(int, input().split())) for i in range(n)]",
"-bi_list = [bin(i)[2:] for i in range(2**n)]",
"-comb = [0] * (m + 1)",
"-comb[0] = 10**7",
"-for i in bi_list: # 本の選択パターン選択",
"- dig = len(i)",
"+books = [list(map(int, input().split())) for i in range(n)]",
"+ans = [0] ... | false | 0.047333 | 0.047372 | 0.999168 | [
"s202962570",
"s703626909"
] |
u309120194 | p02958 | python | s709886369 | s190870338 | 114 | 28 | 26,988 | 9,180 | Accepted | Accepted | 75.44 | import numpy as np
N = int(eval(input()))
p = list(map(int, input().split()))
q = sorted(p)
p, q = np.array(p), np.array(q)
if np.sum(p != q) <= 2: print('YES')
else: print('NO') | N = int(eval(input()))
p = list(map(int, input().split()))
q = list(range(1, N+1))
ans = 0
for i in range(N):
if p[i] != q[i]: ans += 1
if ans <= 2: print('YES')
else: print('NO') | 10 | 10 | 186 | 190 | import numpy as np
N = int(eval(input()))
p = list(map(int, input().split()))
q = sorted(p)
p, q = np.array(p), np.array(q)
if np.sum(p != q) <= 2:
print("YES")
else:
print("NO")
| N = int(eval(input()))
p = list(map(int, input().split()))
q = list(range(1, N + 1))
ans = 0
for i in range(N):
if p[i] != q[i]:
ans += 1
if ans <= 2:
print("YES")
else:
print("NO")
| false | 0 | [
"-import numpy as np",
"-",
"-q = sorted(p)",
"-p, q = np.array(p), np.array(q)",
"-if np.sum(p != q) <= 2:",
"+q = list(range(1, N + 1))",
"+ans = 0",
"+for i in range(N):",
"+ if p[i] != q[i]:",
"+ ans += 1",
"+if ans <= 2:"
] | false | 0.526485 | 0.076097 | 6.918601 | [
"s709886369",
"s190870338"
] |
u133936772 | p02791 | python | s115117664 | s822589120 | 112 | 89 | 24,872 | 17,940 | Accepted | Accepted | 20.54 | n = int(eval(input()))
l = list(map(int, input().split()))
m = 200001
ans = 0
for i in range(n):
if l[i] < m:
m = l[i]
ans += 1
print(ans) | f=input
f(); l=list(map(int,f().split()))
a,m=0,200001
for i in l:
if i<m: m=i; a+=1
print(a) | 12 | 6 | 156 | 94 | n = int(eval(input()))
l = list(map(int, input().split()))
m = 200001
ans = 0
for i in range(n):
if l[i] < m:
m = l[i]
ans += 1
print(ans)
| f = input
f()
l = list(map(int, f().split()))
a, m = 0, 200001
for i in l:
if i < m:
m = i
a += 1
print(a)
| false | 50 | [
"-n = int(eval(input()))",
"-l = list(map(int, input().split()))",
"-m = 200001",
"-ans = 0",
"-for i in range(n):",
"- if l[i] < m:",
"- m = l[i]",
"- ans += 1",
"-print(ans)",
"+f = input",
"+f()",
"+l = list(map(int, f().split()))",
"+a, m = 0, 200001",
"+for i in l:",
... | false | 0.036895 | 0.036715 | 1.004895 | [
"s115117664",
"s822589120"
] |
u454093752 | p02720 | python | s870091220 | s726528049 | 412 | 188 | 55,792 | 41,328 | Accepted | Accepted | 54.37 | c = 0
K = int(eval(input()))
for i in range(1,10):
c += 1
if c == K:
print(i)
for i in range(1,10):
for j in range(i-1,min(i+2,10)):
c += 1
if c == K:
print((10*i+j))
for i in range(1,10):
for j in range(i-1,min(i+2,10)):
for k in range(max(j-... | import sys
from _collections import deque
K = int(eval(input()))
c = 9
A = [1,2,3,4,5,6,7,8,9]
q = deque(A)
if K <= 9:
print(K)
else:
while(True):
a = q.popleft()
if a % 10 == 0:
c += 1
if c == K:
print((a*10))
sys.exit()... | 96 | 51 | 4,058 | 1,210 | c = 0
K = int(eval(input()))
for i in range(1, 10):
c += 1
if c == K:
print(i)
for i in range(1, 10):
for j in range(i - 1, min(i + 2, 10)):
c += 1
if c == K:
print((10 * i + j))
for i in range(1, 10):
for j in range(i - 1, min(i + 2, 10)):
for k in range(max(... | import sys
from _collections import deque
K = int(eval(input()))
c = 9
A = [1, 2, 3, 4, 5, 6, 7, 8, 9]
q = deque(A)
if K <= 9:
print(K)
else:
while True:
a = q.popleft()
if a % 10 == 0:
c += 1
if c == K:
print((a * 10))
sys.exit()
... | false | 46.875 | [
"-c = 0",
"+import sys",
"+from _collections import deque",
"+",
"-for i in range(1, 10):",
"- c += 1",
"- if c == K:",
"- print(i)",
"-for i in range(1, 10):",
"- for j in range(i - 1, min(i + 2, 10)):",
"- c += 1",
"- if c == K:",
"- print((10 * i +... | false | 0.232984 | 0.052486 | 4.439006 | [
"s870091220",
"s726528049"
] |
u252828980 | p02555 | python | s016759091 | s679895082 | 463 | 32 | 9,088 | 9,180 | Accepted | Accepted | 93.09 | s = int(eval(input()))
mod = 10**9 + 7
dp = [0]*(s+1)
dp[0] = 1
for i in range(1,s+1):
for j in range((i-3)+1):
dp[i] +=dp[j]
dp[i] %=mod
print((dp[s])) | s = int(eval(input()))
mod = 10**9 + 7
dp = [0]*(s+1)
dp[0] = 1
x = 0
for i in range(1,s+1):
if i-3 >=0:
x += dp[i-3]
x %=mod
dp[i] = x
print((dp[s])) | 11 | 13 | 184 | 188 | s = int(eval(input()))
mod = 10**9 + 7
dp = [0] * (s + 1)
dp[0] = 1
for i in range(1, s + 1):
for j in range((i - 3) + 1):
dp[i] += dp[j]
dp[i] %= mod
print((dp[s]))
| s = int(eval(input()))
mod = 10**9 + 7
dp = [0] * (s + 1)
dp[0] = 1
x = 0
for i in range(1, s + 1):
if i - 3 >= 0:
x += dp[i - 3]
x %= mod
dp[i] = x
print((dp[s]))
| false | 15.384615 | [
"+x = 0",
"- for j in range((i - 3) + 1):",
"- dp[i] += dp[j]",
"- dp[i] %= mod",
"+ if i - 3 >= 0:",
"+ x += dp[i - 3]",
"+ x %= mod",
"+ dp[i] = x"
] | false | 0.144379 | 0.038032 | 3.796211 | [
"s016759091",
"s679895082"
] |
u057109575 | p02850 | python | s785161555 | s551964215 | 921 | 707 | 95,704 | 83,160 | Accepted | Accepted | 23.24 | from collections import deque
N = int(input())
X = [list(map(int, input().split())) for _ in range(N - 1)]
graph = [[] for _ in range(N)]
tree = [[] for _ in range(N)]
for n, (i, j) in enumerate(X):
graph[i - 1].append(j - 1)
graph[j - 1].append(i - 1)
tree[i - 1].append((n, j - 1))
K... | from collections import deque
N = int(input())
X = [list(map(int, input().split())) for _ in range(N - 1)]
tree = [[] for _ in range(N)]
for n, (i, j) in enumerate(X):
tree[i - 1].append((n, j - 1))
q = deque()
q.append((0, 0))
ans = [0] * (N - 1)
while len(q) > 0:
# u: node number, c: color
... | 32 | 27 | 697 | 566 | from collections import deque
N = int(input())
X = [list(map(int, input().split())) for _ in range(N - 1)]
graph = [[] for _ in range(N)]
tree = [[] for _ in range(N)]
for n, (i, j) in enumerate(X):
graph[i - 1].append(j - 1)
graph[j - 1].append(i - 1)
tree[i - 1].append((n, j - 1))
K = max(len(x) for x in... | from collections import deque
N = int(input())
X = [list(map(int, input().split())) for _ in range(N - 1)]
tree = [[] for _ in range(N)]
for n, (i, j) in enumerate(X):
tree[i - 1].append((n, j - 1))
q = deque()
q.append((0, 0))
ans = [0] * (N - 1)
while len(q) > 0:
# u: node number, c: color
u, c = q.pople... | false | 15.625 | [
"-graph = [[] for _ in range(N)]",
"- graph[i - 1].append(j - 1)",
"- graph[j - 1].append(i - 1)",
"-K = max(len(x) for x in graph)",
"-print(K)",
"+print(max(ans))"
] | false | 0.043181 | 0.082035 | 0.526374 | [
"s785161555",
"s551964215"
] |
u393253137 | p02744 | python | s841238965 | s093904301 | 195 | 67 | 17,884 | 16,340 | Accepted | Accepted | 65.64 | n = int(input())
A= 'a'
# 文字数を増やして, その各々の元に対して文字を追加する.
for _ in range(n - 1):
A = {a + s for a in A for s in a + chr(ord(max(a)) + 1)}
# print(A)
# 最後にsortして調整する.
#print(*A, sep = '\n')
print(*sorted(A), sep='\n')
| n = int(eval(input()))
A = ['a']
S = 'abcdefghij'
for _ in range(n-1):
B = []
for a in A:
for s in S[:len(set(a)) + 1]:
B.append(a + s)
A = B[::]
print(('\n'.join(A))) | 9 | 10 | 229 | 200 | n = int(input())
A = "a"
# 文字数を増やして, その各々の元に対して文字を追加する.
for _ in range(n - 1):
A = {a + s for a in A for s in a + chr(ord(max(a)) + 1)}
# print(A)
# 最後にsortして調整する.
# print(*A, sep = '\n')
print(*sorted(A), sep="\n")
| n = int(eval(input()))
A = ["a"]
S = "abcdefghij"
for _ in range(n - 1):
B = []
for a in A:
for s in S[: len(set(a)) + 1]:
B.append(a + s)
A = B[::]
print(("\n".join(A)))
| false | 10 | [
"-n = int(input())",
"-A = \"a\"",
"-# 文字数を増やして, その各々の元に対して文字を追加する.",
"+n = int(eval(input()))",
"+A = [\"a\"]",
"+S = \"abcdefghij\"",
"- A = {a + s for a in A for s in a + chr(ord(max(a)) + 1)}",
"- # print(A)",
"-# 最後にsortして調整する.",
"-# print(*A, sep = '\\n')",
"-print(*sorted(A), sep=\"... | false | 0.092196 | 0.091255 | 1.010309 | [
"s841238965",
"s093904301"
] |
u653837719 | p02695 | python | s641936819 | s922032537 | 1,296 | 153 | 21,480 | 85,116 | Accepted | Accepted | 88.19 | import sys,itertools
input = sys.stdin.readline
n,m,q = list(map(int,input().split()))
seq = list(range(n+m-1))
p = list(itertools.combinations(seq,n))
a = [0]*q
b = [0]*q
c = [0]*q
d = [0]*q
for i in range(q):
a[i],b[i],c[i],d[i] = list(map(int,input().split()))
res = 0
for i in range(len(p)):
... | import itertools
n, m, q = list(map(int,input().split()))
seq = list(range(n+m-1))
p = list(itertools.combinations(seq, n))
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):
a[i], b[i], c[i], d[i] = list(map(int,input().split()))
res = 0
for i in range(len(p)):
t = [0] * n
... | 32 | 31 | 576 | 564 | import sys, itertools
input = sys.stdin.readline
n, m, q = list(map(int, input().split()))
seq = list(range(n + m - 1))
p = list(itertools.combinations(seq, n))
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):
a[i], b[i], c[i], d[i] = list(map(int, input().split()))
res = 0
for i in range(len(p))... | import itertools
n, m, q = list(map(int, input().split()))
seq = list(range(n + m - 1))
p = list(itertools.combinations(seq, n))
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):
a[i], b[i], c[i], d[i] = list(map(int, input().split()))
res = 0
for i in range(len(p)):
t = [0] * n
pp = sorte... | false | 3.125 | [
"-import sys, itertools",
"+import itertools",
"-input = sys.stdin.readline"
] | false | 0.227185 | 0.133962 | 1.695891 | [
"s641936819",
"s922032537"
] |
u177398299 | p03856 | python | s720605856 | s918058696 | 1,236 | 156 | 3,956 | 3,956 | Accepted | Accepted | 87.38 | match = ['eraser', 'erase', 'dreamer', 'dream']
len_m = [len(m) for m in match]
S = eval(input())
n = len(S)
dp = [False] * (n + 1)
dp[0] = True
for i in range(1, n + 1):
for lm, m in zip(len_m, match):
if S[:i].endswith(m) and dp[i - lm]:
dp[i] = True
break
print(('YES' i... | match = ['eraser', 'erase', 'dreamer', 'dream']
len_m = [len(m) for m in match]
S = eval(input())
n = len(S)
dp = [False] * (n + 1)
dp[0] = True
for i in range(1, n + 1):
for w, word in zip(len_m, match):
if S[i - w:i] == word and dp[i - w]:
dp[i] = True
break
print(('YES'... | 12 | 12 | 331 | 333 | match = ["eraser", "erase", "dreamer", "dream"]
len_m = [len(m) for m in match]
S = eval(input())
n = len(S)
dp = [False] * (n + 1)
dp[0] = True
for i in range(1, n + 1):
for lm, m in zip(len_m, match):
if S[:i].endswith(m) and dp[i - lm]:
dp[i] = True
break
print(("YES" if dp[n] els... | match = ["eraser", "erase", "dreamer", "dream"]
len_m = [len(m) for m in match]
S = eval(input())
n = len(S)
dp = [False] * (n + 1)
dp[0] = True
for i in range(1, n + 1):
for w, word in zip(len_m, match):
if S[i - w : i] == word and dp[i - w]:
dp[i] = True
break
print(("YES" if dp[n]... | false | 0 | [
"- for lm, m in zip(len_m, match):",
"- if S[:i].endswith(m) and dp[i - lm]:",
"+ for w, word in zip(len_m, match):",
"+ if S[i - w : i] == word and dp[i - w]:"
] | false | 0.191948 | 0.046494 | 4.128451 | [
"s720605856",
"s918058696"
] |
u216015528 | p03409 | python | s217702562 | s558049047 | 33 | 28 | 9,228 | 9,200 | Accepted | Accepted | 15.15 | import sys
def resolve():
readline = sys.stdin.readline # 1行だけ文字列にする
N = int(readline())
NN = 2 * N + 1
# 青色はx座標をlistのindex,y座標をlistのvalueとして入力,赤は逆
red = [[] for _ in [0] * NN]
blue = [[] for _ in [0] * NN]
for _ in [0] * N:
a, b = list(map(int, readline().split()... | def resolve():
import sys
readline = sys.stdin.readline # 1行だけ文字列にする
N = int(readline())
# 赤,青点をx,y座標の2次元リストとして入力
red = [list(map(int, readline().split())) for _ in [0] * N]
blue = [list(map(int, readline().split())) for _ in [0] * N]
# 赤はy座標で降順ソート,青はx座標で昇順ソート
red.... | 59 | 26 | 1,604 | 591 | import sys
def resolve():
readline = sys.stdin.readline # 1行だけ文字列にする
N = int(readline())
NN = 2 * N + 1
# 青色はx座標をlistのindex,y座標をlistのvalueとして入力,赤は逆
red = [[] for _ in [0] * NN]
blue = [[] for _ in [0] * NN]
for _ in [0] * N:
a, b = list(map(int, readline().split()))
red[b]... | def resolve():
import sys
readline = sys.stdin.readline # 1行だけ文字列にする
N = int(readline())
# 赤,青点をx,y座標の2次元リストとして入力
red = [list(map(int, readline().split())) for _ in [0] * N]
blue = [list(map(int, readline().split())) for _ in [0] * N]
# 赤はy座標で降順ソート,青はx座標で昇順ソート
red.sort(key=lambda x: x[... | false | 55.932203 | [
"-import sys",
"+def resolve():",
"+ import sys",
"-",
"-def resolve():",
"- NN = 2 * N + 1",
"- # 青色はx座標をlistのindex,y座標をlistのvalueとして入力,赤は逆",
"- red = [[] for _ in [0] * NN]",
"- blue = [[] for _ in [0] * NN]",
"- for _ in [0] * N:",
"- a, b = list(map(int, readline().s... | false | 0.045062 | 0.047617 | 0.946327 | [
"s217702562",
"s558049047"
] |
u169350228 | p02787 | python | s227549052 | s457103273 | 392 | 220 | 14,536 | 75,576 | Accepted | Accepted | 43.88 | import numpy as np
h, n = list(map(int,input().split()))
a = np.zeros(n,dtype=int)
b = np.zeros(n,dtype=int)
for i in range(n):
ai ,bi = list(map(int,input().split()))
a[i] = ai
b[i] = bi
mh = np.zeros(10001,dtype=int)
for i in range(1,h+1):
mh[i] = (mh[i-a]+b).min()
print((mh[h]))
| '''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecurs... | 14 | 38 | 300 | 883 | import numpy as np
h, n = list(map(int, input().split()))
a = np.zeros(n, dtype=int)
b = np.zeros(n, dtype=int)
for i in range(n):
ai, bi = list(map(int, input().split()))
a[i] = ai
b[i] = bi
mh = np.zeros(10001, dtype=int)
for i in range(1, h + 1):
mh[i] = (mh[i - a] + b).min()
print((mh[h]))
| """
自宅用PCでの解答
"""
import math
# import numpy as np
import itertools
import queue
import bisect
from collections import deque, defaultdict
import heapq as hpq
from sys import stdin, setrecursionlimit
# from scipy.sparse.csgraph import dijkstra
# from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimi... | false | 63.157895 | [
"-import numpy as np",
"+\"\"\"",
"+自宅用PCでの解答",
"+\"\"\"",
"+import math",
"-h, n = list(map(int, input().split()))",
"-a = np.zeros(n, dtype=int)",
"-b = np.zeros(n, dtype=int)",
"-for i in range(n):",
"- ai, bi = list(map(int, input().split()))",
"- a[i] = ai",
"- b[i] = bi",
"-mh... | false | 0.204967 | 0.049207 | 4.165435 | [
"s227549052",
"s457103273"
] |
u211160392 | p02973 | python | s430741058 | s057859271 | 571 | 240 | 57,688 | 11,756 | Accepted | Accepted | 57.97 | N = int(eval(input()))
A = list(int(eval(input()))for i in range(N))
H = [A[0]]
for i in range(1,N):
if A[i] <= H[-1]:
H.append(A[i])
else:
l,r =0,len(H)
while l != r :
if H[(l+r)//2]>=A[i]:
l = (l+r)//2+1
else:
r = (l+r... | import bisect
N = int(eval(input()))
A = [int(eval(input()))for i in range(N)]
m = [-A[0]]
ans = 1
for i in A[1:]:
p = bisect.bisect_left(m,-i+1)
if p == ans:
ans += 1
m.append(-i)
else:
m[p] = -i
print(ans)
| 15 | 13 | 349 | 244 | N = int(eval(input()))
A = list(int(eval(input())) for i in range(N))
H = [A[0]]
for i in range(1, N):
if A[i] <= H[-1]:
H.append(A[i])
else:
l, r = 0, len(H)
while l != r:
if H[(l + r) // 2] >= A[i]:
l = (l + r) // 2 + 1
else:
r = ... | import bisect
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
m = [-A[0]]
ans = 1
for i in A[1:]:
p = bisect.bisect_left(m, -i + 1)
if p == ans:
ans += 1
m.append(-i)
else:
m[p] = -i
print(ans)
| false | 13.333333 | [
"+import bisect",
"+",
"-A = list(int(eval(input())) for i in range(N))",
"-H = [A[0]]",
"-for i in range(1, N):",
"- if A[i] <= H[-1]:",
"- H.append(A[i])",
"+A = [int(eval(input())) for i in range(N)]",
"+m = [-A[0]]",
"+ans = 1",
"+for i in A[1:]:",
"+ p = bisect.bisect_left(m,... | false | 0.07234 | 0.072809 | 0.993556 | [
"s430741058",
"s057859271"
] |
u314050667 | p02936 | python | s456677872 | s954265751 | 1,906 | 1,701 | 64,560 | 64,356 | Accepted | Accepted | 10.76 | import sys
sys.setrecursionlimit(10**9)
N, Q = map(int ,input().split())
E = [[] for _ in range(N+1)]
for _ in range(N-1):
at,bt = map(int ,input().split())
E[at].append(bt)
E[bt].append(at)
cnt = [0 for _ in range(N+1)]
for _ in range(Q):
pt,xt = map(int, input().split())
cnt[pt] += xt
flg = [0 fo... | N, Q = list(map(int, input().split()))
E = [[] for _ in range(N+1)]
for _ in range(N-1):
ta,tb = list(map(int, input().split()))
E[ta].append(tb)
E[tb].append(ta)
cnt = [0 for _ in range(N+1)]
for _ in range(Q):
tp, tx = list(map(int, input().split()))
cnt[tp] += tx
q = [[1,0]]
flg = [0 for _ in r... | 28 | 27 | 536 | 487 | import sys
sys.setrecursionlimit(10**9)
N, Q = map(int, input().split())
E = [[] for _ in range(N + 1)]
for _ in range(N - 1):
at, bt = map(int, input().split())
E[at].append(bt)
E[bt].append(at)
cnt = [0 for _ in range(N + 1)]
for _ in range(Q):
pt, xt = map(int, input().split())
cnt[pt] += xt
flg... | N, Q = list(map(int, input().split()))
E = [[] for _ in range(N + 1)]
for _ in range(N - 1):
ta, tb = list(map(int, input().split()))
E[ta].append(tb)
E[tb].append(ta)
cnt = [0 for _ in range(N + 1)]
for _ in range(Q):
tp, tx = list(map(int, input().split()))
cnt[tp] += tx
q = [[1, 0]]
flg = [0 for ... | false | 3.571429 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**9)",
"-N, Q = map(int, input().split())",
"+N, Q = list(map(int, input().split()))",
"- at, bt = map(int, input().split())",
"- E[at].append(bt)",
"- E[bt].append(at)",
"+ ta, tb = list(map(int, input().split()))",
"+ E[ta].append(tb)"... | false | 0.038415 | 0.101475 | 0.378566 | [
"s456677872",
"s954265751"
] |
u369094007 | p02813 | python | s826189805 | s321375042 | 118 | 106 | 9,972 | 4,728 | Accepted | Accepted | 10.17 | import itertools
N = int(eval(input()))
P = int(input().replace(' ', ''))
Q = int(input().replace(' ', ''))
s = [i for i in range(1, N + 1)]
l = list(itertools.permutations(s))
j = []
for i in range(len(l)):
t = list(map(str,l[i]))
j.append(int(''.join(t)))
nl = sorted(j)
a = 0
b = 0
for i in ra... | import itertools
N = int(eval(input()))
P = int(input().replace(' ', ''))
Q = int(input().replace(' ', ''))
l = [i for i in range(1, N+1)]
pl = itertools.permutations(l)
lis = []
for oc in pl:
lis.append(int(''.join(map(str, list(oc)))))
lis.sort()
a = lis.index(P)
b = lis.index(Q)
print((abs(a - b))) | 23 | 15 | 411 | 312 | import itertools
N = int(eval(input()))
P = int(input().replace(" ", ""))
Q = int(input().replace(" ", ""))
s = [i for i in range(1, N + 1)]
l = list(itertools.permutations(s))
j = []
for i in range(len(l)):
t = list(map(str, l[i]))
j.append(int("".join(t)))
nl = sorted(j)
a = 0
b = 0
for i in range(len(nl)):
... | import itertools
N = int(eval(input()))
P = int(input().replace(" ", ""))
Q = int(input().replace(" ", ""))
l = [i for i in range(1, N + 1)]
pl = itertools.permutations(l)
lis = []
for oc in pl:
lis.append(int("".join(map(str, list(oc)))))
lis.sort()
a = lis.index(P)
b = lis.index(Q)
print((abs(a - b)))
| false | 34.782609 | [
"-s = [i for i in range(1, N + 1)]",
"-l = list(itertools.permutations(s))",
"-j = []",
"-for i in range(len(l)):",
"- t = list(map(str, l[i]))",
"- j.append(int(\"\".join(t)))",
"-nl = sorted(j)",
"-a = 0",
"-b = 0",
"-for i in range(len(nl)):",
"- if nl[i] == P:",
"- a = i + ... | false | 0.033638 | 0.030799 | 1.092177 | [
"s826189805",
"s321375042"
] |
u475503988 | p02973 | python | s186748549 | s415998988 | 411 | 128 | 8,060 | 8,188 | Accepted | Accepted | 68.86 | import sys
input = sys.stdin.readline
from collections import deque
import bisect
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
d = deque()
for i in range(N):
p = bisect.bisect_left(d, A[i])
if p==0:
d.appendleft(A[i])
else:
d[p-1] = A[i]
ans = len(d)
pr... | import sys
input = sys.stdin.readline
from collections import deque
import bisect
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
A.reverse()
d = []
for i in range(N):
p = bisect.bisect_right(d, A[i])
if p==len(d):
d.append(A[i])
else:
d[p] = A[i]
ans = le... | 17 | 18 | 317 | 325 | import sys
input = sys.stdin.readline
from collections import deque
import bisect
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
d = deque()
for i in range(N):
p = bisect.bisect_left(d, A[i])
if p == 0:
d.appendleft(A[i])
else:
d[p - 1] = A[i]
ans = len(d)
print(ans)
| import sys
input = sys.stdin.readline
from collections import deque
import bisect
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
A.reverse()
d = []
for i in range(N):
p = bisect.bisect_right(d, A[i])
if p == len(d):
d.append(A[i])
else:
d[p] = A[i]
ans = len(d)
print(ans... | false | 5.555556 | [
"-d = deque()",
"+A.reverse()",
"+d = []",
"- p = bisect.bisect_left(d, A[i])",
"- if p == 0:",
"- d.appendleft(A[i])",
"+ p = bisect.bisect_right(d, A[i])",
"+ if p == len(d):",
"+ d.append(A[i])",
"- d[p - 1] = A[i]",
"+ d[p] = A[i]"
] | false | 0.040143 | 0.037074 | 1.082772 | [
"s186748549",
"s415998988"
] |
u203843959 | p02862 | python | s784000827 | s368005436 | 156 | 126 | 3,188 | 3,064 | Accepted | Accepted | 19.23 | MOD=10**9+7
X,Y=list(map(int,input().split()))
def powmod(a,p):
if p==0:
return 1
elif p==1:
return a
else:
pow2=powmod(a,p//2)
if p%2==0:
return (pow2**2)%MOD
else:
return (a*pow2**2)%MOD
def invmod(a):
return powmod(a,MOD-2)
def comb_mod(n,r):
nPr=1
fact_... | MOD=10**9+7
X,Y=list(map(int,input().split()))
def powmod(a,p):
if p==0:
return 1
else:
pow2=powmod(a,p//2)
if p%2==0:
return (pow2**2)%MOD
else:
return (a*pow2**2)%MOD
def invmod(a):
return powmod(a,MOD-2)
def comb_mod(n,r):
r=min(r,n-r)
nPr=1
fact_r=1
for i... | 36 | 35 | 601 | 589 | MOD = 10**9 + 7
X, Y = list(map(int, input().split()))
def powmod(a, p):
if p == 0:
return 1
elif p == 1:
return a
else:
pow2 = powmod(a, p // 2)
if p % 2 == 0:
return (pow2**2) % MOD
else:
return (a * pow2**2) % MOD
def invmod(a):
retu... | MOD = 10**9 + 7
X, Y = list(map(int, input().split()))
def powmod(a, p):
if p == 0:
return 1
else:
pow2 = powmod(a, p // 2)
if p % 2 == 0:
return (pow2**2) % MOD
else:
return (a * pow2**2) % MOD
def invmod(a):
return powmod(a, MOD - 2)
def comb_m... | false | 2.777778 | [
"- elif p == 1:",
"- return a",
"+ r = min(r, n - r)"
] | false | 0.185324 | 0.061048 | 3.035723 | [
"s784000827",
"s368005436"
] |
u197300773 | p02901 | python | s737013630 | s475539591 | 1,419 | 769 | 3,188 | 3,188 | Accepted | Accepted | 45.81 | def main():
N,M=list(map(int,input().split()))
L=2**N
dp=[10**8 for i in range(L)]
dp[0]=0
for _ in range(M):
a, _ = list(map(int, input().split()))
key=sum([2**(int(i)-1) for i in input().split()])
for j in range(L):
q=j|key
dp[q... | def main():
N,M=list(map(int,input().split()))
L=2**N
dp=[10**8 for i in range(L)]
dp[0]=0
for _ in range(M):
a, _ = list(map(int, input().split()))
key=sum([2**(int(i)-1) for i in input().split()])
for j in range(L):
q=j|key
x=dp[j... | 20 | 21 | 429 | 471 | def main():
N, M = list(map(int, input().split()))
L = 2**N
dp = [10**8 for i in range(L)]
dp[0] = 0
for _ in range(M):
a, _ = list(map(int, input().split()))
key = sum([2 ** (int(i) - 1) for i in input().split()])
for j in range(L):
q = j | key
dp[q] ... | def main():
N, M = list(map(int, input().split()))
L = 2**N
dp = [10**8 for i in range(L)]
dp[0] = 0
for _ in range(M):
a, _ = list(map(int, input().split()))
key = sum([2 ** (int(i) - 1) for i in input().split()])
for j in range(L):
q = j | key
x = dp... | false | 4.761905 | [
"- dp[q] = min(dp[j] + a, dp[q])",
"+ x = dp[j] + a",
"+ if dp[q] > x:",
"+ dp[q] = x"
] | false | 0.037784 | 0.036141 | 1.045454 | [
"s737013630",
"s475539591"
] |
u780475861 | p02807 | python | s470014754 | s459721497 | 212 | 154 | 23,112 | 19,756 | Accepted | Accepted | 27.36 | n = int(eval(input()))
x = list(map(int, input().split()))
mod = 10**9 + 7
X = []
for i in range(n - 1):
X.append(x[i + 1] - x[i])
l, left = 1, [1]
for i in range(1, n - 1):
l *= i
l %= mod
left.append(l)
r, right = 1, [1]
for i in range(n - 1, 1, -1):
r *= i
r %= mod
right.ap... | n = int(eval(input()))
X = list(map(int, input().split()))
mod = 10**9 + 7
last=X[-1]
X=[last-i for i in X[:-1]]
l, left = 1, [1]
for i in range(1, n - 1):
l *= i
l %= mod
left.append(l)
r, right = 1, [1]
for i in range(n - 1, 1, -1):
r *= i
r %= mod
right.append(r)
right.reverse(... | 27 | 19 | 517 | 419 | n = int(eval(input()))
x = list(map(int, input().split()))
mod = 10**9 + 7
X = []
for i in range(n - 1):
X.append(x[i + 1] - x[i])
l, left = 1, [1]
for i in range(1, n - 1):
l *= i
l %= mod
left.append(l)
r, right = 1, [1]
for i in range(n - 1, 1, -1):
r *= i
r %= mod
right.append(r)
right.r... | n = int(eval(input()))
X = list(map(int, input().split()))
mod = 10**9 + 7
last = X[-1]
X = [last - i for i in X[:-1]]
l, left = 1, [1]
for i in range(1, n - 1):
l *= i
l %= mod
left.append(l)
r, right = 1, [1]
for i in range(n - 1, 1, -1):
r *= i
r %= mod
right.append(r)
right.reverse()
flst = ... | false | 29.62963 | [
"-x = list(map(int, input().split()))",
"+X = list(map(int, input().split()))",
"-X = []",
"-for i in range(n - 1):",
"- X.append(x[i + 1] - x[i])",
"+last = X[-1]",
"+X = [last - i for i in X[:-1]]",
"-f, flst = 0, []",
"-for i, j in zip(left, right):",
"- f += i * j % mod",
"- f %= mo... | false | 0.042269 | 0.041185 | 1.026321 | [
"s470014754",
"s459721497"
] |
u753803401 | p03730 | python | s897619162 | s859709681 | 45 | 39 | 5,304 | 5,304 | Accepted | Accepted | 13.33 | import fractions
a, b, c = list(map(int, input().split()))
print(("YES" if c % fractions.gcd(a, b) == 0 else "NO"))
| import fractions
a, b, c = list(map(int, input().split()))
gcd = fractions.gcd(a, b)
print(("YES" if c % gcd == 0 else "NO"))
| 3 | 4 | 110 | 121 | import fractions
a, b, c = list(map(int, input().split()))
print(("YES" if c % fractions.gcd(a, b) == 0 else "NO"))
| import fractions
a, b, c = list(map(int, input().split()))
gcd = fractions.gcd(a, b)
print(("YES" if c % gcd == 0 else "NO"))
| false | 25 | [
"-print((\"YES\" if c % fractions.gcd(a, b) == 0 else \"NO\"))",
"+gcd = fractions.gcd(a, b)",
"+print((\"YES\" if c % gcd == 0 else \"NO\"))"
] | false | 0.16966 | 0.252079 | 0.67304 | [
"s897619162",
"s859709681"
] |
u588341295 | p03078 | python | s708078834 | s622309249 | 979 | 118 | 147,776 | 8,728 | Accepted | Accepted | 87.95 | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(eval(input()))
def MAP(): r... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(eval(input()))
def MAP(): r... | 39 | 37 | 889 | 971 | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1):
return int(-(-x // y))
def INT():
return int(eval(inp... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1):
return int(-(-x // y))
def INT():
return int(eval(inp... | false | 5.128205 | [
"-A = LIST()",
"-B = LIST()",
"-C = LIST()",
"-AB = []",
"+A = sorted(LIST(), reverse=True)",
"+B = sorted(LIST(), reverse=True)",
"+C = sorted(LIST(), reverse=True)",
"+ABC = []",
"- AB.append(A[i] + B[j])",
"-AB.sort(reverse=True)",
"-AB = AB[:3000]",
"-ABC = []",
"-for i in range(l... | false | 0.03692 | 0.111731 | 0.33044 | [
"s708078834",
"s622309249"
] |
u968166680 | p02863 | python | s498302142 | s581299965 | 113 | 101 | 68,188 | 74,036 | Accepted | Accepted | 10.62 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, T, *AB = list(map(int, read().split()))
D = [(a, b) for a, b in zip(*[iter(AB)] * 2)]
D.sort()
dp = [0] * T
... | import sys
def main():
N, T, *AB = list(map(int, sys.stdin.buffer.read().split()))
D = [(a, b) for a, b in zip(*[iter(AB)] * 2)]
D.sort()
dp = [0] * T
ans = 0
for i, (a, b) in enumerate(D[:-1]):
for t in range(T - 1, a - 1, -1):
if dp[t] < dp[t - a] + b:
... | 32 | 25 | 648 | 511 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, T, *AB = list(map(int, read().split()))
D = [(a, b) for a, b in zip(*[iter(AB)] * 2)]
D.sort()
dp = [0] * T
ans = 0
for i, ... | import sys
def main():
N, T, *AB = list(map(int, sys.stdin.buffer.read().split()))
D = [(a, b) for a, b in zip(*[iter(AB)] * 2)]
D.sort()
dp = [0] * T
ans = 0
for i, (a, b) in enumerate(D[:-1]):
for t in range(T - 1, a - 1, -1):
if dp[t] < dp[t - a] + b:
dp[... | false | 21.875 | [
"-",
"-read = sys.stdin.read",
"-readline = sys.stdin.readline",
"-readlines = sys.stdin.readlines",
"-sys.setrecursionlimit(10**9)",
"-INF = 1 << 60",
"-MOD = 1000000007",
"- N, T, *AB = list(map(int, read().split()))",
"+ N, T, *AB = list(map(int, sys.stdin.buffer.read().split()))"
] | false | 0.045495 | 0.045335 | 1.003522 | [
"s498302142",
"s581299965"
] |
u331327289 | p02694 | python | s091907319 | s980762201 | 477 | 22 | 106,180 | 9,172 | Accepted | Accepted | 95.39 | import sys
from numba import njit, i8
@njit(i8(i8), cache=True)
def solve(X):
money = 100
res = 0
while (money < X):
money *= 1.01
money = int(money)
res += 1
return res
def main():
input = sys.stdin.buffer.readline
X: int = int(eval(input()))
pr... | import sys
def solve(X):
money = 100
res = 0
while (money < X):
money *= 1.01
money = int(money)
res += 1
return res
def main():
input = sys.stdin.buffer.readline
X: int = int(eval(input()))
print((solve(X)))
if __name__ == '__main__':
ma... | 23 | 21 | 372 | 317 | import sys
from numba import njit, i8
@njit(i8(i8), cache=True)
def solve(X):
money = 100
res = 0
while money < X:
money *= 1.01
money = int(money)
res += 1
return res
def main():
input = sys.stdin.buffer.readline
X: int = int(eval(input()))
print((solve(X)))
if... | import sys
def solve(X):
money = 100
res = 0
while money < X:
money *= 1.01
money = int(money)
res += 1
return res
def main():
input = sys.stdin.buffer.readline
X: int = int(eval(input()))
print((solve(X)))
if __name__ == "__main__":
main()
| false | 8.695652 | [
"-from numba import njit, i8",
"-@njit(i8(i8), cache=True)"
] | false | 0.081366 | 0.036914 | 2.204179 | [
"s091907319",
"s980762201"
] |
u325282913 | p03494 | python | s083228311 | s356739851 | 20 | 18 | 2,940 | 3,060 | Accepted | Accepted | 10 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
flg = "True"
while flg == "True":
ans += 1
for i in range(N):
if A[i] % 2 == 0:
A[i] = A[i] / 2
else:
flg = "False"
print((ans - 1))
| N = int(eval(input()))
a = list(map(int,input().split()))
ans = 0
while True:
if sum(a) == 0:
print(ans)
exit()
for i in range(N):
if a[i]%2 == 0:
a[i] //= 2
else:
print(ans)
exit()
ans += 1 | 14 | 14 | 255 | 237 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
flg = "True"
while flg == "True":
ans += 1
for i in range(N):
if A[i] % 2 == 0:
A[i] = A[i] / 2
else:
flg = "False"
print((ans - 1))
| N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
while True:
if sum(a) == 0:
print(ans)
exit()
for i in range(N):
if a[i] % 2 == 0:
a[i] //= 2
else:
print(ans)
exit()
ans += 1
| false | 0 | [
"-A = list(map(int, input().split()))",
"+a = list(map(int, input().split()))",
"-flg = \"True\"",
"-while flg == \"True\":",
"+while True:",
"+ if sum(a) == 0:",
"+ print(ans)",
"+ exit()",
"+ for i in range(N):",
"+ if a[i] % 2 == 0:",
"+ a[i] //= 2",
"+... | false | 0.045061 | 0.047611 | 0.94643 | [
"s083228311",
"s356739851"
] |
u821432765 | p03061 | python | s075956767 | s827497888 | 1,706 | 215 | 16,152 | 16,148 | Accepted | Accepted | 87.4 | from fractions import gcd
class SegTree:
def __init__(self, N, A, f, e):
"""
N: A の要素数
A: セグ木に乗せたい配列
f: 二項演算 (モノイドじゃなきゃだめ)
e: f の単位元
"""
n = 2**(N-1).bit_length() # セグ木の葉の数(N 以上の最小の2べき)
c = [e] * (2*n)
for i in range(N):
... | from fractions import gcd
N = int(eval(input()))
A = [int(i) for i in input().split()]
cuml = [0]
cumr = [0]
for i in range(N):
cuml.append(gcd(cuml[i], A[i]))
cumr.append(gcd(cumr[i], A[N-i-1]))
maxg = 0
for i in range(N):
# print(gcd(cuml[i], cumr[N-i-1]))
maxg = max(maxg, gcd(cum... | 60 | 18 | 1,490 | 346 | from fractions import gcd
class SegTree:
def __init__(self, N, A, f, e):
"""
N: A の要素数
A: セグ木に乗せたい配列
f: 二項演算 (モノイドじゃなきゃだめ)
e: f の単位元
"""
n = 2 ** (N - 1).bit_length() # セグ木の葉の数(N 以上の最小の2べき)
c = [e] * (2 * n)
for i in range(N):
c[... | from fractions import gcd
N = int(eval(input()))
A = [int(i) for i in input().split()]
cuml = [0]
cumr = [0]
for i in range(N):
cuml.append(gcd(cuml[i], A[i]))
cumr.append(gcd(cumr[i], A[N - i - 1]))
maxg = 0
for i in range(N):
# print(gcd(cuml[i], cumr[N-i-1]))
maxg = max(maxg, gcd(cuml[i], cumr[N - i... | false | 70 | [
"-",
"-",
"-class SegTree:",
"- def __init__(self, N, A, f, e):",
"- \"\"\"",
"- N: A の要素数",
"- A: セグ木に乗せたい配列",
"- f: 二項演算 (モノイドじゃなきゃだめ)",
"- e: f の単位元",
"- \"\"\"",
"- n = 2 ** (N - 1).bit_length() # セグ木の葉の数(N 以上の最小の2べき)",
"- c = [e]... | false | 0.051455 | 0.043656 | 1.178642 | [
"s075956767",
"s827497888"
] |
u912318491 | p02614 | python | s230875073 | s074402777 | 68 | 62 | 9,232 | 9,188 | Accepted | Accepted | 8.82 | h,w,k = list(map(int,input().split()))
c=[]
ans = 0
for i in range(h):
c.append(eval(input()))
for maskR in range(1<<h):
for maskC in range(1<<w):
black = 0
for i in range(h):
for j in range(w):
if maskR >> i & 1 == 1 and maskC >> j & 1== 1 and c[i][j]=='#... | h, w, k = list(map(int, input().split()))
c = []
ans = 0
for i in range(h):
c.append(eval(input()))
for maskR in range(1 << h):
for maskC in range(1 << w):
black = 0
for i in range(h):
for j in range(w):
if maskR >> i & 1 == 0 and maskC >> j & 1 == 0 and c... | 19 | 17 | 405 | 415 | h, w, k = list(map(int, input().split()))
c = []
ans = 0
for i in range(h):
c.append(eval(input()))
for maskR in range(1 << h):
for maskC in range(1 << w):
black = 0
for i in range(h):
for j in range(w):
if maskR >> i & 1 == 1 and maskC >> j & 1 == 1 and c[i][j] == "#... | h, w, k = list(map(int, input().split()))
c = []
ans = 0
for i in range(h):
c.append(eval(input()))
for maskR in range(1 << h):
for maskC in range(1 << w):
black = 0
for i in range(h):
for j in range(w):
if maskR >> i & 1 == 0 and maskC >> j & 1 == 0 and c[i][j] == "#... | false | 10.526316 | [
"- if maskR >> i & 1 == 1 and maskC >> j & 1 == 1 and c[i][j] == \"#\":",
"+ if maskR >> i & 1 == 0 and maskC >> j & 1 == 0 and c[i][j] == \"#\":"
] | false | 0.039634 | 0.055027 | 0.720258 | [
"s230875073",
"s074402777"
] |
u559416752 | p03036 | python | s582598558 | s687990476 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | r, d, x = list(map(int, input().split()))
result = 0
rx = 0
for i in range(10):
if i == 0:
result = r * x - d
else:
result = r * result - d
print(result) | r,D,a=list(map(int,input().split()))
for i in range(10):
a=r*a-D
print(a) | 9 | 4 | 183 | 76 | r, d, x = list(map(int, input().split()))
result = 0
rx = 0
for i in range(10):
if i == 0:
result = r * x - d
else:
result = r * result - d
print(result)
| r, D, a = list(map(int, input().split()))
for i in range(10):
a = r * a - D
print(a)
| false | 55.555556 | [
"-r, d, x = list(map(int, input().split()))",
"-result = 0",
"-rx = 0",
"+r, D, a = list(map(int, input().split()))",
"- if i == 0:",
"- result = r * x - d",
"- else:",
"- result = r * result - d",
"- print(result)",
"+ a = r * a - D",
"+ print(a)"
] | false | 0.142155 | 0.043611 | 3.259632 | [
"s582598558",
"s687990476"
] |
u136869985 | p03294 | python | s505373883 | s298904790 | 171 | 89 | 40,028 | 3,316 | Accepted | Accepted | 47.95 | n = int(eval(input()))
A = list(map(int, input().split()))
print((sum(A) - n)) | n=eval(input())
A=list(map(int,input().split()))
t=1
for a in A:
t *= a
t -= 1
ans=0
for a in A:
ans += t % a
print(ans) | 3 | 10 | 72 | 131 | n = int(eval(input()))
A = list(map(int, input().split()))
print((sum(A) - n))
| n = eval(input())
A = list(map(int, input().split()))
t = 1
for a in A:
t *= a
t -= 1
ans = 0
for a in A:
ans += t % a
print(ans)
| false | 70 | [
"-n = int(eval(input()))",
"+n = eval(input())",
"-print((sum(A) - n))",
"+t = 1",
"+for a in A:",
"+ t *= a",
"+t -= 1",
"+ans = 0",
"+for a in A:",
"+ ans += t % a",
"+print(ans)"
] | false | 0.032091 | 0.041536 | 0.772625 | [
"s505373883",
"s298904790"
] |
u492910842 | p03086 | python | s160031225 | s767661813 | 172 | 66 | 38,384 | 61,764 | Accepted | Accepted | 61.63 | s = list(eval(input()))
n = len(s)
count = 0
maxcount = 0
for i in range(n):
if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
count += 1
maxcount = max(maxcount,count)
else:
count = 0
print(maxcount) | s=eval(input())
ans=0
cnt=0
for i in range(len(s)):
if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
cnt+=1
else:
ans=max(ans,cnt)
cnt=0
ans=max(ans,cnt)
print(ans) | 12 | 11 | 233 | 188 | s = list(eval(input()))
n = len(s)
count = 0
maxcount = 0
for i in range(n):
if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
count += 1
maxcount = max(maxcount, count)
else:
count = 0
print(maxcount)
| s = eval(input())
ans = 0
cnt = 0
for i in range(len(s)):
if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
cnt += 1
else:
ans = max(ans, cnt)
cnt = 0
ans = max(ans, cnt)
print(ans)
| false | 8.333333 | [
"-s = list(eval(input()))",
"-n = len(s)",
"-count = 0",
"-maxcount = 0",
"-for i in range(n):",
"+s = eval(input())",
"+ans = 0",
"+cnt = 0",
"+for i in range(len(s)):",
"- count += 1",
"- maxcount = max(maxcount, count)",
"+ cnt += 1",
"- count = 0",
"-print(m... | false | 0.035937 | 0.03501 | 1.026455 | [
"s160031225",
"s767661813"
] |
u077898957 | p04012 | python | s033800661 | s060328558 | 20 | 17 | 3,060 | 3,060 | Accepted | Accepted | 15 | import sys
w = eval(input())
for i in w:
if w.count(i) % 2 == 1:
print('No')
sys.exit()
print('Yes')
| w = eval(input())
arr = set(w)
dw = {i:0 for i in arr}
for i in w:
dw[i]+=1
temp = 0
for i in arr:
temp += dw[i]%2
print(('Yes' if temp==0 else 'No')) | 7 | 9 | 121 | 158 | import sys
w = eval(input())
for i in w:
if w.count(i) % 2 == 1:
print("No")
sys.exit()
print("Yes")
| w = eval(input())
arr = set(w)
dw = {i: 0 for i in arr}
for i in w:
dw[i] += 1
temp = 0
for i in arr:
temp += dw[i] % 2
print(("Yes" if temp == 0 else "No"))
| false | 22.222222 | [
"-import sys",
"-",
"+arr = set(w)",
"+dw = {i: 0 for i in arr}",
"- if w.count(i) % 2 == 1:",
"- print(\"No\")",
"- sys.exit()",
"-print(\"Yes\")",
"+ dw[i] += 1",
"+temp = 0",
"+for i in arr:",
"+ temp += dw[i] % 2",
"+print((\"Yes\" if temp == 0 else \"No\"))"
] | false | 0.03746 | 0.038017 | 0.985359 | [
"s033800661",
"s060328558"
] |
u991567869 | p03408 | python | s106223543 | s534901734 | 20 | 17 | 3,064 | 3,064 | Accepted | Accepted | 15 | n = int(eval(input()))
s = [(input().split()) for _ in range(n)]
m = int(eval(input()))
t = [(input().split()) for _ in range(m)]
ans = 0
for i in range(n):
ans = max(ans, s.count(s[i]) - t.count(s[i]))
print(ans) | n = int(eval(input()))
s = [(input().split()) for _ in range(n)]
m = int(eval(input()))
t = [(input().split()) for _ in range(m)]
ans = 0
for i in s:
ans = max(ans, s.count(i) - t.count(i))
print(ans) | 10 | 10 | 216 | 203 | n = int(eval(input()))
s = [(input().split()) for _ in range(n)]
m = int(eval(input()))
t = [(input().split()) for _ in range(m)]
ans = 0
for i in range(n):
ans = max(ans, s.count(s[i]) - t.count(s[i]))
print(ans)
| n = int(eval(input()))
s = [(input().split()) for _ in range(n)]
m = int(eval(input()))
t = [(input().split()) for _ in range(m)]
ans = 0
for i in s:
ans = max(ans, s.count(i) - t.count(i))
print(ans)
| false | 0 | [
"-for i in range(n):",
"- ans = max(ans, s.count(s[i]) - t.count(s[i]))",
"+for i in s:",
"+ ans = max(ans, s.count(i) - t.count(i))"
] | false | 0.097372 | 0.043577 | 2.234483 | [
"s106223543",
"s534901734"
] |
u328364772 | p02819 | python | s013153036 | s857238182 | 32 | 18 | 2,940 | 2,940 | Accepted | Accepted | 43.75 | x = int(eval(input()))
while True:
for i in range(2, x):
if x % i == 0:
break
else:
print(x)
break
x += 1
| x = int(eval(input()))
while True:
for i in range(2, int(x**0.5+1)):
if x % i == 0:
break
else:
print(x)
break
x += 1
| 10 | 10 | 158 | 170 | x = int(eval(input()))
while True:
for i in range(2, x):
if x % i == 0:
break
else:
print(x)
break
x += 1
| x = int(eval(input()))
while True:
for i in range(2, int(x**0.5 + 1)):
if x % i == 0:
break
else:
print(x)
break
x += 1
| false | 0 | [
"- for i in range(2, x):",
"+ for i in range(2, int(x**0.5 + 1)):"
] | false | 0.081319 | 0.036295 | 2.240493 | [
"s013153036",
"s857238182"
] |
u562935282 | p03200 | python | s915686770 | s639682353 | 81 | 48 | 3,500 | 3,500 | Accepted | Accepted | 40.74 | s = eval(input())
right = len(s) - 1
i = right
ans = 0
while i >= 0:
if s[i] == 'B':
# print(right, i)
ans += right - i
right -= 1
i -= 1
print(ans)
| s = eval(input())
cnt = 0
ans = 0
for c in s:
if c == 'B':
cnt += 1
elif c == 'W':
ans += cnt
print(ans)
| 12 | 10 | 187 | 133 | s = eval(input())
right = len(s) - 1
i = right
ans = 0
while i >= 0:
if s[i] == "B":
# print(right, i)
ans += right - i
right -= 1
i -= 1
print(ans)
| s = eval(input())
cnt = 0
ans = 0
for c in s:
if c == "B":
cnt += 1
elif c == "W":
ans += cnt
print(ans)
| false | 16.666667 | [
"-right = len(s) - 1",
"-i = right",
"+cnt = 0",
"-while i >= 0:",
"- if s[i] == \"B\":",
"- # print(right, i)",
"- ans += right - i",
"- right -= 1",
"- i -= 1",
"+for c in s:",
"+ if c == \"B\":",
"+ cnt += 1",
"+ elif c == \"W\":",
"+ ans +... | false | 0.039145 | 0.045832 | 0.85409 | [
"s915686770",
"s639682353"
] |
u867826040 | p03835 | python | s027036344 | s869817065 | 1,677 | 1,227 | 2,940 | 9,088 | Accepted | Accepted | 26.83 | k,s = list(map(int,input().split()))
ans = 0
for x in range(k+1):
for y in range(k+1):
z = s-x-y
if 0<=z and z<=k:
ans+=1
print(ans) | k,s = list(map(int,input().split()))
ans = 0
for x in range(k+1):
for y in range(k+1):
z = s-x-y
ans += (0 <= z <= k)
print(ans) | 8 | 7 | 165 | 138 | k, s = list(map(int, input().split()))
ans = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if 0 <= z and z <= k:
ans += 1
print(ans)
| k, s = list(map(int, input().split()))
ans = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
ans += 0 <= z <= k
print(ans)
| false | 12.5 | [
"- if 0 <= z and z <= k:",
"- ans += 1",
"+ ans += 0 <= z <= k"
] | false | 0.042745 | 0.062155 | 0.687719 | [
"s027036344",
"s869817065"
] |
u279460955 | p02689 | python | s047321886 | s429784071 | 364 | 224 | 108,264 | 85,140 | Accepted | Accepted | 38.46 | def Is(): return list(map(int, input().split())) # '123 456' -> 123, 456
def LI(): return list(map(int, input().split())) # '123 456' -> [123, 456]
N, M = Is()
H = LI()
AB = [set() for _ in range(N)]
for i in range(M):
a, b = Is()
a -= 1
b -= 1
AB[a].add(b)
AB[b].add(a)
ans = 0
n... | def Is(): return list(map(int, input().split())) # '123 456' -> 123, 456
def LI(): return list(map(int, input().split())) # '123 456' -> [123, 456]
N, M = Is()
H = LI()
notgood = [False]*N
for i in range(M):
a, b = Is()
a -= 1
b -= 1
if H[a] > H[b]:
notgood[b] = True
elif ... | 43 | 26 | 890 | 505 | def Is():
return list(map(int, input().split())) # '123 456' -> 123, 456
def LI():
return list(map(int, input().split())) # '123 456' -> [123, 456]
N, M = Is()
H = LI()
AB = [set() for _ in range(N)]
for i in range(M):
a, b = Is()
a -= 1
b -= 1
AB[a].add(b)
AB[b].add(a)
ans = 0
notgood... | def Is():
return list(map(int, input().split())) # '123 456' -> 123, 456
def LI():
return list(map(int, input().split())) # '123 456' -> [123, 456]
N, M = Is()
H = LI()
notgood = [False] * N
for i in range(M):
a, b = Is()
a -= 1
b -= 1
if H[a] > H[b]:
notgood[b] = True
elif H[b... | false | 39.534884 | [
"-AB = [set() for _ in range(N)]",
"+notgood = [False] * N",
"- AB[a].add(b)",
"- AB[b].add(a)",
"+ if H[a] > H[b]:",
"+ notgood[b] = True",
"+ elif H[b] > H[a]:",
"+ notgood[a] = True",
"+ else:",
"+ notgood[a] = True",
"+ notgood[b] = True",
"-notgo... | false | 0.039163 | 0.084049 | 0.465952 | [
"s047321886",
"s429784071"
] |
u102461423 | p02984 | python | s306030434 | s142092885 | 863 | 90 | 67,912 | 19,808 | Accepted | Accepted | 89.57 | from scipy.sparse import csr_matrix
from scipy.sparse.linalg import spsolve
import numpy as np
N = int(eval(input()))
A = np.array(input().split())
rows = np.concatenate([np.arange(N), np.arange(N)])
cols = np.concatenate([np.arange(N), np.arange(1,N+1) % N])
mat = csr_matrix(([1] * (2*N), (rows, cols)), (N,N)... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,*A = list(map(int,read().split()))
S = sum(A)
x = S//2 - sum(A[1::2])
rain = [x+x]
for x in A[:-1]:
rain.append(x+x-rain[-1])
print((' '.join(map(str,rain)))) | 12 | 14 | 381 | 288 | from scipy.sparse import csr_matrix
from scipy.sparse.linalg import spsolve
import numpy as np
N = int(eval(input()))
A = np.array(input().split())
rows = np.concatenate([np.arange(N), np.arange(N)])
cols = np.concatenate([np.arange(N), np.arange(1, N + 1) % N])
mat = csr_matrix(([1] * (2 * N), (rows, cols)), (N, N))
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *A = list(map(int, read().split()))
S = sum(A)
x = S // 2 - sum(A[1::2])
rain = [x + x]
for x in A[:-1]:
rain.append(x + x - rain[-1])
print((" ".join(map(str, rain))))
| false | 14.285714 | [
"-from scipy.sparse import csr_matrix",
"-from scipy.sparse.linalg import spsolve",
"-import numpy as np",
"+import sys",
"-N = int(eval(input()))",
"-A = np.array(input().split())",
"-rows = np.concatenate([np.arange(N), np.arange(N)])",
"-cols = np.concatenate([np.arange(N), np.arange(1, N + 1) % N]... | false | 0.415762 | 0.032205 | 12.90976 | [
"s306030434",
"s142092885"
] |
u379959788 | p03013 | python | s457625430 | s188994324 | 483 | 369 | 544,360 | 460,788 | Accepted | Accepted | 23.6 | import sys
sys.setrecursionlimit(10 ** 5 + 10)
mod = 10 ** 9 + 7
# フィボナッチ数列
fib_memo = {}
def fib(N):
if N < 2: return 1
if N not in fib_memo:
fib_memo[N] = fib(N-1) + fib(N-2)
return fib_memo[N]
N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(M)]
tmp_... | # DP
mod = 10 ** 9 + 7
N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(M)]
if N == 1:
print((1))
exit()
if N == 2:
if M == 0:
print((2))
if M == 1:
print((1))
exit()
safe = [True] * (N+1)
for i in range(M):
safe[A[i]] = False
d... | 31 | 36 | 625 | 539 | import sys
sys.setrecursionlimit(10**5 + 10)
mod = 10**9 + 7
# フィボナッチ数列
fib_memo = {}
def fib(N):
if N < 2:
return 1
if N not in fib_memo:
fib_memo[N] = fib(N - 1) + fib(N - 2)
return fib_memo[N]
N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(M)]
tmp_list ... | # DP
mod = 10**9 + 7
N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(M)]
if N == 1:
print((1))
exit()
if N == 2:
if M == 0:
print((2))
if M == 1:
print((1))
exit()
safe = [True] * (N + 1)
for i in range(M):
safe[A[i]] = False
dp = [0] * (N + 1)
dp[0]... | false | 13.888889 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**5 + 10)",
"+# DP",
"-# フィボナッチ数列",
"-fib_memo = {}",
"-",
"-",
"-def fib(N):",
"- if N < 2:",
"- return 1",
"- if N not in fib_memo:",
"- fib_memo[N] = fib(N - 1) + fib(N - 2)",
"- return fib_memo[N]",
"-",
"-",
"-... | false | 0.040655 | 0.080462 | 0.505261 | [
"s457625430",
"s188994324"
] |
u525065967 | p02616 | python | s792114965 | s222171514 | 303 | 200 | 32,088 | 32,208 | Accepted | Accepted | 33.99 | def solve():
P.sort()
M.sort(reverse = True)
p, m = [], []
while len(p) + len(m) < k:
if len(P) > 0 and len(M) <= 0: p.append(P.pop())
elif len(P) <= 0 and len(M) > 0: m.append(M.pop())
elif P[-1] < -M[-1]: m.append(M.pop())
else: p.append(P.pop())
if len(m)%... | def solve():
can_positive = False
if len(P) > 0:
if k < n: can_positive = True
else: can_positive = len(M)%2 == 0
else: can_positive = k%2 == 0
if not can_positive: return sorted(P+M, key=lambda x:abs(x))[:k]
P.sort()
M.sort(reverse=True)
a = [P.pop()] if k%2 else ... | 39 | 24 | 1,164 | 728 | def solve():
P.sort()
M.sort(reverse=True)
p, m = [], []
while len(p) + len(m) < k:
if len(P) > 0 and len(M) <= 0:
p.append(P.pop())
elif len(P) <= 0 and len(M) > 0:
m.append(M.pop())
elif P[-1] < -M[-1]:
m.append(M.pop())
else:
... | def solve():
can_positive = False
if len(P) > 0:
if k < n:
can_positive = True
else:
can_positive = len(M) % 2 == 0
else:
can_positive = k % 2 == 0
if not can_positive:
return sorted(P + M, key=lambda x: abs(x))[:k]
P.sort()
M.sort(reverse=... | false | 38.461538 | [
"+ can_positive = False",
"+ if len(P) > 0:",
"+ if k < n:",
"+ can_positive = True",
"+ else:",
"+ can_positive = len(M) % 2 == 0",
"+ else:",
"+ can_positive = k % 2 == 0",
"+ if not can_positive:",
"+ return sorted(P + M, key=lambda ... | false | 0.068466 | 0.079799 | 0.857982 | [
"s792114965",
"s222171514"
] |
u790710233 | p02793 | python | s958028844 | s905800264 | 962 | 580 | 4,704 | 4,708 | Accepted | Accepted | 39.71 | from functools import reduce
MOD = 10**9+7
n = int(eval(input()))
A = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def lcm(a, b):
return (a*b)//gcd(a, b)
x = reduce(lcm, A) % MOD
print((sum(x*pow(a, MOD-2, MOD) for a in A) % MOD))
| from functools import reduce
MOD = 10**9+7
n = int(eval(input()))
A = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def lcm(a, b):
return a*(b//gcd(a, b))
x = reduce(lcm, A) % MOD
print((sum(x*pow(a, MOD-2, MOD) for a in A) % MOD)) | 17 | 18 | 307 | 308 | from functools import reduce
MOD = 10**9 + 7
n = int(eval(input()))
A = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def lcm(a, b):
return (a * b) // gcd(a, b)
x = reduce(lcm, A) % MOD
print((sum(x * pow(a, MOD - 2, MOD) for a in A) % MOD))
| from functools import reduce
MOD = 10**9 + 7
n = int(eval(input()))
A = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def lcm(a, b):
return a * (b // gcd(a, b))
x = reduce(lcm, A) % MOD
print((sum(x * pow(a, MOD - 2, MOD) for a in A) % MOD))
| false | 5.555556 | [
"- return (a * b) // gcd(a, b)",
"+ return a * (b // gcd(a, b))"
] | false | 0.036093 | 0.037035 | 0.974553 | [
"s958028844",
"s905800264"
] |
u935558307 | p02588 | python | s423101296 | s733995552 | 622 | 494 | 76,884 | 75,464 | Accepted | Accepted | 20.58 | def div(n, d):
cnt = 0
while n % d == 0 and cnt < 18:
n //= d
cnt += 1
return cnt
n = int(eval(input()))
dp = [[0]*19 for _ in range(19)]
#dp[i][j] -> 2の素因数がi以上,5の素因数がj以上の数字の数
ans = 0
for _ in range(n):
x = round(float(eval(input())) * pow(10, 9))
two = div(x, 2)
... | """
小数の状態だと処理しづらいので、与えられた数を全て10**9倍して小数を確実になくした上で
問題文を下記のように言い換える。
「積が10**18の倍数になるような数の組み合わせの数がいくつあるか」
数Aiがあり、Aiの2の素因数の数がn, 5の素因数の数がmのとき、
数Ai自体ですでにmin(n,m)個の0の数を持っている。この場合、のこり必要な0の数はx = 18-min(n,m)個である。
ここで、n == mの場合:
Aiの相方は少なくとも2,5の素因数をそれぞれx個以上持っていなくてはならない。
n > mの場合:
Aiの相方は少なくとも2の素因数をx-(n-m)個、5の素因数をx個持っていなくては... | 23 | 33 | 470 | 825 | def div(n, d):
cnt = 0
while n % d == 0 and cnt < 18:
n //= d
cnt += 1
return cnt
n = int(eval(input()))
dp = [[0] * 19 for _ in range(19)]
# dp[i][j] -> 2の素因数がi以上,5の素因数がj以上の数字の数
ans = 0
for _ in range(n):
x = round(float(eval(input())) * pow(10, 9))
two = div(x, 2)
five = div(... | """
小数の状態だと処理しづらいので、与えられた数を全て10**9倍して小数を確実になくした上で
問題文を下記のように言い換える。
「積が10**18の倍数になるような数の組み合わせの数がいくつあるか」
数Aiがあり、Aiの2の素因数の数がn, 5の素因数の数がmのとき、
数Ai自体ですでにmin(n,m)個の0の数を持っている。この場合、のこり必要な0の数はx = 18-min(n,m)個である。
ここで、n == mの場合:
Aiの相方は少なくとも2,5の素因数をそれぞれx個以上持っていなくてはならない。
n > mの場合:
Aiの相方は少なくとも2の素因数をx-(n-m)個、5の素因数をx個持っていなくてはいけない。
m >... | false | 30.30303 | [
"-def div(n, d):",
"- cnt = 0",
"- while n % d == 0 and cnt < 18:",
"- n //= d",
"- cnt += 1",
"- return cnt",
"-",
"-",
"-n = int(eval(input()))",
"-dp = [[0] * 19 for _ in range(19)]",
"-# dp[i][j] -> 2の素因数がi以上,5の素因数がj以上の数字の数",
"+\"\"\"",
"+小数の状態だと処理しづらいので、与えられた数を全て1... | false | 0.095591 | 0.108623 | 0.880024 | [
"s423101296",
"s733995552"
] |
u348805958 | p02775 | python | s208061542 | s550703264 | 513 | 410 | 13,676 | 13,680 | Accepted | Accepted | 20.08 | #!python3
iim = lambda: list(map(int, input().rstrip().split()))
def resolve():
n = [int(c) for c in "0" + eval(input())]
I = len(n)
ans = 0
for i in range(I-1, -1, -1):
b = n[i]
if b < 5:
ans += b
elif b == 5:
for j in range(2):
... | #!python3
iim = lambda: list(map(int, input().rstrip().split()))
def resolve():
n = [int(c) for c in "0" + eval(input())]
I = len(n)
ans = 0
for i in range(I-1, -1, -1):
b = n[i]
if b < 5:
ans += b
elif b == 5:
c = n[i-1]
ans +=... | 33 | 24 | 762 | 492 | #!python3
iim = lambda: list(map(int, input().rstrip().split()))
def resolve():
n = [int(c) for c in "0" + eval(input())]
I = len(n)
ans = 0
for i in range(I - 1, -1, -1):
b = n[i]
if b < 5:
ans += b
elif b == 5:
for j in range(2):
c = n[... | #!python3
iim = lambda: list(map(int, input().rstrip().split()))
def resolve():
n = [int(c) for c in "0" + eval(input())]
I = len(n)
ans = 0
for i in range(I - 1, -1, -1):
b = n[i]
if b < 5:
ans += b
elif b == 5:
c = n[i - 1]
ans += b
... | false | 27.272727 | [
"- for j in range(2):",
"- c = n[i - j - 1]",
"- cn = 5 - j",
"- if c < cn:",
"- ans += b",
"- break",
"- elif c > cn:",
"- ans += b",
"- n[i - 1] += 1",... | false | 0.045707 | 0.107897 | 0.423611 | [
"s208061542",
"s550703264"
] |
u052499405 | p03415 | python | s443888646 | s290487680 | 166 | 17 | 38,256 | 3,064 | Accepted | Accepted | 89.76 | for i in range(3):
print(input()[i], end="")
print("")
| a = input().rstrip()
b = input().rstrip()
c = input().rstrip()
print((a[0] + b[1] + c[2])) | 3 | 4 | 58 | 91 | for i in range(3):
print(input()[i], end="")
print("")
| a = input().rstrip()
b = input().rstrip()
c = input().rstrip()
print((a[0] + b[1] + c[2]))
| false | 25 | [
"-for i in range(3):",
"- print(input()[i], end=\"\")",
"-print(\"\")",
"+a = input().rstrip()",
"+b = input().rstrip()",
"+c = input().rstrip()",
"+print((a[0] + b[1] + c[2]))"
] | false | 0.128025 | 0.046277 | 2.76651 | [
"s443888646",
"s290487680"
] |
u677121387 | p02585 | python | s216992471 | s882278864 | 805 | 475 | 98,104 | 80,628 | Accepted | Accepted | 40.99 | n,k = list(map(int,input().split()))
p = [int(i)-1 for i in input().split()]
c = [int(i) for i in input().split()]
INF = float("INF")
ans = -INF
for i in range(n):
flag = [False]*n
now = i
cnt = 0
j = 0
mlst = [-INF]*n
m = -INF
while not flag[now]:
flag[now] = True
... | n,k = list(map(int,input().split()))
p = [int(i)-1 for i in input().split()]
c = [int(i) for i in input().split()]
INF = float("INF")
ans = -INF
for si in range(n):
x = si
S = []
tot = 0
while True:
x = p[x]
S.append(c[x])
tot += c[x]
if x == si: break
... | 28 | 26 | 699 | 541 | n, k = list(map(int, input().split()))
p = [int(i) - 1 for i in input().split()]
c = [int(i) for i in input().split()]
INF = float("INF")
ans = -INF
for i in range(n):
flag = [False] * n
now = i
cnt = 0
j = 0
mlst = [-INF] * n
m = -INF
while not flag[now]:
flag[now] = True
no... | n, k = list(map(int, input().split()))
p = [int(i) - 1 for i in input().split()]
c = [int(i) for i in input().split()]
INF = float("INF")
ans = -INF
for si in range(n):
x = si
S = []
tot = 0
while True:
x = p[x]
S.append(c[x])
tot += c[x]
if x == si:
break
... | false | 7.142857 | [
"-for i in range(n):",
"- flag = [False] * n",
"- now = i",
"- cnt = 0",
"- j = 0",
"- mlst = [-INF] * n",
"- m = -INF",
"- while not flag[now]:",
"- flag[now] = True",
"- now = p[now]",
"- cnt += c[now]",
"- m = max(cnt, m)",
"- mlst[j... | false | 0.035471 | 0.042927 | 0.826292 | [
"s216992471",
"s882278864"
] |
u063052907 | p03611 | python | s357692913 | s759109117 | 155 | 103 | 14,564 | 15,996 | Accepted | Accepted | 33.55 | from collections import Counter
N = int(eval(input()))
lst_A = list(map(int, input().split()))
# set_A = set(lst_A)
cnt_A = Counter(lst_A)
ans = 0
# for key in set_A:
for key in lst_A:
cnt_X = cnt_A[key - 1] + cnt_A[key] + cnt_A[key + 1]
ans = max(ans, cnt_X)
print(ans) | N = int(eval(input()))
lst_A = list(map(int, input().split()))
lst_cnt = [0] * (10**6)
ans = 0
for a in lst_A:
lst_cnt[a - 1] += 1
lst_cnt[a] += 1
lst_cnt[a + 1] += 1
ans = max(lst_cnt)
print(ans) | 17 | 14 | 294 | 219 | from collections import Counter
N = int(eval(input()))
lst_A = list(map(int, input().split()))
# set_A = set(lst_A)
cnt_A = Counter(lst_A)
ans = 0
# for key in set_A:
for key in lst_A:
cnt_X = cnt_A[key - 1] + cnt_A[key] + cnt_A[key + 1]
ans = max(ans, cnt_X)
print(ans)
| N = int(eval(input()))
lst_A = list(map(int, input().split()))
lst_cnt = [0] * (10**6)
ans = 0
for a in lst_A:
lst_cnt[a - 1] += 1
lst_cnt[a] += 1
lst_cnt[a + 1] += 1
ans = max(lst_cnt)
print(ans)
| false | 17.647059 | [
"-from collections import Counter",
"-",
"-# set_A = set(lst_A)",
"-cnt_A = Counter(lst_A)",
"+lst_cnt = [0] * (10**6)",
"-# for key in set_A:",
"-for key in lst_A:",
"- cnt_X = cnt_A[key - 1] + cnt_A[key] + cnt_A[key + 1]",
"- ans = max(ans, cnt_X)",
"+for a in lst_A:",
"+ lst_cnt[a - ... | false | 0.076597 | 0.060131 | 1.273841 | [
"s357692913",
"s759109117"
] |
u126478680 | p02288 | python | s458199663 | s794667167 | 1,630 | 1,430 | 60,532 | 63,696 | Accepted | Accepted | 12.27 | from collections import deque
class PriorityQueue:
def __init__(self):
self.nodes = []
def max_heapify(self, i):
if i >= len(self.nodes): return
left, right = (i+1)*2-1, (i+1)*2
largest = i
if left < len(self.nodes) and self.nodes[i] < self.nodes[left]: larg... | n = int(input())
H = list(map(int, input().split(' ')))
def max_heapify(i):
l = (i+1)*2-1
r = (i+1)*2
largest = i
if l < n and H[l] > H[i]:
largest = l
else:
largest = i
if r < n and H[r] > H[largest]:
largest = r
if largest != i:
H[i], H[larg... | 33 | 27 | 881 | 558 | from collections import deque
class PriorityQueue:
def __init__(self):
self.nodes = []
def max_heapify(self, i):
if i >= len(self.nodes):
return
left, right = (i + 1) * 2 - 1, (i + 1) * 2
largest = i
if left < len(self.nodes) and self.nodes[i] < self.nodes[... | n = int(input())
H = list(map(int, input().split(" ")))
def max_heapify(i):
l = (i + 1) * 2 - 1
r = (i + 1) * 2
largest = i
if l < n and H[l] > H[i]:
largest = l
else:
largest = i
if r < n and H[r] > H[largest]:
largest = r
if largest != i:
H[i], H[largest] ... | false | 18.181818 | [
"-from collections import deque",
"+n = int(input())",
"+H = list(map(int, input().split(\" \")))",
"-class PriorityQueue:",
"- def __init__(self):",
"- self.nodes = []",
"-",
"- def max_heapify(self, i):",
"- if i >= len(self.nodes):",
"- return",
"- left, ... | false | 0.043016 | 0.103175 | 0.416922 | [
"s458199663",
"s794667167"
] |
u747602774 | p02888 | python | s229870682 | s187487184 | 1,360 | 1,230 | 3,188 | 3,188 | Accepted | Accepted | 9.56 | import bisect
N = int(eval(input()))
L = list(map(int,input().split()))
L.sort()
ans = 0
for i in range(N-2):
a = L[i]
for j in range(i+1,N-1):
b = L[j]
c = bisect.bisect_left(L,a+b)
ans += c-j-1
print(ans)
| n = int(eval(input()))
l = list(map(int,input().split()))
l.sort()
from bisect import bisect_left
ans = 0
for i in range(n):
a = l[i]
for j in range(i+1,n):
b = l[j]
ans += bisect_left(l,a+b)-j-1
print(ans)
| 13 | 13 | 246 | 239 | import bisect
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N - 2):
a = L[i]
for j in range(i + 1, N - 1):
b = L[j]
c = bisect.bisect_left(L, a + b)
ans += c - j - 1
print(ans)
| n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
from bisect import bisect_left
ans = 0
for i in range(n):
a = l[i]
for j in range(i + 1, n):
b = l[j]
ans += bisect_left(l, a + b) - j - 1
print(ans)
| false | 0 | [
"-import bisect",
"+n = int(eval(input()))",
"+l = list(map(int, input().split()))",
"+l.sort()",
"+from bisect import bisect_left",
"-N = int(eval(input()))",
"-L = list(map(int, input().split()))",
"-L.sort()",
"-for i in range(N - 2):",
"- a = L[i]",
"- for j in range(i + 1, N - 1):",
... | false | 0.06946 | 0.046232 | 1.502434 | [
"s229870682",
"s187487184"
] |
u888092736 | p02837 | python | s602063570 | s158271883 | 809 | 171 | 3,188 | 3,064 | Accepted | Accepted | 78.86 | N = int(eval(input()))
T = [[-1] * N for _ in range(N)]
for i in range(N):
for _ in range(int(eval(input()))):
x, y = list(map(int, input().split()))
T[i][x - 1] = y
ans = 0
for i in range(1 << N):
is_kind = [i >> j & 1 for j in range(N)]
found = True
for j in range(N):
... | N = int(eval(input()))
T = []
for i in range(N):
for _ in range(int(eval(input()))):
x, y = list(map(int, input().split()))
T.append((i, x - 1, y))
ans = 0
for i in range(1 << N):
is_kind = [i >> j & 1 for j in range(N)]
if all(not is_kind[j] or is_kind[x] == y for j, x ,y in T):
... | 23 | 13 | 601 | 352 | N = int(eval(input()))
T = [[-1] * N for _ in range(N)]
for i in range(N):
for _ in range(int(eval(input()))):
x, y = list(map(int, input().split()))
T[i][x - 1] = y
ans = 0
for i in range(1 << N):
is_kind = [i >> j & 1 for j in range(N)]
found = True
for j in range(N):
if not is... | N = int(eval(input()))
T = []
for i in range(N):
for _ in range(int(eval(input()))):
x, y = list(map(int, input().split()))
T.append((i, x - 1, y))
ans = 0
for i in range(1 << N):
is_kind = [i >> j & 1 for j in range(N)]
if all(not is_kind[j] or is_kind[x] == y for j, x, y in T):
ans... | false | 43.478261 | [
"-T = [[-1] * N for _ in range(N)]",
"+T = []",
"- T[i][x - 1] = y",
"+ T.append((i, x - 1, y))",
"- found = True",
"- for j in range(N):",
"- if not is_kind[j]:",
"- continue",
"- for k in range(N):",
"- if j == k or T[j][k] == -1 or T[j][k]... | false | 0.084669 | 0.077727 | 1.089312 | [
"s602063570",
"s158271883"
] |
u256678932 | p02413 | python | s122833765 | s719960826 | 30 | 20 | 7,812 | 5,680 | Accepted | Accepted | 33.33 | r, c = list(map(int, input().split(' ')))
matrix = []
total_cols = [0 for i in range(c+1)]
for i in range(r):
rows = list(map(int, input().split(' ')));
total = sum(rows)
rows.append(total)
total_cols = [ total_cols[i] + x for i, x in enumerate(rows) ]
matrix.append(rows)
matri... | def main():
r, c = [int(x) for x in input().split()]
matrix = []
totals = [0 for _ in range(c+1)]
for _ in range(r):
nums = [int(x) for x in input().split()]
total = sum(nums)
row = nums + [total]
matrix.append(row)
for i in range(c+1):
... | 19 | 24 | 400 | 486 | r, c = list(map(int, input().split(" ")))
matrix = []
total_cols = [0 for i in range(c + 1)]
for i in range(r):
rows = list(map(int, input().split(" ")))
total = sum(rows)
rows.append(total)
total_cols = [total_cols[i] + x for i, x in enumerate(rows)]
matrix.append(rows)
matrix.append(total_cols)
fo... | def main():
r, c = [int(x) for x in input().split()]
matrix = []
totals = [0 for _ in range(c + 1)]
for _ in range(r):
nums = [int(x) for x in input().split()]
total = sum(nums)
row = nums + [total]
matrix.append(row)
for i in range(c + 1):
totals[i] +... | false | 20.833333 | [
"-r, c = list(map(int, input().split(\" \")))",
"-matrix = []",
"-total_cols = [0 for i in range(c + 1)]",
"-for i in range(r):",
"- rows = list(map(int, input().split(\" \")))",
"- total = sum(rows)",
"- rows.append(total)",
"- total_cols = [total_cols[i] + x for i, x in enumerate(rows)]"... | false | 0.039454 | 0.042442 | 0.929592 | [
"s122833765",
"s719960826"
] |
u489959379 | p02727 | python | s480681838 | s269481432 | 331 | 160 | 22,720 | 29,124 | Accepted | Accepted | 51.66 | x, y, a, b, c = list(map(int, input().split()))
p = sorted(list(map(int, input().split())), reverse=True)
q = sorted(list(map(int, input().split())), reverse=True)
r = sorted(list(map(int, input().split())), reverse=True)
all = []
for i in range(x):
all.append(p[i])
for i in range(y):
all.append(q[i])
... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
x, y, a, b, c = list(map(int, input().split()))
P = sorted(list(map(int, input().split())), reverse=True)
Q = sorted(list(map(int, input().split())), reverse=True)
R ... | 16 | 19 | 451 | 504 | x, y, a, b, c = list(map(int, input().split()))
p = sorted(list(map(int, input().split())), reverse=True)
q = sorted(list(map(int, input().split())), reverse=True)
r = sorted(list(map(int, input().split())), reverse=True)
all = []
for i in range(x):
all.append(p[i])
for i in range(y):
all.append(q[i])
for i in ... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
x, y, a, b, c = list(map(int, input().split()))
P = sorted(list(map(int, input().split())), reverse=True)
Q = sorted(list(map(int, input().split())), reverse=True)
R = sorted(list(ma... | false | 15.789474 | [
"-x, y, a, b, c = list(map(int, input().split()))",
"-p = sorted(list(map(int, input().split())), reverse=True)",
"-q = sorted(list(map(int, input().split())), reverse=True)",
"-r = sorted(list(map(int, input().split())), reverse=True)",
"-all = []",
"-for i in range(x):",
"- all.append(p[i])",
"-f... | false | 0.125013 | 0.074271 | 1.683204 | [
"s480681838",
"s269481432"
] |
u707808519 | p02683 | python | s088159675 | s869284426 | 97 | 35 | 68,744 | 9,280 | Accepted | Accepted | 63.92 | N, M, X = list(map(int,input().split()))
A = [[int(x) for x in input().split()] for _ in range(N)]
INF = float('inf')
ans = INF
for i in range(2**N):
tmp = [0 for _ in range(M+1)]
b = bin(i)[2:].zfill(N)
for n in range(N):
for m in range(M+1):
tmp[m] += A[n][m] * int(b... | INF = float('inf')
import copy
def dfs(i, C):
if i == N:
if min(C[1:]) >= X:
return C[0]
else:
return INF
res = INF
res = min(res, dfs(i+1, copy.copy(C)))
for j in range(M+1):
C[j] = C[j] + L[i][j]
res = min(res, dfs(i+1, copy.copy(C)))
... | 20 | 23 | 427 | 516 | N, M, X = list(map(int, input().split()))
A = [[int(x) for x in input().split()] for _ in range(N)]
INF = float("inf")
ans = INF
for i in range(2**N):
tmp = [0 for _ in range(M + 1)]
b = bin(i)[2:].zfill(N)
for n in range(N):
for m in range(M + 1):
tmp[m] += A[n][m] * int(b[N - 1 - n])
... | INF = float("inf")
import copy
def dfs(i, C):
if i == N:
if min(C[1:]) >= X:
return C[0]
else:
return INF
res = INF
res = min(res, dfs(i + 1, copy.copy(C)))
for j in range(M + 1):
C[j] = C[j] + L[i][j]
res = min(res, dfs(i + 1, copy.copy(C)))
ret... | false | 13.043478 | [
"+INF = float(\"inf\")",
"+import copy",
"+",
"+",
"+def dfs(i, C):",
"+ if i == N:",
"+ if min(C[1:]) >= X:",
"+ return C[0]",
"+ else:",
"+ return INF",
"+ res = INF",
"+ res = min(res, dfs(i + 1, copy.copy(C)))",
"+ for j in range(M + 1):",
... | false | 0.154273 | 0.121652 | 1.268144 | [
"s088159675",
"s869284426"
] |
u323680411 | p04045 | python | s618553523 | s313719974 | 52 | 44 | 2,940 | 2,940 | Accepted | Accepted | 15.38 | N, K = list(map(int, input().split()))
D = input().split()
n = N
while True:
for c in str(n):
if c in D:
break
else:
break
n += 1
print(n) | N, K = list(map(int, input().split()))
D = set(input().split())
n = N
while True:
for c in str(n):
if c in D:
break
else:
break
n += 1
print(n) | 14 | 14 | 188 | 193 | N, K = list(map(int, input().split()))
D = input().split()
n = N
while True:
for c in str(n):
if c in D:
break
else:
break
n += 1
print(n)
| N, K = list(map(int, input().split()))
D = set(input().split())
n = N
while True:
for c in str(n):
if c in D:
break
else:
break
n += 1
print(n)
| false | 0 | [
"-D = input().split()",
"+D = set(input().split())"
] | false | 0.041224 | 0.15399 | 0.267708 | [
"s618553523",
"s313719974"
] |
u796942881 | p03274 | python | s042016061 | s997467702 | 94 | 84 | 14,660 | 14,224 | Accepted | Accepted | 10.64 | MAX = 300000001
N, K = list(map(int, input().split()))
xn = [int(i) for i in input().split()]
def main():
if 0 <= xn[0]:
print((xn[K - 1]))
return
if xn[N - 1] < 0:
print((abs(xn[N - K])))
return
ans = MAX
for i in range(N - K + 1):
if xn[i... | MAX = 300000001
N, K = list(map(int, input().split()))
xn = [int(i) for i in input().split()]
def main():
if 0 <= xn[0]:
print((xn[K - 1]))
return
if xn[N - 1] < 0:
print((abs(xn[N - K])))
return
ans = MAX
for i in range(N - K + 1):
ans = m... | 31 | 27 | 628 | 472 | MAX = 300000001
N, K = list(map(int, input().split()))
xn = [int(i) for i in input().split()]
def main():
if 0 <= xn[0]:
print((xn[K - 1]))
return
if xn[N - 1] < 0:
print((abs(xn[N - K])))
return
ans = MAX
for i in range(N - K + 1):
if xn[i + K - 1] < 0 and i + ... | MAX = 300000001
N, K = list(map(int, input().split()))
xn = [int(i) for i in input().split()]
def main():
if 0 <= xn[0]:
print((xn[K - 1]))
return
if xn[N - 1] < 0:
print((abs(xn[N - K])))
return
ans = MAX
for i in range(N - K + 1):
ans = min(
ans,
... | false | 12.903226 | [
"- if xn[i + K - 1] < 0 and i + K <= N - 1 and 0 < xn[i + K]:",
"- ans = min(ans, abs(xn[i]))",
"- elif 0 <= xn[i + K - 1]:",
"- ans = min(",
"- ans,",
"- 2 * abs(xn[i]) + abs(xn[i + K - 1]),",
"- abs(xn[i]) + 2 * abs(xn[i ... | false | 0.045947 | 0.046077 | 0.997174 | [
"s042016061",
"s997467702"
] |
u879870653 | p03221 | python | s987255040 | s216521718 | 938 | 723 | 55,108 | 42,140 | Accepted | Accepted | 22.92 | N,M = list(map(int,input().split()))
L = []
ans = []
for i in range(M) :
L.append(list(map(int,input().split())))
ans.append([])
C = []
for i in range(N+1) :
C.append([])
for i, (p,y) in enumerate(L) :
C[p].append([y,i])
for p in range(N+1) :
for i,(y,_) in enumerate(sorted(C[p])) ... | from bisect import *
N,M = list(map(int,input().split()))
L = [list(map(int,input().split())) for i in range(M)]
D = {}
for i in range(M) :
p, y = L[i]
if p not in D :
D[p] = [y]
else :
D[p].append(y)
for p in D :
D[p] = sorted(D[p])
for i in range(M) :
p, y = L[i]... | 19 | 20 | 410 | 412 | N, M = list(map(int, input().split()))
L = []
ans = []
for i in range(M):
L.append(list(map(int, input().split())))
ans.append([])
C = []
for i in range(N + 1):
C.append([])
for i, (p, y) in enumerate(L):
C[p].append([y, i])
for p in range(N + 1):
for i, (y, _) in enumerate(sorted(C[p])):
an... | from bisect import *
N, M = list(map(int, input().split()))
L = [list(map(int, input().split())) for i in range(M)]
D = {}
for i in range(M):
p, y = L[i]
if p not in D:
D[p] = [y]
else:
D[p].append(y)
for p in D:
D[p] = sorted(D[p])
for i in range(M):
p, y = L[i]
ind = bisect_le... | false | 5 | [
"+from bisect import *",
"+",
"-L = []",
"-ans = []",
"+L = [list(map(int, input().split())) for i in range(M)]",
"+D = {}",
"- L.append(list(map(int, input().split())))",
"- ans.append([])",
"-C = []",
"-for i in range(N + 1):",
"- C.append([])",
"-for i, (p, y) in enumerate(L):",
... | false | 0.044405 | 0.043389 | 1.023427 | [
"s987255040",
"s216521718"
] |
u347600233 | p02676 | python | s208501570 | s484702730 | 24 | 20 | 9,104 | 9,156 | Accepted | Accepted | 16.67 | k = int(eval(input()))
s = eval(input())
if len(s) <= k:
print(s)
else:
print((s[:k] + '...')) | k = int(eval(input()))
s = eval(input())
if len(s) > k:
s = s[:k] + '...'
print(s) | 6 | 5 | 93 | 78 | k = int(eval(input()))
s = eval(input())
if len(s) <= k:
print(s)
else:
print((s[:k] + "..."))
| k = int(eval(input()))
s = eval(input())
if len(s) > k:
s = s[:k] + "..."
print(s)
| false | 16.666667 | [
"-if len(s) <= k:",
"- print(s)",
"-else:",
"- print((s[:k] + \"...\"))",
"+if len(s) > k:",
"+ s = s[:k] + \"...\"",
"+print(s)"
] | false | 0.049215 | 0.036792 | 1.337667 | [
"s208501570",
"s484702730"
] |
u119148115 | p03476 | python | s887436523 | s371468335 | 384 | 161 | 65,628 | 82,340 | Accepted | Accepted | 58.07 | import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
Q = I()
lr = [LI() for i in range(Q)]
import math
def sieve_of_eratosthenes(n):
prime_list = [] # n以下の素数のリスト
A = [1]*(n+1) # A[i] = iが素数なら1,その他は0
A[... | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def ... | 47 | 50 | 1,166 | 1,272 | import sys
def I():
return int(sys.stdin.readline().rstrip())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
Q = I()
lr = [LI() for i in range(Q)]
import math
def sieve_of_eratosthenes(n):
prime_list = [] # n以下の素数のリスト
A = [1] * (n + 1) # A[i] = iが素数なら1,その他は0
... | import sys
sys.setrecursionlimit(10**7)
def I():
return int(sys.stdin.readline().rstrip())
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
def LI2():
return list(map(int, sys.stdin.readline().r... | false | 6 | [
"+",
"+sys.setrecursionlimit(10**7)",
"+def MI():",
"+ return list(map(int, sys.stdin.readline().rstrip().split()))",
"+",
"+",
"-Q = I()",
"-lr = [LI() for i in range(Q)]",
"+def LI2():",
"+ return list(map(int, sys.stdin.readline().rstrip())) # 空白なし",
"+",
"+",
"+def S():",
"+ ... | false | 0.104201 | 0.089642 | 1.162412 | [
"s887436523",
"s371468335"
] |
u077291787 | p02937 | python | s726874123 | s117829376 | 120 | 103 | 7,924 | 7,924 | Accepted | Accepted | 14.17 | # ABC138E - Strings of Impurity
from bisect import bisect_left as bs
from collections import defaultdict
def main():
S, T = tuple(eval(input()) for _ in range(2))
if not set(T) <= set(S): # corner case
print((-1))
return
idx, ls = defaultdict(list), len(S)
for i, s in enume... | # ABC138E - Strings of Impurity
from bisect import bisect_left as bs
from collections import defaultdict
def main():
S, T = tuple(eval(input()) for _ in range(2))
idx, ls = defaultdict(list), len(S)
for i, s in enumerate(S):
idx[s] += [i]
roop, cur = 0, -1
for t in T:
t... | 27 | 27 | 628 | 627 | # ABC138E - Strings of Impurity
from bisect import bisect_left as bs
from collections import defaultdict
def main():
S, T = tuple(eval(input()) for _ in range(2))
if not set(T) <= set(S): # corner case
print((-1))
return
idx, ls = defaultdict(list), len(S)
for i, s in enumerate(S):
... | # ABC138E - Strings of Impurity
from bisect import bisect_left as bs
from collections import defaultdict
def main():
S, T = tuple(eval(input()) for _ in range(2))
idx, ls = defaultdict(list), len(S)
for i, s in enumerate(S):
idx[s] += [i]
roop, cur = 0, -1
for t in T:
tgt = idx[t]
... | false | 0 | [
"- if not set(T) <= set(S): # corner case",
"- print((-1))",
"- return",
"- cur = -1",
"+ roop, cur = 0, -1",
"- x = (cur + 1) % ls",
"- i = bs(tgt, x)",
"- if i < len(tgt):",
"- cur += 1 + tgt[i] - x",
"+ if tgt == []: # t not in S",... | false | 0.05464 | 0.112808 | 0.484359 | [
"s726874123",
"s117829376"
] |
u629607744 | p02899 | python | s125537194 | s784987425 | 259 | 175 | 25,560 | 13,880 | Accepted | Accepted | 32.43 | n = int(input())
a = [int(i) for i in input().split()]
dic={}
for i in range(n):
dic[i]=a[i]
dic = sorted(dic.items(), key=lambda x:x[1])
for i in dic:
print(i[0]+1,end=' ')
| n = int(input())
a = [int(i) for i in input().split()]
box = [0]*n
for i in range(n):
box[a[i]-1] = i+1
for i in box:
print(i,end=' ')
| 8 | 7 | 182 | 142 | n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for i in range(n):
dic[i] = a[i]
dic = sorted(dic.items(), key=lambda x: x[1])
for i in dic:
print(i[0] + 1, end=" ")
| n = int(input())
a = [int(i) for i in input().split()]
box = [0] * n
for i in range(n):
box[a[i] - 1] = i + 1
for i in box:
print(i, end=" ")
| false | 12.5 | [
"-dic = {}",
"+box = [0] * n",
"- dic[i] = a[i]",
"-dic = sorted(dic.items(), key=lambda x: x[1])",
"-for i in dic:",
"- print(i[0] + 1, end=\" \")",
"+ box[a[i] - 1] = i + 1",
"+for i in box:",
"+ print(i, end=\" \")"
] | false | 0.041642 | 0.042015 | 0.991104 | [
"s125537194",
"s784987425"
] |
u513434790 | p03045 | python | s758584073 | s630376759 | 478 | 431 | 5,580 | 7,304 | Accepted | Accepted | 9.83 | N, M = list(map(int, input().split()))
ans = [-1] * N
def find(x):
global ans
if ans[x] == -1:
return x
else:
ans[x] = find(ans[x])
return ans[x]
for _ in range(M):
x, y, z = list(map(int, input().split()))
x -= 1
y -= 1
xx = find(x)
yy = fin... | N, M = list(map(int, input().split()))
UF = [-1] * (N+1)
def find(x):
global UF
if UF[x] == -1:
return x
else:
UF[x] = find(UF[x])
return UF[x]
def union(x,y):
global UF
xx = find(x)
yy = find(y)
if UF[x] == UF[y] == -1:
UF[y] = xx
retur... | 30 | 27 | 504 | 527 | N, M = list(map(int, input().split()))
ans = [-1] * N
def find(x):
global ans
if ans[x] == -1:
return x
else:
ans[x] = find(ans[x])
return ans[x]
for _ in range(M):
x, y, z = list(map(int, input().split()))
x -= 1
y -= 1
xx = find(x)
yy = find(y)
if ans[x]... | N, M = list(map(int, input().split()))
UF = [-1] * (N + 1)
def find(x):
global UF
if UF[x] == -1:
return x
else:
UF[x] = find(UF[x])
return UF[x]
def union(x, y):
global UF
xx = find(x)
yy = find(y)
if UF[x] == UF[y] == -1:
UF[y] = xx
return
el... | false | 10 | [
"-ans = [-1] * N",
"+UF = [-1] * (N + 1)",
"- global ans",
"- if ans[x] == -1:",
"+ global UF",
"+ if UF[x] == -1:",
"- ans[x] = find(ans[x])",
"- return ans[x]",
"+ UF[x] = find(UF[x])",
"+ return UF[x]",
"+",
"+",
"+def union(x, y):",
"+ global ... | false | 0.040908 | 0.046165 | 0.88612 | [
"s758584073",
"s630376759"
] |
u416011173 | p02622 | python | s864297345 | s541667502 | 65 | 44 | 9,388 | 9,548 | Accepted | Accepted | 32.31 | # -*- coding: utf-8 -*-
# 標準入力を取得
S = eval(input())
T = eval(input())
# 求解処理
ans = 0
for s, t in zip(S, T):
ans += (s != t)
# 結果出力
print(ans)
| # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
S = eval(input())
T = eval(input())
return S, T
def main(S: str, T: str) -> None:
"""
メイン処理.
Args:\n
S (str): 文字列
T (str): 文字列
"""
... | 12 | 38 | 147 | 517 | # -*- coding: utf-8 -*-
# 標準入力を取得
S = eval(input())
T = eval(input())
# 求解処理
ans = 0
for s, t in zip(S, T):
ans += s != t
# 結果出力
print(ans)
| # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
S = eval(input())
T = eval(input())
return S, T
def main(S: str, T: str) -> None:
"""
メイン処理.
Args:\n
S (str): 文字列
T (str): 文字列
"""
# 求解処理
ans = 0
... | false | 68.421053 | [
"-# 標準入力を取得",
"-S = eval(input())",
"-T = eval(input())",
"-# 求解処理",
"-ans = 0",
"-for s, t in zip(S, T):",
"- ans += s != t",
"-# 結果出力",
"-print(ans)",
"+def get_input() -> tuple:",
"+ \"\"\"",
"+ 標準入力を取得する.",
"+ Returns:\\n",
"+ tuple: 標準入力",
"+ \"\"\"",
"+ S... | false | 0.035792 | 0.058388 | 0.613001 | [
"s864297345",
"s541667502"
] |
u018679195 | p03261 | python | s868363673 | s687775728 | 19 | 17 | 3,064 | 3,064 | Accepted | Accepted | 10.53 | n=int(eval(input()))
s=[]
for i in range (n):
s.append('a')
for i in range(n):
s[i]= [j for j in eval(input())]
flag=True
for i in range(n-1):
k = len(s[i])
if s[i][k-1]==s[i+1][0]:
for j in range(n):
if s[i]==s[j] and i!=j:
flag=False
bre... | import sys
n = int(eval(input()))
w = []
for x in range(n):
w.append(eval(input()))
sw = sorted(w)
for i in range(1, len(sw)):
if sw[i - 1] == sw[i]:
print("No")
sys.exit()
for i in range(1, len(w)):
if w[i - 1][-1] != w[i][0]:
print("No")
sys.exit()
print("Ye... | 21 | 16 | 410 | 311 | n = int(eval(input()))
s = []
for i in range(n):
s.append("a")
for i in range(n):
s[i] = [j for j in eval(input())]
flag = True
for i in range(n - 1):
k = len(s[i])
if s[i][k - 1] == s[i + 1][0]:
for j in range(n):
if s[i] == s[j] and i != j:
flag = False
... | import sys
n = int(eval(input()))
w = []
for x in range(n):
w.append(eval(input()))
sw = sorted(w)
for i in range(1, len(sw)):
if sw[i - 1] == sw[i]:
print("No")
sys.exit()
for i in range(1, len(w)):
if w[i - 1][-1] != w[i][0]:
print("No")
sys.exit()
print("Yes")
| false | 23.809524 | [
"+import sys",
"+",
"-s = []",
"-for i in range(n):",
"- s.append(\"a\")",
"-for i in range(n):",
"- s[i] = [j for j in eval(input())]",
"-flag = True",
"-for i in range(n - 1):",
"- k = len(s[i])",
"- if s[i][k - 1] == s[i + 1][0]:",
"- for j in range(n):",
"- ... | false | 0.046459 | 0.046875 | 0.991141 | [
"s868363673",
"s687775728"
] |
u930705402 | p02868 | python | s660219293 | s298764955 | 559 | 384 | 95,496 | 93,284 | Accepted | Accepted | 31.31 | import sys
read=sys.stdin.readline
class segtree:
def __init__(self,n,op,e):
self.e=e
self.op=op
self.size=1<<(n-1).bit_length()
self.SEG=[self.e]*(self.size*2)
def update(self,i,x):
i+=self.size
self.SEG[i]=x
while i>0:
... | import sys
from heapq import heappush,heappop,heapify
read=sys.stdin.readline
INF=10**30
def dijkstra(G,s,n):
que=[(0,s)]
dist=[INF]*n
dist[s]=0
while que:
mincost,u=heappop(que)
if(mincost>dist[u]):
continue
for c,v in G[u]:
if(dist[u]+c<di... | 59 | 33 | 1,278 | 704 | import sys
read = sys.stdin.readline
class segtree:
def __init__(self, n, op, e):
self.e = e
self.op = op
self.size = 1 << (n - 1).bit_length()
self.SEG = [self.e] * (self.size * 2)
def update(self, i, x):
i += self.size
self.SEG[i] = x
while i > 0:
... | import sys
from heapq import heappush, heappop, heapify
read = sys.stdin.readline
INF = 10**30
def dijkstra(G, s, n):
que = [(0, s)]
dist = [INF] * n
dist[s] = 0
while que:
mincost, u = heappop(que)
if mincost > dist[u]:
continue
for c, v in G[u]:
if di... | false | 44.067797 | [
"+from heapq import heappush, heappop, heapify",
"+INF = 10**30",
"-class segtree:",
"- def __init__(self, n, op, e):",
"- self.e = e",
"- self.op = op",
"- self.size = 1 << (n - 1).bit_length()",
"- self.SEG = [self.e] * (self.size * 2)",
"-",
"- def update(self,... | false | 0.036495 | 0.036946 | 0.987788 | [
"s660219293",
"s298764955"
] |
u721316601 | p03607 | python | s815865955 | s609864505 | 195 | 79 | 16,632 | 16,628 | Accepted | Accepted | 59.49 | from collections import Counter
N = int(eval(input()))
A = Counter([int(eval(input())) for i in range(N)])
count = [1 for value in list(A.values()) if value % 2]
print((len(count))) | import sys
from collections import Counter
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = Counter([int(eval(input())) for i in range(N)])
print((sum([1 for c in list(A.values()) if c % 2])))
if __name__ == '__main__':
main()
| 6 | 14 | 167 | 258 | from collections import Counter
N = int(eval(input()))
A = Counter([int(eval(input())) for i in range(N)])
count = [1 for value in list(A.values()) if value % 2]
print((len(count)))
| import sys
from collections import Counter
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = Counter([int(eval(input())) for i in range(N)])
print((sum([1 for c in list(A.values()) if c % 2])))
if __name__ == "__main__":
main()
| false | 57.142857 | [
"+import sys",
"-N = int(eval(input()))",
"-A = Counter([int(eval(input())) for i in range(N)])",
"-count = [1 for value in list(A.values()) if value % 2]",
"-print((len(count)))",
"+input = sys.stdin.readline",
"+",
"+",
"+def main():",
"+ N = int(eval(input()))",
"+ A = Counter([int(eval... | false | 0.041777 | 0.038572 | 1.083077 | [
"s815865955",
"s609864505"
] |
u815878613 | p02842 | python | s162915961 | s602265761 | 30 | 17 | 2,940 | 3,064 | Accepted | Accepted | 43.33 | N = int(eval(input()))
for a in range(0, N+1):
if int(a * 1.08) == N:
print(a)
break
else:
print(':(')
| N = int(eval(input()))
X = int(N / 1.08)
for x in range(X - 1, X + 2):
if int(x * 1.08) == N:
print(x)
break
else:
print(':(')
| 9 | 9 | 131 | 154 | N = int(eval(input()))
for a in range(0, N + 1):
if int(a * 1.08) == N:
print(a)
break
else:
print(":(")
| N = int(eval(input()))
X = int(N / 1.08)
for x in range(X - 1, X + 2):
if int(x * 1.08) == N:
print(x)
break
else:
print(":(")
| false | 0 | [
"-for a in range(0, N + 1):",
"- if int(a * 1.08) == N:",
"- print(a)",
"+X = int(N / 1.08)",
"+for x in range(X - 1, X + 2):",
"+ if int(x * 1.08) == N:",
"+ print(x)"
] | false | 0.086168 | 0.149098 | 0.57793 | [
"s162915961",
"s602265761"
] |
u970197315 | p03166 | python | s183711536 | s138786892 | 1,214 | 355 | 134,732 | 122,452 | Accepted | Accepted | 70.76 | import sys
sys.setrecursionlimit(10**9)
def dfs(cur):
if dp[cur]!=-1:
return dp[cur]
res=0
for nx in G[cur]:
res=max(res,dfs(nx)+1)
dp[cur]=res
return res
n,m=list(map(int,input().split()))
G=[[] for i in range(n)]
for i in range(m):
x,y=list(map(int,input().split()))
G[x-1].appe... | import sys
sys.setrecursionlimit(10**9)
n,m = list(map(int,input().split()))
G = [[] for _ in range(n)]
for _ in range(m):
x,y = list(map(int,input().split()))
x -= 1
y -= 1
G[x].append(y)
dp = [-1]*(n+1)
# dp[i]:頂点iに到達したときの有向辺の最長の長さ
def dfs(cur):
if dp[cur] != -1:
return dp... | 22 | 26 | 392 | 494 | import sys
sys.setrecursionlimit(10**9)
def dfs(cur):
if dp[cur] != -1:
return dp[cur]
res = 0
for nx in G[cur]:
res = max(res, dfs(nx) + 1)
dp[cur] = res
return res
n, m = list(map(int, input().split()))
G = [[] for i in range(n)]
for i in range(m):
x, y = list(map(int, inp... | import sys
sys.setrecursionlimit(10**9)
n, m = list(map(int, input().split()))
G = [[] for _ in range(n)]
for _ in range(m):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
G[x].append(y)
dp = [-1] * (n + 1)
# dp[i]:頂点iに到達したときの有向辺の最長の長さ
def dfs(cur):
if dp[cur] != -1:
return dp[cur]
... | false | 15.384615 | [
"-",
"-",
"+n, m = list(map(int, input().split()))",
"+G = [[] for _ in range(n)]",
"+for _ in range(m):",
"+ x, y = list(map(int, input().split()))",
"+ x -= 1",
"+ y -= 1",
"+ G[x].append(y)",
"+dp = [-1] * (n + 1)",
"+# dp[i]:頂点iに到達したときの有向辺の最長の長さ",
"-n, m = list(map(int, input()... | false | 0.074192 | 0.035286 | 2.102586 | [
"s183711536",
"s138786892"
] |
u036744414 | p03262 | python | s647041393 | s219310020 | 103 | 87 | 16,280 | 16,280 | Accepted | Accepted | 15.53 | # coding:utf-8
from fractions import gcd
n, y = list(map(int, input().split()))
dist_list = [abs(x-y) for x in map(int, input().split())]
if n == 1:
d = dist_list[0]
else:
d = gcd(dist_list[1], dist_list[0])
for i in range(n-2):
d = gcd(d, dist_list[i+1])
print(d)
| # coding:utf-8
from fractions import gcd
from functools import reduce
n, y = list(map(int, input().split()))
dist_list = [abs(x-y) for x in map(int, input().split())]
d = reduce(gcd, dist_list)
print(d)
| 16 | 12 | 300 | 213 | # coding:utf-8
from fractions import gcd
n, y = list(map(int, input().split()))
dist_list = [abs(x - y) for x in map(int, input().split())]
if n == 1:
d = dist_list[0]
else:
d = gcd(dist_list[1], dist_list[0])
for i in range(n - 2):
d = gcd(d, dist_list[i + 1])
print(d)
| # coding:utf-8
from fractions import gcd
from functools import reduce
n, y = list(map(int, input().split()))
dist_list = [abs(x - y) for x in map(int, input().split())]
d = reduce(gcd, dist_list)
print(d)
| false | 25 | [
"+from functools import reduce",
"-if n == 1:",
"- d = dist_list[0]",
"-else:",
"- d = gcd(dist_list[1], dist_list[0])",
"- for i in range(n - 2):",
"- d = gcd(d, dist_list[i + 1])",
"+d = reduce(gcd, dist_list)"
] | false | 0.056566 | 0.056363 | 1.003608 | [
"s647041393",
"s219310020"
] |
u905203728 | p03665 | python | s166019555 | s811487121 | 173 | 64 | 38,256 | 62,220 | Accepted | Accepted | 63.01 | from math import factorial
def cmb(n,r):
return factorial(n)//(factorial(n-r)*factorial(r))
n,p=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[A[i]%2 for i in range(n)]
cnt=A.count(0)
ans=0
for i in range(p,n-cnt+1,2):
ans +=cmb(n-cnt,i)
print((ans*(2**cnt))) | from math import factorial
n,p=list(map(int,input().split()))
A=list(map(int,input().split()))
a,b=0,0
for i in A:
if i%2==0:a +=1
else:b +=1
cnt=0 if p==1 else 1
for i in range(p,b+1,2):
if i==0:continue
cnt +=factorial(b)//(factorial(i)*factorial(b-i))
print((cnt*(2**a))) | 16 | 15 | 299 | 299 | from math import factorial
def cmb(n, r):
return factorial(n) // (factorial(n - r) * factorial(r))
n, p = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [A[i] % 2 for i in range(n)]
cnt = A.count(0)
ans = 0
for i in range(p, n - cnt + 1, 2):
ans += cmb(n - cnt, i)
print((ans * (2**c... | from math import factorial
n, p = list(map(int, input().split()))
A = list(map(int, input().split()))
a, b = 0, 0
for i in A:
if i % 2 == 0:
a += 1
else:
b += 1
cnt = 0 if p == 1 else 1
for i in range(p, b + 1, 2):
if i == 0:
continue
cnt += factorial(b) // (factorial(i) * facto... | false | 6.25 | [
"-",
"-",
"-def cmb(n, r):",
"- return factorial(n) // (factorial(n - r) * factorial(r))",
"-",
"-A = [A[i] % 2 for i in range(n)]",
"-cnt = A.count(0)",
"-ans = 0",
"-for i in range(p, n - cnt + 1, 2):",
"- ans += cmb(n - cnt, i)",
"-print((ans * (2**cnt)))",
"+a, b = 0, 0",
"+for i i... | false | 0.036627 | 0.036164 | 1.012796 | [
"s166019555",
"s811487121"
] |
u581187895 | p02913 | python | s728188359 | s594470863 | 744 | 436 | 270,292 | 78,992 | Accepted | Accepted | 41.4 |
def resolve():
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] = 0
else:
dp[i][j] = dp[i + 1][j + 1] + ... |
def Z_algo(S):
n = len(S)
LCP = [0]*n
i = 1
j = 0
c = 0#最も末尾側までLCPを求めたインデックス
for i in range(1, n):
#i番目からのLCPが以前計算したcからのLCPに含まれている場合
if i+LCP[i-c] < c+LCP[c]:
LCP[i] = LCP[i-c]
else:
j = max(0, c+LCP[c]-i)
while i+j < n an... | 23 | 34 | 513 | 705 | def resolve():
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] = 0
else:
dp[i][j] = dp[i + 1][j + 1] + 1
ans = 0... | def Z_algo(S):
n = len(S)
LCP = [0] * n
i = 1
j = 0
c = 0 # 最も末尾側までLCPを求めたインデックス
for i in range(1, n):
# i番目からのLCPが以前計算したcからのLCPに含まれている場合
if i + LCP[i - c] < c + LCP[c]:
LCP[i] = LCP[i - c]
else:
j = max(0, c + LCP[c] - i)
while i + j ... | false | 32.352941 | [
"+def Z_algo(S):",
"+ n = len(S)",
"+ LCP = [0] * n",
"+ i = 1",
"+ j = 0",
"+ c = 0 # 最も末尾側までLCPを求めたインデックス",
"+ for i in range(1, n):",
"+ # i番目からのLCPが以前計算したcからのLCPに含まれている場合",
"+ if i + LCP[i - c] < c + LCP[c]:",
"+ LCP[i] = LCP[i - c]",
"+ els... | false | 0.062044 | 0.036564 | 1.696867 | [
"s728188359",
"s594470863"
] |
u131634965 | p03294 | python | s549270841 | s991446736 | 171 | 90 | 5,640 | 3,316 | Accepted | Accepted | 47.37 | from functools import reduce
import fractions
n=int(eval(input()))
a_list=list(map(int,input().split()))
# 最小公倍数
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
# mの選び方 → 最小公倍数-1
m=lcm_list(a_list)-1
mod_all=0
for a in a_... | n=int(eval(input()))
a_list=list(map(int,input().split()))
# f(m)の最大値は、sum(ai-1)である。
# → m=a1*a2*...*aN -1 とすれば良い。
m=1
for a in a_list:
m*=a
m-=1
mod_all=0
for a in a_list:
mod_all+=m%a
print(mod_all) | 20 | 15 | 353 | 223 | from functools import reduce
import fractions
n = int(eval(input()))
a_list = list(map(int, input().split()))
# 最小公倍数
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
# mの選び方 → 最小公倍数-1
m = lcm_list(a_list) - 1
mod_all = 0
for a in a_list:
... | n = int(eval(input()))
a_list = list(map(int, input().split()))
# f(m)の最大値は、sum(ai-1)である。
# → m=a1*a2*...*aN -1 とすれば良い。
m = 1
for a in a_list:
m *= a
m -= 1
mod_all = 0
for a in a_list:
mod_all += m % a
print(mod_all)
| false | 25 | [
"-from functools import reduce",
"-import fractions",
"-",
"-# 最小公倍数",
"-def lcm_base(x, y):",
"- return (x * y) // fractions.gcd(x, y)",
"-",
"-",
"-def lcm_list(numbers):",
"- return reduce(lcm_base, numbers, 1)",
"-",
"-",
"-# mの選び方 → 最小公倍数-1",
"-m = lcm_list(a_list) - 1",
"+# f... | false | 0.055912 | 0.042691 | 1.309711 | [
"s549270841",
"s991446736"
] |
u556589653 | p03610 | python | s839351141 | s292485255 | 38 | 32 | 3,188 | 3,188 | Accepted | Accepted | 15.79 | s = eval(input())
ans = ""
for i in range(len(s)//2+1):
if 2*i < len(s):
ans += s[2*i]
else:
break
print(ans) | import math
s = eval(input())
ans = ""
for i in range(math.ceil(len(s)/2)):
ans += s[2*i]
print(ans) | 8 | 6 | 132 | 103 | s = eval(input())
ans = ""
for i in range(len(s) // 2 + 1):
if 2 * i < len(s):
ans += s[2 * i]
else:
break
print(ans)
| import math
s = eval(input())
ans = ""
for i in range(math.ceil(len(s) / 2)):
ans += s[2 * i]
print(ans)
| false | 25 | [
"+import math",
"+",
"-for i in range(len(s) // 2 + 1):",
"- if 2 * i < len(s):",
"- ans += s[2 * i]",
"- else:",
"- break",
"+for i in range(math.ceil(len(s) / 2)):",
"+ ans += s[2 * i]"
] | false | 0.039778 | 0.125088 | 0.318003 | [
"s839351141",
"s292485255"
] |
u078042885 | p00111 | python | s446882701 | s024984078 | 110 | 100 | 7,464 | 7,476 | Accepted | Accepted | 9.09 | en=[chr(i) for i in range(65,91)]+list(' .,-\'?')
de={
'101':' ','000000':'\'','000011':',','10010001':'-','010001':'.','000001':'?',
'100101':'A','10011010':'B','0101':'C','0001':'D','110':'E','01001':'F',
'10011011':'G','010000':'H','0111':'I','10011000':'J','0110':'K','00100':'L',
'10011001':'M','10011110':'N',... | en=[chr(i) for i in range(65,91)]+list(' .,-\'?')
de={
'101':' ','000000':'\'','000011':',','10010001':'-','010001':'.','000001':'?',
'100101':'A','10011010':'B','0101':'C','0001':'D','110':'E','01001':'F',
'10011011':'G','010000':'H','0111':'I','10011000':'J','0110':'K','00100':'L',
'10011001':'M','10011110':'N'... | 18 | 18 | 703 | 696 | en = [chr(i) for i in range(65, 91)] + list(" .,-'?")
de = {
"101": " ",
"000000": "'",
"000011": ",",
"10010001": "-",
"010001": ".",
"000001": "?",
"100101": "A",
"10011010": "B",
"0101": "C",
"0001": "D",
"110": "E",
"01001": "F",
"10011011": "G",
"010000": "H"... | en = [chr(i) for i in range(65, 91)] + list(" .,-'?")
de = {
"101": " ",
"000000": "'",
"000011": ",",
"10010001": "-",
"010001": ".",
"000001": "?",
"100101": "A",
"10011010": "B",
"0101": "C",
"0001": "D",
"110": "E",
"01001": "F",
"10011011": "G",
"010000": "H"... | false | 0 | [
"- s = input()",
"+ s = eval(input())",
"- a = b = \"\"",
"+ a = b = c = \"\"",
"- print(de[b], end=\"\")",
"+ c += de[b]",
"- print()",
"+ print(c)"
] | false | 0.037655 | 0.043696 | 0.861738 | [
"s446882701",
"s024984078"
] |
u332906195 | p02708 | python | s649090372 | s646542373 | 172 | 103 | 9,184 | 9,184 | Accepted | Accepted | 40.12 | mod, ans = 10 ** 9 + 7, 0
N, K = list(map(int, input().split()))
for k in range(K, N + 2):
ans += (N + 1) * (N + 2) // 2 - (N + 2 - k) * (N + 1 - k) // 2 + 1
ans -= k * (k + 1) // 2
ans = ans % mod
print(ans)
| mod = 10 ** 9 + 7
N, K = list(map(int, input().split()))
ans, R, L = 1, N * (N + 1) // 2, N * (N + 1) // 2
for i in range(N + 1 - K):
R, L = R - i, L - (N - i)
ans = (ans + R - L + 1) % mod
print(ans)
| 7 | 7 | 221 | 209 | mod, ans = 10**9 + 7, 0
N, K = list(map(int, input().split()))
for k in range(K, N + 2):
ans += (N + 1) * (N + 2) // 2 - (N + 2 - k) * (N + 1 - k) // 2 + 1
ans -= k * (k + 1) // 2
ans = ans % mod
print(ans)
| mod = 10**9 + 7
N, K = list(map(int, input().split()))
ans, R, L = 1, N * (N + 1) // 2, N * (N + 1) // 2
for i in range(N + 1 - K):
R, L = R - i, L - (N - i)
ans = (ans + R - L + 1) % mod
print(ans)
| false | 0 | [
"-mod, ans = 10**9 + 7, 0",
"+mod = 10**9 + 7",
"-for k in range(K, N + 2):",
"- ans += (N + 1) * (N + 2) // 2 - (N + 2 - k) * (N + 1 - k) // 2 + 1",
"- ans -= k * (k + 1) // 2",
"- ans = ans % mod",
"+ans, R, L = 1, N * (N + 1) // 2, N * (N + 1) // 2",
"+for i in range(N + 1 - K):",
"+ ... | false | 0.23491 | 0.059492 | 3.948613 | [
"s649090372",
"s646542373"
] |
u272028993 | p03703 | python | s107009063 | s812705665 | 400 | 294 | 104,060 | 120,092 | Accepted | Accepted | 26.5 | class BIT():
def __init__(self,size):
self.size=size
self.node=[0]*(size+1)
def sum(self,idx):
ret=0
while idx>0:
ret+=self.node[idx]
idx-=idx&(-idx)
return ret
def add(self,idx,x):
while idx<=self.size:
self... | class BIT():
def __init__(self,size):
self.size=size
self.node=[0]*(size+1)
def sum(self,idx):
ret=0
while idx>0:
ret+=self.node[idx]
idx-=idx&(-idx)
return ret
def add(self,idx,x):
while idx<=self.size:
self... | 46 | 41 | 972 | 818 | class BIT:
def __init__(self, size):
self.size = size
self.node = [0] * (size + 1)
def sum(self, idx):
ret = 0
while idx > 0:
ret += self.node[idx]
idx -= idx & (-idx)
return ret
def add(self, idx, x):
while idx <= self.size:
... | class BIT:
def __init__(self, size):
self.size = size
self.node = [0] * (size + 1)
def sum(self, idx):
ret = 0
while idx > 0:
ret += self.node[idx]
idx -= idx & (-idx)
return ret
def add(self, idx, x):
while idx <= self.size:
... | false | 10.869565 | [
"- bit.add(i + 1, 1)",
"- d[li[i]] = i",
"-pos = [[] for _ in range(len(li))]",
"+ d[li[i]] = i + 1",
"+ans = 0",
"- idx = d[diff[i]]",
"- pos[idx].append(i + 1)",
"-ans = 0",
"-for i in range(len(li)):",
"- for j in pos[i]:",
"- ans += bit.sum(n) - bit.sum(j)",
"- ... | false | 0.075444 | 0.04372 | 1.725644 | [
"s107009063",
"s812705665"
] |
u807028974 | p02756 | python | s684828296 | s746874840 | 876 | 531 | 93,160 | 9,180 | Accepted | Accepted | 39.38 | import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq
# import time
# import itertools
import collections
# from fractions import Fraction
mod = int(1e9+7)
INF = 1<<29
def main():
s = collections.deque(list(eval(input())))
q = int(eval(input()))
count = 0... | import collections
s = collections.deque(list(eval(input())))
q = int(eval(input()))
rev = 0
for i in range(q):
tfc = list(input().split())
if tfc[0]=='1':
rev = abs(rev-1)
else:
t,f,c = tfc
if rev:
if f=='1':
s.append(c)
else:
... | 45 | 28 | 967 | 589 | import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq
# import time
# import itertools
import collections
# from fractions import Fraction
mod = int(1e9 + 7)
INF = 1 << 29
def main():
s = collections.deque(list(eval(input())))
q = int(eval(input()))
count = 0
for i ... | import collections
s = collections.deque(list(eval(input())))
q = int(eval(input()))
rev = 0
for i in range(q):
tfc = list(input().split())
if tfc[0] == "1":
rev = abs(rev - 1)
else:
t, f, c = tfc
if rev:
if f == "1":
s.append(c)
else:
... | false | 37.777778 | [
"-import sys",
"-",
"-# import math",
"-# import decimal",
"-# import queue",
"-# import bisect",
"-# import heapq",
"-# import time",
"-# import itertools",
"-# from fractions import Fraction",
"-mod = int(1e9 + 7)",
"-INF = 1 << 29",
"-",
"-",
"-def main():",
"- s = collections.de... | false | 0.035252 | 0.056893 | 0.619622 | [
"s684828296",
"s746874840"
] |
u481187938 | p03557 | python | s992721433 | s237218357 | 324 | 261 | 105,148 | 109,872 | Accepted | Accepted | 19.44 | #!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify
import itertools
import math, fractions
import sys, copy
def L(): return sys.stdin.readline... | #!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify
import itertools
import math, fractions
import sys, copy
def L(): return sys.stdin.readline... | 51 | 63 | 1,785 | 2,131 | #!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify
import itertools
import math, fractions
import sys, copy
def L():
return sys.stdin.readline().spl... | #!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify
import itertools
import math, fractions
import sys, copy
def L():
return sys.stdin.readline().spl... | false | 19.047619 | [
"- ans += bisect_left(A, bi) * (N - bisect_right(C, bi))",
"+ left, right = -1, N",
"+ while right - left > 1:",
"+ mid = (right + left) // 2",
"+ if A[mid] < bi:",
"+ left = mid",
"+ else:",
"+ right = mid",
"+ ... | false | 0.036005 | 0.041838 | 0.860577 | [
"s992721433",
"s237218357"
] |
u407513296 | p02682 | python | s189158104 | s974896106 | 23 | 21 | 9,124 | 9,064 | Accepted | Accepted | 8.7 | a, b, c, k = list(map(int, input().split()))
if a >= k:
print(k)
exit()
if k-a-b <= 0:
print(a)
exit()
print((a-(k-a-b)))
| a, b, c, k = list(map(int, input().split()))
if a >= k:
print(k)
exit()
if b >= k-a:
print(a)
exit()
if c >= k-a-b:
print((a-(k-a-b)))
exit()
print((a-c))
| 11 | 13 | 143 | 183 | a, b, c, k = list(map(int, input().split()))
if a >= k:
print(k)
exit()
if k - a - b <= 0:
print(a)
exit()
print((a - (k - a - b)))
| a, b, c, k = list(map(int, input().split()))
if a >= k:
print(k)
exit()
if b >= k - a:
print(a)
exit()
if c >= k - a - b:
print((a - (k - a - b)))
exit()
print((a - c))
| false | 15.384615 | [
"-if k - a - b <= 0:",
"+if b >= k - a:",
"-print((a - (k - a - b)))",
"+if c >= k - a - b:",
"+ print((a - (k - a - b)))",
"+ exit()",
"+print((a - c))"
] | false | 0.045099 | 0.038048 | 1.185326 | [
"s189158104",
"s974896106"
] |
u312025627 | p02763 | python | s117395496 | s055366891 | 1,600 | 1,349 | 272,620 | 253,600 | Accepted | Accepted | 15.69 | class BIT:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self.size:
self.tree[i] +=... | class BIT:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self.size:
self.tree[i] +=... | 69 | 75 | 1,671 | 1,868 | class BIT:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self.size:
self.tree[i] += x
... | class BIT:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self.size:
self.tree[i] += x
... | false | 8 | [
"+ import sys",
"+",
"+ input = sys.stdin.readline",
"- S = [s for s in input()]",
"- BIT26 = [RangeUpdate(N) for i in range(26)]",
"- for i, s in enumerate(S):",
"- j = dic[s]",
"- BIT26[j].add(i + 1, i + 1, 1)",
"+ S = [dic[s] for s in input().rstrip()]",
"- fo... | false | 0.062053 | 0.08675 | 0.715304 | [
"s117395496",
"s055366891"
] |
u836311327 | p02555 | python | s950673569 | s246266891 | 76 | 62 | 9,160 | 9,212 | Accepted | Accepted | 18.42 | import sys
def input(): return sys.stdin.readline().rstrip()
def per(n, r, mod=10**9+7): # 順列数
per = 1
for i in range(r):
per = per*(n-i) % mod
return per
def com(n, r, mod=10**9+7): # 組み合わせ数
bunshi = per(n, r, mod)
bunbo = 1
for i in range(1, r+1):
bunbo = b... | import sys
def input(): return sys.stdin.readline().rstrip()
def per(n, r, mod=10**9+7): # 順列数
per = 1
for i in range(r):
per = per*(n-i) % mod
return per
def com(n, r, mod=10**9+7): # 組み合わせ数
r = min(n-r, r)
bunshi = per(n, r, mod)
bunbo = 1
for i in range(1, r... | 31 | 34 | 621 | 719 | import sys
def input():
return sys.stdin.readline().rstrip()
def per(n, r, mod=10**9 + 7): # 順列数
per = 1
for i in range(r):
per = per * (n - i) % mod
return per
def com(n, r, mod=10**9 + 7): # 組み合わせ数
bunshi = per(n, r, mod)
bunbo = 1
for i in range(1, r + 1):
bunbo = ... | import sys
def input():
return sys.stdin.readline().rstrip()
def per(n, r, mod=10**9 + 7): # 順列数
per = 1
for i in range(r):
per = per * (n - i) % mod
return per
def com(n, r, mod=10**9 + 7): # 組み合わせ数
r = min(n - r, r)
bunshi = per(n, r, mod)
bunbo = 1
for i in range(1, r ... | false | 8.823529 | [
"+ r = min(n - r, r)",
"+def comH(n, r, mod=10**9 + 7): # n種類からr個取る重複組み合わせ数",
"+ return com(n + r - 1, r, mod)",
"+",
"+",
"- ans += com(k + i - 1, i - 1)",
"+ ans += comH(i, k)"
] | false | 0.092312 | 0.105301 | 0.876652 | [
"s950673569",
"s246266891"
] |
u063346608 | p02681 | python | s264182936 | s091884558 | 28 | 25 | 9,036 | 8,896 | Accepted | Accepted | 10.71 | S = eval(input())
T = eval(input())
flag = 0
for i in range(len(S)):
if S[i] != T[i]:
flag = 1
break
if flag == 1:
print("No")
else:
print("Yes") | S = eval(input())
T = eval(input())
#print(type(S),type(S[0:len(S)]))
#print(T[0:len(T)])
if S == T[0:len(S)]:
print("Yes")
else:
print("No") | 13 | 10 | 154 | 142 | S = eval(input())
T = eval(input())
flag = 0
for i in range(len(S)):
if S[i] != T[i]:
flag = 1
break
if flag == 1:
print("No")
else:
print("Yes")
| S = eval(input())
T = eval(input())
# print(type(S),type(S[0:len(S)]))
# print(T[0:len(T)])
if S == T[0 : len(S)]:
print("Yes")
else:
print("No")
| false | 23.076923 | [
"-flag = 0",
"-for i in range(len(S)):",
"- if S[i] != T[i]:",
"- flag = 1",
"- break",
"-if flag == 1:",
"+# print(type(S),type(S[0:len(S)]))",
"+# print(T[0:len(T)])",
"+if S == T[0 : len(S)]:",
"+ print(\"Yes\")",
"+else:",
"-else:",
"- print(\"Yes\")"
] | false | 0.069599 | 0.080812 | 0.861242 | [
"s264182936",
"s091884558"
] |
u166306121 | p03041 | python | s240326957 | s909460015 | 157 | 55 | 5,588 | 5,588 | Accepted | Accepted | 64.97 | import sys
# gcd
from fractions import gcd
# 切り上げ,切り捨て
# from math import ceil, floor
# リストの真のコピー(変更が伝播しない)
# from copy import deepcopy
# 累積和。list(accumulate(A))としてAの累積和
from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# S = Counter(l) # カウンタークラスが作られる。S=Coun... | import sys
# gcd
from fractions import gcd
# 切り上げ,切り捨て
# from math import ceil, floor
# リストの真のコピー(変更が伝播しない)
# from copy import deepcopy
# 累積和。list(accumulate(A))としてAの累積和
from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# S = Counter(l) # カウンタークラスが作られる。S=Coun... | 50 | 46 | 1,372 | 1,309 | import sys
# gcd
from fractions import gcd
# 切り上げ,切り捨て
# from math import ceil, floor
# リストの真のコピー(変更が伝播しない)
# from copy import deepcopy
# 累積和。list(accumulate(A))としてAの累積和
from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# S = Counter(l) # カウンタークラスが作られる。S=Counter({'b... | import sys
# gcd
from fractions import gcd
# 切り上げ,切り捨て
# from math import ceil, floor
# リストの真のコピー(変更が伝播しない)
# from copy import deepcopy
# 累積和。list(accumulate(A))としてAの累積和
from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# S = Counter(l) # カウンタークラスが作られる。S=Counter({'b... | false | 8 | [
"-# import os",
"-# fin = open('in_2.txt', 'r')",
"+# fin = open('in_1.txt', 'r')",
"- # tokens = iterate_tokens()",
"- # N = int(next(tokens)) # type: int",
"- # K = int(next(tokens)) # type: int",
"- # S = next(tokens) # type: str",
"- N, K = mi()",
"- S = li()",
"+ token... | false | 0.045013 | 0.045127 | 0.997488 | [
"s240326957",
"s909460015"
] |
u214617707 | p03252 | python | s352077310 | s423741139 | 89 | 74 | 3,632 | 3,632 | Accepted | Accepted | 16.85 | S = eval(input())
T = eval(input())
dic = {}
flag = False
N = len(S)
for i in range(N):
if S[i] in list(dic.keys()):
if T[i] != dic[S[i]]:
flag = True
break
else:
dic[S[i]] = T[i]
if flag or len(list(dic.values())) != len(set(dic.values())):
print("No")... | S = eval(input())
T = eval(input())
N = len(S)
d = {}
d1 = {}
for i in range(N):
if S[i] in d:
if d[S[i]] != T[i]:
print('No')
exit()
elif T[i] in d1:
if d1[T[i]] != S[i]:
print('No')
exit()
else:
d[S[i]] = T[i]
... | 17 | 20 | 321 | 342 | S = eval(input())
T = eval(input())
dic = {}
flag = False
N = len(S)
for i in range(N):
if S[i] in list(dic.keys()):
if T[i] != dic[S[i]]:
flag = True
break
else:
dic[S[i]] = T[i]
if flag or len(list(dic.values())) != len(set(dic.values())):
print("No")
else:
prin... | S = eval(input())
T = eval(input())
N = len(S)
d = {}
d1 = {}
for i in range(N):
if S[i] in d:
if d[S[i]] != T[i]:
print("No")
exit()
elif T[i] in d1:
if d1[T[i]] != S[i]:
print("No")
exit()
else:
d[S[i]] = T[i]
d1[T[i]] = S[i]
... | false | 15 | [
"-dic = {}",
"-flag = False",
"+d = {}",
"+d1 = {}",
"- if S[i] in list(dic.keys()):",
"- if T[i] != dic[S[i]]:",
"- flag = True",
"- break",
"+ if S[i] in d:",
"+ if d[S[i]] != T[i]:",
"+ print(\"No\")",
"+ exit()",
"+ elif ... | false | 0.036294 | 0.03751 | 0.967575 | [
"s352077310",
"s423741139"
] |
u841568901 | p03408 | python | s094740587 | s682812537 | 29 | 26 | 9,000 | 9,076 | Accepted | Accepted | 10.34 | A = int(eval(input()))
X = [eval(input()) for _ in range(A)]
B = int(eval(input()))
Y = [eval(input()) for _ in range(B)]
t = 0
for x in X:
if X.count(x)-Y.count(x)>t:
t = X.count(x)-Y.count(x)
else:
pass
print(t) | N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
S_set = set(S)
M = int(eval(input()))
T = [eval(input()) for _ in range(M)]
m = 0
for s in S_set:
m = max(m, S.count(s)-T.count(s))
print(m) | 11 | 9 | 211 | 187 | A = int(eval(input()))
X = [eval(input()) for _ in range(A)]
B = int(eval(input()))
Y = [eval(input()) for _ in range(B)]
t = 0
for x in X:
if X.count(x) - Y.count(x) > t:
t = X.count(x) - Y.count(x)
else:
pass
print(t)
| N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
S_set = set(S)
M = int(eval(input()))
T = [eval(input()) for _ in range(M)]
m = 0
for s in S_set:
m = max(m, S.count(s) - T.count(s))
print(m)
| false | 18.181818 | [
"-A = int(eval(input()))",
"-X = [eval(input()) for _ in range(A)]",
"-B = int(eval(input()))",
"-Y = [eval(input()) for _ in range(B)]",
"-t = 0",
"-for x in X:",
"- if X.count(x) - Y.count(x) > t:",
"- t = X.count(x) - Y.count(x)",
"- else:",
"- pass",
"-print(t)",
"+N = ... | false | 0.042274 | 0.037331 | 1.132408 | [
"s094740587",
"s682812537"
] |
u858742833 | p02703 | python | s944086927 | s591288435 | 252 | 199 | 70,248 | 71,196 | Accepted | Accepted | 21.03 | import heapq
def main():
N, M, S = list(map(int, input().split()))
AB = [[] for _ in range(N)]
maxA = 0
for _ in range(M):
u, v, a, b = list(map(int, input().split()))
AB[u - 1].append((a, b, v - 1))
AB[v - 1].append((a, b, u - 1))
maxA = max(maxA, a)
for ... | import heapq
def main():
N, M, S = list(map(int, input().split()))
AB = [[] for _ in range(N)]
maxA = 0
for _ in range(M):
u, v, a, b = list(map(int, input().split()))
AB[u - 1].append((a, b, v - 1))
AB[v - 1].append((a, b, u - 1))
maxA = max(maxA, a)
for ... | 40 | 41 | 1,094 | 1,128 | import heapq
def main():
N, M, S = list(map(int, input().split()))
AB = [[] for _ in range(N)]
maxA = 0
for _ in range(M):
u, v, a, b = list(map(int, input().split()))
AB[u - 1].append((a, b, v - 1))
AB[v - 1].append((a, b, u - 1))
maxA = max(maxA, a)
for i in range... | import heapq
def main():
N, M, S = list(map(int, input().split()))
AB = [[] for _ in range(N)]
maxA = 0
for _ in range(M):
u, v, a, b = list(map(int, input().split()))
AB[u - 1].append((a, b, v - 1))
AB[v - 1].append((a, b, u - 1))
maxA = max(maxA, a)
for i in range... | false | 2.439024 | [
"- heapq.heappush(cur, (t + b, v, s - a))",
"+ if P[v] < s - a:",
"+ heapq.heappush(cur, (t + b, v, s - a))"
] | false | 0.115489 | 0.042293 | 2.730652 | [
"s944086927",
"s591288435"
] |
u823044869 | p03610 | python | s499544918 | s918944440 | 60 | 17 | 6,516 | 3,188 | Accepted | Accepted | 71.67 | s = input()
output_char = list(range(0,len(s),2))
for i in output_char:
print(s[i], end='')
| s = eval(input())
print((s[::2]))
| 5 | 3 | 100 | 29 | s = input()
output_char = list(range(0, len(s), 2))
for i in output_char:
print(s[i], end="")
| s = eval(input())
print((s[::2]))
| false | 40 | [
"-s = input()",
"-output_char = list(range(0, len(s), 2))",
"-for i in output_char:",
"- print(s[i], end=\"\")",
"+s = eval(input())",
"+print((s[::2]))"
] | false | 0.062749 | 0.039852 | 1.574521 | [
"s499544918",
"s918944440"
] |
u400765446 | p02389 | python | s880229870 | s602303053 | 30 | 20 | 7,748 | 5,580 | Accepted | Accepted | 33.33 | def main():
x = eval(input())
x1, x2 = x.split(' ')
a = int(x1)
b = int(x2)
print((a*b, 2*(a+b)))
if __name__ == "__main__":
main() | a, b = list(map(int, input().split()))
area = a * b
perimeter = 2 * (a + b)
print((area, perimeter))
| 9 | 5 | 157 | 98 | def main():
x = eval(input())
x1, x2 = x.split(" ")
a = int(x1)
b = int(x2)
print((a * b, 2 * (a + b)))
if __name__ == "__main__":
main()
| a, b = list(map(int, input().split()))
area = a * b
perimeter = 2 * (a + b)
print((area, perimeter))
| false | 44.444444 | [
"-def main():",
"- x = eval(input())",
"- x1, x2 = x.split(\" \")",
"- a = int(x1)",
"- b = int(x2)",
"- print((a * b, 2 * (a + b)))",
"-",
"-",
"-if __name__ == \"__main__\":",
"- main()",
"+a, b = list(map(int, input().split()))",
"+area = a * b",
"+perimeter = 2 * (a + b... | false | 0.071044 | 0.065802 | 1.079669 | [
"s880229870",
"s602303053"
] |
u379499530 | p00033 | python | s038277847 | s780606954 | 20 | 10 | 6,372 | 6,324 | Accepted | Accepted | 50 | N = eval(input())
for i in range(N):
b, c = [0], [0]
for j in map(int, input().split()):
if b[-1] < j: b.append(j)
elif c[-1] < j: c.append(j)
else: break
else:
print('YES')
continue
print('NO') | N = eval(input())
for i in range(N):
b, c = 0, 0
for j in map(int, input().split()):
if b < j: b = j
elif c < j: c = j
else: break
else:
print('YES')
continue
print('NO') | 11 | 11 | 257 | 233 | N = eval(input())
for i in range(N):
b, c = [0], [0]
for j in map(int, input().split()):
if b[-1] < j:
b.append(j)
elif c[-1] < j:
c.append(j)
else:
break
else:
print("YES")
continue
print("NO")
| N = eval(input())
for i in range(N):
b, c = 0, 0
for j in map(int, input().split()):
if b < j:
b = j
elif c < j:
c = j
else:
break
else:
print("YES")
continue
print("NO")
| false | 0 | [
"- b, c = [0], [0]",
"+ b, c = 0, 0",
"- if b[-1] < j:",
"- b.append(j)",
"- elif c[-1] < j:",
"- c.append(j)",
"+ if b < j:",
"+ b = j",
"+ elif c < j:",
"+ c = j"
] | false | 0.034662 | 0.0359 | 0.965514 | [
"s038277847",
"s780606954"
] |
u223133214 | p03127 | python | s681114760 | s791761929 | 163 | 94 | 15,020 | 16,280 | Accepted | Accepted | 42.33 | n=int(eval(input()))
a_s=list(map(int,input().split()))
def sakujo(a_list):
for i in range(len(a_list)):
if a_list[i]!=0:
end=i
break
return a_list[i:]
while True:
a_s.sort()
a_s=sakujo(a_s)
if len(a_s)==1:
break
for i in range(1,len(a_s))... | from fractions import gcd
n=int(eval(input()))
a_s=list(map(int,input().split()))
a=a_s[0]
for i in range(n):
ans=gcd(a,a_s[i])
a=ans
print(ans)
| 19 | 8 | 365 | 154 | n = int(eval(input()))
a_s = list(map(int, input().split()))
def sakujo(a_list):
for i in range(len(a_list)):
if a_list[i] != 0:
end = i
break
return a_list[i:]
while True:
a_s.sort()
a_s = sakujo(a_s)
if len(a_s) == 1:
break
for i in range(1, len(a_s)... | from fractions import gcd
n = int(eval(input()))
a_s = list(map(int, input().split()))
a = a_s[0]
for i in range(n):
ans = gcd(a, a_s[i])
a = ans
print(ans)
| false | 57.894737 | [
"+from fractions import gcd",
"+",
"-",
"-",
"-def sakujo(a_list):",
"- for i in range(len(a_list)):",
"- if a_list[i] != 0:",
"- end = i",
"- break",
"- return a_list[i:]",
"-",
"-",
"-while True:",
"- a_s.sort()",
"- a_s = sakujo(a_s)",
"- ... | false | 0.045493 | 0.056762 | 0.801473 | [
"s681114760",
"s791761929"
] |
u365512540 | p02958 | python | s526715120 | s653046218 | 270 | 149 | 18,200 | 12,460 | Accepted | Accepted | 44.81 | import numpy as np
n = int(input())
pn = np.array(list(map(lambda x: int(x), input().split(' '))))
diff = np.count_nonzero(pn != np.arange(1, n + 1, dtype='int'))
print('YES') if diff in [0, 2] else print('NO')
| import numpy as np
print('YES') if np.count_nonzero(np.array(np.arange(1, int(input())+1) != list(map(int, input().split())))) < 3 else print('NO')
| 6 | 2 | 217 | 148 | import numpy as np
n = int(input())
pn = np.array(list(map(lambda x: int(x), input().split(" "))))
diff = np.count_nonzero(pn != np.arange(1, n + 1, dtype="int"))
print("YES") if diff in [0, 2] else print("NO")
| import numpy as np
print("YES") if np.count_nonzero(
np.array(np.arange(1, int(input()) + 1) != list(map(int, input().split())))
) < 3 else print("NO")
| false | 66.666667 | [
"-n = int(input())",
"-pn = np.array(list(map(lambda x: int(x), input().split(\" \"))))",
"-diff = np.count_nonzero(pn != np.arange(1, n + 1, dtype=\"int\"))",
"-print(\"YES\") if diff in [0, 2] else print(\"NO\")",
"+print(\"YES\") if np.count_nonzero(",
"+ np.array(np.arange(1, int(input()) + 1) != l... | false | 0.59724 | 0.311494 | 1.917343 | [
"s526715120",
"s653046218"
] |
u623687794 | p02996 | python | s514235802 | s558458734 | 957 | 629 | 53,720 | 53,628 | Accepted | Accepted | 34.27 | n=int(eval(input()))
time=0
tasks=[]
for i in range(n):
tasks.append(list(map(int,input().split())))
tasks.sort(key=lambda x:x[1])
flag=0
for i in range(n):
time+=tasks[i][0]
if time>tasks[i][1]:
flag=1
break
if flag==0:
print("Yes")
else:
print("No") | import sys
input= sys.stdin.readline
n=int(eval(input()))
time=0
tasks=[]
for i in range(n):
tasks.append(list(map(int,input().split())))
tasks.sort(key=lambda x:x[1])
flag=0
for i in range(n):
time+=tasks[i][0]
if time>tasks[i][1]:
flag=1
break
if flag==0:
print("Yes")
else:
print("N... | 16 | 18 | 278 | 318 | n = int(eval(input()))
time = 0
tasks = []
for i in range(n):
tasks.append(list(map(int, input().split())))
tasks.sort(key=lambda x: x[1])
flag = 0
for i in range(n):
time += tasks[i][0]
if time > tasks[i][1]:
flag = 1
break
if flag == 0:
print("Yes")
else:
print("No")
| import sys
input = sys.stdin.readline
n = int(eval(input()))
time = 0
tasks = []
for i in range(n):
tasks.append(list(map(int, input().split())))
tasks.sort(key=lambda x: x[1])
flag = 0
for i in range(n):
time += tasks[i][0]
if time > tasks[i][1]:
flag = 1
break
if flag == 0:
print("Yes... | false | 11.111111 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.038074 | 0.039465 | 0.964757 | [
"s514235802",
"s558458734"
] |
u426649993 | p03386 | python | s312198168 | s623052765 | 21 | 18 | 3,444 | 3,060 | Accepted | Accepted | 14.29 | from collections import OrderedDict
if __name__ == "__main__":
a, b, k = list(map(int, input().split()))
output = OrderedDict()
for i in range(k):
if a<= a+i <= b:
output[a+i] = a+i
for i in range(-k+1,1):
if a<= b+i <= b:
output[b+i] = b+i
... | def main():
A, B, K = list(map(int, input().split()))
ans = list()
ans.extend(list(range(A, A+K)))
ans.extend(list(range(B, B-K, -1)))
ans = list(set(ans))
ans.sort()
for a in ans:
if A <= a <= B:
print(a)
if __name__ == "__main__":
main()
| 16 | 17 | 363 | 295 | from collections import OrderedDict
if __name__ == "__main__":
a, b, k = list(map(int, input().split()))
output = OrderedDict()
for i in range(k):
if a <= a + i <= b:
output[a + i] = a + i
for i in range(-k + 1, 1):
if a <= b + i <= b:
output[b + i] = b + i
f... | def main():
A, B, K = list(map(int, input().split()))
ans = list()
ans.extend(list(range(A, A + K)))
ans.extend(list(range(B, B - K, -1)))
ans = list(set(ans))
ans.sort()
for a in ans:
if A <= a <= B:
print(a)
if __name__ == "__main__":
main()
| false | 5.882353 | [
"-from collections import OrderedDict",
"+def main():",
"+ A, B, K = list(map(int, input().split()))",
"+ ans = list()",
"+ ans.extend(list(range(A, A + K)))",
"+ ans.extend(list(range(B, B - K, -1)))",
"+ ans = list(set(ans))",
"+ ans.sort()",
"+ for a in ans:",
"+ if ... | false | 0.036887 | 0.03539 | 1.04231 | [
"s312198168",
"s623052765"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.